aboutsummaryrefslogtreecommitdiff
path: root/src/test/compile-fail
diff options
context:
space:
mode:
authorRafael Ávila de Espíndola <[email protected]>2011-01-10 15:56:55 -0500
committerGraydon Hoare <[email protected]>2011-01-11 13:58:39 -0800
commitc5a766f13379e543d2721b610c8eb6f3beb2af69 (patch)
tree4e0857ddd4bd08c32a37470e4ee64c5b193b970c /src/test/compile-fail
parentSketch support for reading multi-file crates in rustc. Add test, not yet work... (diff)
downloadrust-c5a766f13379e543d2721b610c8eb6f3beb2af69.tar.xz
rust-c5a766f13379e543d2721b610c8eb6f3beb2af69.zip
Fix two invalid import cases we were not detecting:
* If an import was unused we would never print any errors for it. * We would keep the existing environment in scope when descending 'foo.bar' and would find 'bar' in the global environment if there was no 'bar' in 'foo'.
Diffstat (limited to 'src/test/compile-fail')
-rw-r--r--src/test/compile-fail/import.rs11
-rw-r--r--src/test/compile-fail/import2.rs12
2 files changed, 23 insertions, 0 deletions
diff --git a/src/test/compile-fail/import.rs b/src/test/compile-fail/import.rs
new file mode 100644
index 00000000..71ef0dec
--- /dev/null
+++ b/src/test/compile-fail/import.rs
@@ -0,0 +1,11 @@
+// error-pattern: unresolved name: baz
+import zed.bar;
+import zed.baz;
+mod zed {
+ fn bar() {
+ log "bar";
+ }
+}
+fn main(vec[str] args) {
+ bar();
+}
diff --git a/src/test/compile-fail/import2.rs b/src/test/compile-fail/import2.rs
new file mode 100644
index 00000000..5a9ddcbd
--- /dev/null
+++ b/src/test/compile-fail/import2.rs
@@ -0,0 +1,12 @@
+// error-pattern: unresolved name: zed
+import baz.zed.bar;
+mod baz {
+}
+mod zed {
+ fn bar() {
+ log "bar3";
+ }
+}
+fn main(vec[str] args) {
+ bar();
+}