mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
gc: eliminate duplicates in method table
Fixes #906. R=ken2 CC=golang-dev https://golang.org/cl/2279042
This commit is contained in:
parent
7e92e1cbfa
commit
2d5e732c54
2 changed files with 28 additions and 1 deletions
|
|
@ -1287,3 +1287,23 @@ func TestDotDotDot(t *testing.T) {
|
|||
}
|
||||
t.Error(s)
|
||||
}
|
||||
|
||||
type inner struct{}
|
||||
|
||||
type outer struct {
|
||||
inner
|
||||
}
|
||||
|
||||
func (*inner) m() {}
|
||||
func (*outer) m() {}
|
||||
|
||||
func TestNestedMethods(t *testing.T) {
|
||||
typ := Typeof((*outer)(nil))
|
||||
if typ.NumMethod() != 1 || typ.Method(0).Func.Get() != NewValue((*outer).m).(*FuncValue).Get() {
|
||||
t.Errorf("Wrong method table for outer: (m=%p)", (*outer).m)
|
||||
for i := 0; i < typ.NumMethod(); i++ {
|
||||
m := typ.Method(i)
|
||||
t.Errorf("\t%d: %s %#x\n", i, m.Name, m.Func.Get())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue