mirror of
https://github.com/golang/go
synced 2024-11-14 22:40:40 -07:00
go/types, types2: remove need for Scope.LookupParent from TestObjectString
Updates #69673. Change-Id: I0ce5f009c1e95a2722a50d79a74fef83d2547b47 Reviewed-on: https://go-review.googlesource.com/c/go/+/616260 Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Alan Donovan <adonovan@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
80316510d3
commit
99bf122de8
@ -129,10 +129,15 @@ func TestObjectString(t *testing.T) {
|
||||
if len(names) != 1 && len(names) != 2 {
|
||||
t.Fatalf("%s: invalid object path %s", test.src, test.obj)
|
||||
}
|
||||
_, obj := pkg.Scope().LookupParent(names[0], nopos)
|
||||
|
||||
var obj Object
|
||||
for s := pkg.Scope(); s != nil && obj == nil; s = s.Parent() {
|
||||
obj = s.Lookup(names[0])
|
||||
}
|
||||
if obj == nil {
|
||||
t.Fatalf("%s: %s not found", test.src, names[0])
|
||||
}
|
||||
|
||||
if len(names) == 2 {
|
||||
if typ, ok := obj.Type().(interface{ TypeParams() *TypeParamList }); ok {
|
||||
obj = lookupTypeParamObj(typ.TypeParams(), names[1])
|
||||
|
@ -130,10 +130,15 @@ func TestObjectString(t *testing.T) {
|
||||
if len(names) != 1 && len(names) != 2 {
|
||||
t.Fatalf("%s: invalid object path %s", test.src, test.obj)
|
||||
}
|
||||
_, obj := pkg.Scope().LookupParent(names[0], nopos)
|
||||
|
||||
var obj Object
|
||||
for s := pkg.Scope(); s != nil && obj == nil; s = s.Parent() {
|
||||
obj = s.Lookup(names[0])
|
||||
}
|
||||
if obj == nil {
|
||||
t.Fatalf("%s: %s not found", test.src, names[0])
|
||||
}
|
||||
|
||||
if len(names) == 2 {
|
||||
if typ, ok := obj.Type().(interface{ TypeParams() *TypeParamList }); ok {
|
||||
obj = lookupTypeParamObj(typ.TypeParams(), names[1])
|
||||
|
Loading…
Reference in New Issue
Block a user