go/types/objectpath: update objectpath tests for TypeString changes

Uncomment (and adjust) test cases that were broken due to type parameter
type/object strings.

Comment out a test case that uses comparable, while its type string is
being adjusted.

Change-Id: I79fa2081f4a8acfe1bf23da61289272bde8ad034
Reviewed-on: https://go-review.googlesource.com/c/tools/+/380999
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Robert Findley 2022-01-26 16:25:27 -05:00
parent 135791db47
commit be5769ca0a
1 changed files with 9 additions and 9 deletions

View File

@ -38,16 +38,15 @@ func F[FP0, FP1 any](FP0, FP1) {}
`},
}
paths := []pathTest{
// TODO: uncomment tests once type parameter strings have been adjusted.
// Good paths
// {"b", "T", "type b.T[b.TP0 interface{}, b.TP1 interface{M0(); M1()}] struct{}", ""},
// {"b", "T.O", "type b.T[b.TP0 interface{}, b.TP1 interface{M0(); M1()}] struct{}", ""},
// {"b", "T.M0", "func (b.T[b.RP0, b.RP1]).M()", ""},
// {"b", "T.T0O", "type TP0 b.TP0", ""},
// {"b", "T.T1O", "type TP1 b.TP1", ""},
{"b", "T", "type b.T[TP0 any, TP1 interface{M0(); M1()}] struct{}", ""},
{"b", "T.O", "type b.T[TP0 any, TP1 interface{M0(); M1()}] struct{}", ""},
{"b", "T.M0", "func (b.T[RP0, RP1]).M()", ""},
{"b", "T.T0O", "type parameter TP0 any", ""},
{"b", "T.T1O", "type parameter TP1 interface{M0(); M1()}", ""},
{"b", "T.T1CM0", "func (interface).M0()", ""},
// Obj of an instance is the generic declaration.
// {"b", "A.O", "type b.T[b.TP0 interface{}, b.TP1 interface{M0(); M1()}] struct{}", ""},
{"b", "A.O", "type b.T[TP0 any, TP1 interface{M0(); M1()}] struct{}", ""},
{"b", "A.M0", "func (b.T[int, b.N]).M()", ""},
// Bad paths
@ -56,7 +55,7 @@ func F[FP0, FP1 any](FP0, FP1) {}
{"b", "N.T", "", `invalid path: bad numeric operand "" for code 'T'`},
{"b", "N.T0", "", "tuple index 0 out of range [0-0)"},
{"b", "T.T2O", "", "tuple index 2 out of range [0-2)"},
// {"b", "T.T1M0", "", "cannot apply 'M' to b.TP1 (got *types.TypeParam, want interface or named)"},
{"b", "T.T1M0", "", "cannot apply 'M' to TP1 (got *types.TypeParam, want interface or named)"},
{"b", "C.T0", "", "cannot apply 'T' to int (got *types.Basic, want named or signature)"},
}
@ -79,7 +78,8 @@ func F[FP0, FP1 any](FP0, FP1) {}
wantErr string
}{
{types.Universe.Lookup("any"), "predeclared type any = interface{} has no path"},
{types.Universe.Lookup("comparable"), "predeclared type comparable interface{} has no path"},
// TODO: uncomment once the type string of comparable has been updated.
// {types.Universe.Lookup("comparable"), "predeclared type comparable interface{} has no path"},
} {
path, err := objectpath.For(test.obj)
if err == nil {