Skip to content

Commit afbc242

Browse files
committed
auto merge of #9527 : bmaxa/rust/master, r=alexcrichton
that is, if super trait had more methods, tnen subtrait, compiling would fail. I simply forgot to update variable name. Updated test case , too.
2 parents d6774f8 + a4b7474 commit afbc242

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/librustc/middle/typeck/check/method.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -431,10 +431,10 @@ impl<'self> LookupContext<'self> {
431431

432432
Candidate {
433433
rcvr_match_condition: RcvrMatchesIfObject(did),
434-
rcvr_substs: trait_ref.substs.clone(),
434+
rcvr_substs: new_trait_ref.substs.clone(),
435435
method_ty: m,
436436
origin: method_object(method_object {
437-
trait_id: trait_ref.def_id,
437+
trait_id: new_trait_ref.def_id,
438438
object_trait_id: did,
439439
method_num: method_num,
440440
real_index: vtable_index

src/test/run-pass/issue-9394-inherited-trait-calls.rs

+9
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010

1111
trait Base: Base2 + Base3{
1212
fn foo(&self) -> ~str;
13+
fn foo1(&self) -> ~str;
14+
fn foo2(&self) -> ~str{
15+
~"base foo2"
16+
}
1317
}
1418

1519
trait Base2: Base3{
@@ -30,6 +34,9 @@ impl Base for X {
3034
fn foo(&self) -> ~str{
3135
~"base foo"
3236
}
37+
fn foo1(&self) -> ~str{
38+
~"base foo1"
39+
}
3340

3441
}
3542

@@ -56,6 +63,8 @@ pub fn main() {
5663
let s = &n as &Super;
5764
assert_eq!(s.bar(),~"super bar");
5865
assert_eq!(s.foo(),~"base foo");
66+
assert_eq!(s.foo1(),~"base foo1");
67+
assert_eq!(s.foo2(),~"base foo2");
5968
assert_eq!(s.baz(),~"base2 baz");
6069
assert_eq!(s.root(),~"base3 root");
6170
}

0 commit comments

Comments
 (0)