diff options
author | Russ Cox <rsc@golang.org> | 2009-05-07 13:42:47 -0700 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2009-05-07 13:42:47 -0700 |
commit | 8be34efb0628abc47c2a05969c2795df544fd873 (patch) | |
tree | 6b3287784cef6b9ee63ca440a069dfecdbd4971b /src/cmd/gc/subr.c | |
parent | c836acdeb6033fe96fa7c2fe6e290817a2256c26 (diff) | |
download | golang-8be34efb0628abc47c2a05969c2795df544fd873.tar.gz |
if a struct s contains an anonymous interface value
with method m, s.m() is ok and m now shows up
in s's method set for interface runtime.
see http://cl/28419-p2 for new test interface10.go.
R=ken
OCL=28420
CL=28423
Diffstat (limited to 'src/cmd/gc/subr.c')
-rw-r--r-- | src/cmd/gc/subr.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/cmd/gc/subr.c b/src/cmd/gc/subr.c index 65bf8543f..7972c41d8 100644 --- a/src/cmd/gc/subr.c +++ b/src/cmd/gc/subr.c @@ -2568,6 +2568,22 @@ expand0(Type *t, int followptr) u = u->type; } + if(u->etype == TINTER) { + for(f=u->type; f!=T; f=f->down) { + if(!exportname(f->sym->name) && strcmp(f->sym->opackage, package) != 0) + continue; + if(f->sym->uniq) + continue; + f->sym->uniq = 1; + sl = mal(sizeof(*sl)); + sl->field = f; + sl->link = slist; + sl->followptr = followptr; + slist = sl; + } + return; + } + u = methtype(t); if(u != T) { for(f=u->method; f!=T; f=f->down) { @@ -2858,7 +2874,7 @@ ifaceokT2I(Type *t0, Type *iface, Type **m) // if pointer receiver in method, // the method does not exist for value types. rcvr = getthisx(tm->type)->type->type; - if(isptr[rcvr->etype] && !isptr[t0->etype] && !followptr) { + if(isptr[rcvr->etype] && !isptr[t0->etype] && !followptr && !isifacemethod(tm)) { if(debug['r']) yyerror("interface pointer mismatch"); *m = im; |