File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import (
18
18
"go/types"
19
19
"io"
20
20
"sort"
21
+ "strings"
21
22
22
23
"golang.org/x/tools/internal/typeparams"
23
24
)
@@ -405,12 +406,21 @@ func (r *importReader) obj(name string) {
405
406
if r .p .exportVersion < iexportVersionGenerics {
406
407
errorf ("unexpected type param type" )
407
408
}
408
- name0 , sub := parseSubscript (name )
409
+ // Temporarily strip both type parameter subscripts and path prefixes,
410
+ // while we replace subscripts with prefixes in the compiler.
411
+ // TODO(rfindley): remove support for subscripts once the compiler changes
412
+ // have landed.
413
+ name0 , _ := parseSubscript (name )
414
+ ix := strings .LastIndex (name , "." )
415
+ name0 = name0 [ix + 1 :]
409
416
tn := types .NewTypeName (pos , r .currPkg , name0 , nil )
410
417
t := typeparams .NewTypeParam (tn , nil )
411
- if sub == 0 {
412
- errorf ("name %q missing subscript" , name )
413
- }
418
+
419
+ // The check below is disabled so that we can support both path-prefixed
420
+ // and subscripted type parameter names.
421
+ // if sub == 0 {
422
+ // errorf("name %q missing subscript", name)
423
+ // }
414
424
415
425
// TODO(rfindley): can we use a different, stable ID?
416
426
// t.SetId(sub)
You can’t perform that action at this time.
0 commit comments