_ = reflect.New(typ)
t.Errorf("reflect.New(%v) should have panicked", typ)
}
+
+// issue 52542
+
+func func52542[T ~[]C.int]() {}
+
+type type52542[T ~*C.float] struct{}
case *ast.StructType:
f.walk(n.Fields, ctxField, visit)
case *ast.FuncType:
+ if tparams := funcTypeTypeParams(n); tparams != nil {
+ f.walk(tparams, ctxParam, visit)
+ }
f.walk(n.Params, ctxParam, visit)
if n.Results != nil {
f.walk(n.Results, ctxParam, visit)
f.walk(n.Values, ctxExpr, visit)
}
case *ast.TypeSpec:
+ if tparams := typeSpecTypeParams(n); tparams != nil {
+ f.walk(tparams, ctxParam, visit)
+ }
f.walk(&n.Type, ctxType, visit)
case *ast.BadDecl:
package main
import (
+ "go/ast"
"go/token"
)
error_(token.NoPos, "unexpected type %T in walk", x)
panic("unexpected type")
}
+
+func funcTypeTypeParams(n *ast.FuncType) *ast.FieldList {
+ return nil
+}
+
+func typeSpecTypeParams(n *ast.TypeSpec) *ast.FieldList {
+ return nil
+}
f.walk(n.Indices, ctxExpr, visit)
}
}
+
+func funcTypeTypeParams(n *ast.FuncType) *ast.FieldList {
+ return n.TypeParams
+}
+
+func typeSpecTypeParams(n *ast.TypeSpec) *ast.FieldList {
+ return n.TypeParams
+}