]> git.lizzy.rs Git - rust.git/commitdiff
Look at the type params of an item_ty when resolving.
authorRafael Ávila de Espíndola <respindola@mozilla.com>
Wed, 19 Jan 2011 21:13:33 +0000 (16:13 -0500)
committerRafael Ávila de Espíndola <respindola@mozilla.com>
Wed, 19 Jan 2011 21:13:33 +0000 (16:13 -0500)
src/Makefile
src/comp/middle/resolve.rs
src/test/run-pass/type-param.rs [new file with mode: 0644]

index c68094430b2b73448062473bc6e5cac5b96b203d..628b00cb3b70d7cd4fe5d580004a9ece3588fdf6 100644 (file)
@@ -468,6 +468,7 @@ TEST_XFAILS_RUSTC := $(filter-out \
                         simple-obj.rs \
                         stateful-obj.rs \
                         type-in-nested-module.rs \
+                        type-param.rs \
                         tup.rs \
                         u32-decr.rs \
                         u8-incr.rs \
index e0514ad8d619b929ac0c98e8e4f60f31c7ef80f9..a9e6802e88b6b6851fd3b59f15d58494aa3133c6 100644 (file)
@@ -305,6 +305,14 @@ fn in_scope(ast.ident i, &scope s) -> option.t[def_wrap] {
                     case (ast.item_mod(_, ?m, _)) {
                         ret check_mod(i, m);
                     }
+                    case (ast.item_ty(_, _, ?ty_params, _, _)) {
+                        for (ast.ty_param tp in ty_params) {
+                            if (_str.eq(tp.ident, i)) {
+                                auto t = ast.def_ty_arg(tp.id);
+                                ret some(def_wrap_other(t));
+                            }
+                        }
+                    }
                     case (_) { /* fall through */ }
                 }
             }
@@ -448,7 +456,6 @@ fn fold_view_item_import(&env e, &span sp,
                                                               target_def));
 }
 
-
 fn fold_ty_path(&env e, &span sp, ast.path p, &option.t[def] d) -> @ast.ty {
 
     let uint len = _vec.len[ast.ident](p.node.idents);
diff --git a/src/test/run-pass/type-param.rs b/src/test/run-pass/type-param.rs
new file mode 100644 (file)
index 0000000..9525190
--- /dev/null
@@ -0,0 +1,5 @@
+type lteq[T] = fn(&T a) -> bool;
+
+fn main(vec[str] args) {
+
+}