aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/comp/middle/resolve.rs21
-rw-r--r--src/test/run-pass/alt-path.rs3
2 files changed, 4 insertions, 20 deletions
diff --git a/src/comp/middle/resolve.rs b/src/comp/middle/resolve.rs
index 8010b2a5..21959b61 100644
--- a/src/comp/middle/resolve.rs
+++ b/src/comp/middle/resolve.rs
@@ -486,25 +486,10 @@ fn fold_view_item_import(&env e, &span sp,
}
fn fold_ty_path(&env e, &span sp, ast.path p, &option.t[def] d) -> @ast.ty {
+ auto index = new_def_hash[def_wrap]();
+ auto d = find_final_def(e, index, sp, p.node.idents, none[ast.def_id]);
- let uint len = _vec.len[ast.ident](p.node.idents);
- check (len != 0u);
- if (len > 1u) {
- e.sess.unimpl("resolving path ty with >1 component");
- }
-
- auto d_ = lookup_name(e, p.node.idents.(0));
-
- alt (d_) {
- case (some[def](?d)) {
- // log "resolved name " + p.node.idents.(0);
- }
- case (none[def]) {
- e.sess.span_err(sp, "unresolved name: " + p.node.idents.(0));
- }
- }
-
- ret @fold.respan[ast.ty_](sp, ast.ty_path(p, d_));
+ ret @fold.respan[ast.ty_](sp, ast.ty_path(p, some(unwrap_def(d))));
}
fn update_env_for_crate(&env e, @ast.crate c) -> env {
diff --git a/src/test/run-pass/alt-path.rs b/src/test/run-pass/alt-path.rs
index 45faa700..ad55713b 100644
--- a/src/test/run-pass/alt-path.rs
+++ b/src/test/run-pass/alt-path.rs
@@ -1,11 +1,10 @@
-import m1.foo;
mod m1 {
tag foo {
foo1;
foo2;
}
}
-fn bar(foo x) {
+fn bar(m1.foo x) {
alt(x) {
case (m1.foo1) {
}