Produce better errors for invalid imports.

This commit is contained in:
Rafael Ávila de Espíndola 2011-01-12 15:03:00 -05:00 committed by Graydon Hoare
parent c489abedb4
commit c1f2e29596
3 changed files with 13 additions and 0 deletions

View file

@ -404,6 +404,7 @@ TEST_XFAILS_BOOT := $(TASK_XFAILS) \
test/run-fail/task-comm-14.rs \ test/run-fail/task-comm-14.rs \
test/compile-fail/import.rs \ test/compile-fail/import.rs \
test/compile-fail/import2.rs \ test/compile-fail/import2.rs \
test/compile-fail/import3.rs \
test/compile-fail/bad-recv.rs \ test/compile-fail/bad-recv.rs \
test/compile-fail/bad-send.rs \ test/compile-fail/bad-send.rs \
test/compile-fail/infinite-vec-type-recursion.rs \ test/compile-fail/infinite-vec-type-recursion.rs \

View file

@ -90,6 +90,12 @@ fn find_final_def(&env e, &span sp, vec[ident] idents) -> option.t[def_wrap] {
auto new_e = update_env_for_item(tmp_e, i); auto new_e = update_env_for_item(tmp_e, i);
ret find_final_def(new_e, sp, new_idents); ret find_final_def(new_e, sp, new_idents);
} }
case (def_wrap_use(?c)) {
e.sess.span_err(sp, "Crate access is not implemented");
}
case (_) {
e.sess.span_err(sp, first + " is not a module or crate");
}
} }
} }
} }

View file

@ -0,0 +1,6 @@
// error-pattern: main is not a module or crate
import main.bar;
fn main(vec[str] args) {
log "foo";
}