Skip to content

Commit 8d7765b

Browse files
committed
Resolve bounds in iface types
Closes #2311
1 parent f90228b commit 8d7765b

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

src/librustsyntax/visit.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ fn visit_item<E>(i: @item, e: E, v: vt<E>) {
160160
v.visit_ty_params(tps, e, v);
161161
for methods.each {|m|
162162
for m.decl.inputs.each {|a| v.visit_ty(a.ty, e, v); }
163+
v.visit_ty_params(m.tps, e, v);
163164
v.visit_ty(m.decl.output, e, v);
164165
}
165166
}

src/rustc/middle/resolve.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ fn visit_item_with_scope(e: @env, i: @ast::item,
549549
let sc = @cons(scope_item(i), sc);
550550
alt i.node {
551551
ast::item_impl(tps, _, ifce, sty, methods) {
552-
visit::visit_ty_params(tps, sc, v);
552+
v.visit_ty_params(tps, sc, v);
553553
option::iter(ifce) {|p| visit::visit_path(p.path, sc, v)};
554554
v.visit_ty(sty, sc, v);
555555
for methods.each {|m|
@@ -560,15 +560,17 @@ fn visit_item_with_scope(e: @env, i: @ast::item,
560560
}
561561
}
562562
ast::item_iface(tps, _, methods) {
563-
visit::visit_ty_params(tps, sc, v);
563+
v.visit_ty_params(tps, sc, v);
564+
let isc = @cons(scope_method(i.id, tps), sc);
564565
for methods.each {|m|
566+
v.visit_ty_params(m.tps, isc, v);
565567
let msc = @cons(scope_method(i.id, tps + m.tps), sc);
566568
for m.decl.inputs.each {|a| v.visit_ty(a.ty, msc, v); }
567569
v.visit_ty(m.decl.output, msc, v);
568570
}
569571
}
570572
ast::item_class(tps, ifaces, members, ctor, m_dtor, _) {
571-
visit::visit_ty_params(tps, sc, v);
573+
v.visit_ty_params(tps, sc, v);
572574
// Can maybe skip this now that we require self on class fields
573575
let class_scope = @cons(scope_item(i), sc);
574576
/* visit the constructor... */

src/test/run-pass/issue-2311.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
iface clam<A> { }
2+
iface foo<A> {
3+
fn bar<B,C:clam<A>>(c: C) -> B;
4+
}
5+
6+
fn main() { }

0 commit comments

Comments
 (0)