aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRafael Ávila de Espíndola <[email protected]>2011-01-19 16:13:33 -0500
committerRafael Ávila de Espíndola <[email protected]>2011-01-19 16:13:33 -0500
commit35d53b7eb17c17ac492aa67f843c94e8db1731e1 (patch)
treede6d3c190daaa01cb87018c63ec69d18255f6e13 /src
parentFold function output and argument types. With this change we fail to compile (diff)
downloadrust-35d53b7eb17c17ac492aa67f843c94e8db1731e1.tar.xz
rust-35d53b7eb17c17ac492aa67f843c94e8db1731e1.zip
Look at the type params of an item_ty when resolving.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile1
-rw-r--r--src/comp/middle/resolve.rs9
-rw-r--r--src/test/run-pass/type-param.rs5
3 files changed, 14 insertions, 1 deletions
diff --git a/src/Makefile b/src/Makefile
index c6809443..628b00cb 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -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 \
diff --git a/src/comp/middle/resolve.rs b/src/comp/middle/resolve.rs
index e0514ad8..a9e6802e 100644
--- a/src/comp/middle/resolve.rs
+++ b/src/comp/middle/resolve.rs
@@ -305,6 +305,14 @@ fn lookup_name_wrapped(&env e, ast.ident i) -> option.t[tup(@env, 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
index 00000000..9525190d
--- /dev/null
+++ b/src/test/run-pass/type-param.rs
@@ -0,0 +1,5 @@
+type lteq[T] = fn(&T a) -> bool;
+
+fn main(vec[str] args) {
+
+}