aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorGraydon Hoare <[email protected]>2010-07-19 13:25:04 -0700
committerGraydon Hoare <[email protected]>2010-07-19 13:25:04 -0700
commit1f0656d9084970fcc02ba9c27277265b8b3b7217 (patch)
tree6e01b1b764e009ac48a12666f5d270faf056067f /src/test
parentFix over-optimistic resolution of self-methods within obj scopes. There is no... (diff)
downloadrust-1f0656d9084970fcc02ba9c27277265b8b3b7217.tar.xz
rust-1f0656d9084970fcc02ba9c27277265b8b3b7217.zip
Add a test for an obvious-seeming (but not actually legal) kind of cast attempted in issue #115, downgrade bug to an err in type.ml so you get a better message.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/constructor-as-cast.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/test/compile-fail/constructor-as-cast.rs b/src/test/compile-fail/constructor-as-cast.rs
new file mode 100644
index 00000000..2374cd2c
--- /dev/null
+++ b/src/test/compile-fail/constructor-as-cast.rs
@@ -0,0 +1,13 @@
+// error-pattern: non-type context
+type base =
+ obj {
+ fn foo();
+ };
+obj derived() {
+ fn foo() {}
+ fn bar() {}
+}
+fn main() {
+ let derived d = derived();
+ let base b = base(d);
+}