gc: 0 expected bugs

Now that Luuk's qualified exporting code
is in, fixing this bug is trivial.

R=ken2
CC=golang-dev
https://golang.org/cl/5479048
This commit is contained in:
Russ Cox 2011-12-09 14:58:28 -05:00
parent 5912869d61
commit 1cb7f85d74
6 changed files with 29 additions and 26 deletions

View file

@ -1964,7 +1964,7 @@ lookdot0(Sym *s, Type *t, Type **save, int ignorecase)
return c; return c;
} }
// search depth d -- // search depth d for field/method s --
// return count of fields+methods // return count of fields+methods
// found at search depth. // found at search depth.
// answer is in dotlist array and // answer is in dotlist array and
@ -2087,8 +2087,6 @@ expand0(Type *t, int followptr)
if(u->etype == TINTER) { if(u->etype == TINTER) {
for(f=u->type; f!=T; f=f->down) { for(f=u->type; f!=T; f=f->down) {
if(!exportname(f->sym->name) && f->sym->pkg != localpkg)
continue;
if(f->sym->flags & SymUniq) if(f->sym->flags & SymUniq)
continue; continue;
f->sym->flags |= SymUniq; f->sym->flags |= SymUniq;
@ -2104,8 +2102,6 @@ expand0(Type *t, int followptr)
u = methtype(t); u = methtype(t);
if(u != T) { if(u != T) {
for(f=u->method; f!=T; f=f->down) { for(f=u->method; f!=T; f=f->down) {
if(!exportname(f->sym->name) && f->sym->pkg != localpkg)
continue;
if(f->sym->flags & SymUniq) if(f->sym->flags & SymUniq)
continue; continue;
f->sym->flags |= SymUniq; f->sym->flags |= SymUniq;

View file

@ -1,12 +0,0 @@
package main
import (
"./p"
)
type T struct{ *p.S }
func main() {
var t T
p.F(t)
}

View file

@ -0,0 +1,24 @@
package main
import (
"./p"
)
type T struct{ *p.S }
type I interface {
get()
}
func main() {
var t T
p.F(t)
var x interface{} = t
_, ok := x.(I)
if ok {
panic("should not satisfy main.I")
}
_, ok = x.(p.I)
if !ok {
panic("should satisfy p.I")
}
}

View file

@ -3,14 +3,13 @@ package p
type T struct{ x int } type T struct{ x int }
type S struct{} type S struct{}
func (p *S) get() T { func (p *S) get() {
return T{0}
} }
type I interface { type I interface {
get() T get()
} }
func F(i I) { func F(i I) {
_ = i.get() i.get()
} }

View file

@ -4,4 +4,4 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
ignored package ignored

View file

@ -119,7 +119,3 @@ broke
0x0 0x0
== bugs/ == bugs/
=========== bugs/bug367.go
panic: interface conversion: main.T is not p.I: missing method get
BUG: should not fail