Default methods with self-calls make it as far as trans.
This commit is contained in:
parent
3a5c7f52cc
commit
280dfd2d29
2 changed files with 21 additions and 3 deletions
|
@ -140,6 +140,26 @@ struct lookup {
|
|||
ty::ty_class(did, substs) => {
|
||||
self.add_candidates_from_class(did, substs);
|
||||
}
|
||||
ty::ty_self => {
|
||||
// Call is of the form "self.foo()" and appears in one
|
||||
// of a trait's provided methods.
|
||||
let self_def_id = match self.fcx.self_info {
|
||||
some(self_info) => self_info.def_id,
|
||||
none => {
|
||||
// Shouldn't happen; there should always be a
|
||||
// self_info in this case.
|
||||
self.tcx().sess.bug(~"unexpected `none` for self_info")
|
||||
}
|
||||
};
|
||||
|
||||
let substs = {
|
||||
self_r: none,
|
||||
self_ty: none,
|
||||
tps: ~[],
|
||||
};
|
||||
|
||||
self.add_candidates_from_trait(self_def_id, substs);
|
||||
}
|
||||
_ => ()
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
//xfail-test
|
||||
|
||||
// Right now, this fails with "attempted access of field `purr` on
|
||||
// type `self`, but no public field or method with that name was
|
||||
// found".
|
||||
// Currently failing with an ICE in trans.
|
||||
|
||||
trait Cat {
|
||||
fn meow() -> bool;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue