mirror of https://github.com/golang/go.git
[dev.typeparams] cmd/compile/internal/types2: fix a panic in missingMethod
When static == false, missingMethod incorrectly continues with a nil Func. Also remove some unnecessary type names from typeterm_test.go, which was done in the go/types port. Change-Id: I21fa637ac82b115563d3601314a470a5a43f9ae0 Reviewed-on: https://go-review.googlesource.com/c/go/+/339672 Trust: Robert Findley <rfindley@google.com> Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Findley <rfindley@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
parent
5b51cf47dc
commit
880ab6209e
|
|
@ -308,7 +308,10 @@ func (check *Checker) missingMethod(V Type, T *Interface, static bool) (method,
|
||||||
for _, m := range T.typeSet().methods {
|
for _, m := range T.typeSet().methods {
|
||||||
_, f := ityp.typeSet().LookupMethod(m.pkg, m.name)
|
_, f := ityp.typeSet().LookupMethod(m.pkg, m.name)
|
||||||
|
|
||||||
if f == nil && static {
|
if f == nil {
|
||||||
|
if !static {
|
||||||
|
continue
|
||||||
|
}
|
||||||
return m, f
|
return m, f
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,11 +11,11 @@ import (
|
||||||
|
|
||||||
var testTerms = map[string]*term{
|
var testTerms = map[string]*term{
|
||||||
"∅": nil,
|
"∅": nil,
|
||||||
"⊤": &term{},
|
"⊤": {},
|
||||||
"int": &term{false, Typ[Int]},
|
"int": {false, Typ[Int]},
|
||||||
"~int": &term{true, Typ[Int]},
|
"~int": {true, Typ[Int]},
|
||||||
"string": &term{false, Typ[String]},
|
"string": {false, Typ[String]},
|
||||||
"~string": &term{true, Typ[String]},
|
"~string": {true, Typ[String]},
|
||||||
// TODO(gri) add a defined type
|
// TODO(gri) add a defined type
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue