]> Cypherpunks repositories - gostls13.git/commitdiff
go/types, types2: rename structuralType/String to coreType/String
authorRobert Griesemer <gri@golang.org>
Wed, 9 Feb 2022 22:16:05 +0000 (14:16 -0800)
committerRobert Griesemer <gri@golang.org>
Wed, 9 Feb 2022 22:58:35 +0000 (22:58 +0000)
This is a pure rename of the respective Go functions/methods
with corresponding adjustments to error messages and tests.
A couple of comments were manually rephrased.

With this change, the implementation and error messages match
the latest spec.

No functionality change.

Change-Id: Iaa92a08b64756356fb2c5abdaca5c943c9105c96
Reviewed-on: https://go-review.googlesource.com/c/go/+/384618
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
39 files changed:
src/cmd/compile/internal/noder/expr.go
src/cmd/compile/internal/noder/writer.go
src/cmd/compile/internal/types2/builtins.go
src/cmd/compile/internal/types2/call.go
src/cmd/compile/internal/types2/compilersupport.go
src/cmd/compile/internal/types2/expr.go
src/cmd/compile/internal/types2/index.go
src/cmd/compile/internal/types2/infer.go
src/cmd/compile/internal/types2/lookup.go
src/cmd/compile/internal/types2/predicates.go
src/cmd/compile/internal/types2/stmt.go
src/cmd/compile/internal/types2/testdata/check/builtins.go2
src/cmd/compile/internal/types2/testdata/check/typeparams.go2
src/cmd/compile/internal/types2/testdata/examples/inference.go2
src/cmd/compile/internal/types2/testdata/examples/types.go2
src/cmd/compile/internal/types2/testdata/fixedbugs/issue43671.go2
src/cmd/compile/internal/types2/testdata/fixedbugs/issue47115.go2
src/cmd/compile/internal/types2/testdata/fixedbugs/issue49735.go2
src/cmd/compile/internal/types2/testdata/fixedbugs/issue50417.go2
src/cmd/compile/internal/types2/type.go
src/go/types/builtins.go
src/go/types/call.go
src/go/types/expr.go
src/go/types/index.go
src/go/types/infer.go
src/go/types/lookup.go
src/go/types/predicates.go
src/go/types/stmt.go
src/go/types/testdata/check/builtins.go2
src/go/types/testdata/check/typeparams.go2
src/go/types/testdata/examples/inference.go2
src/go/types/testdata/examples/types.go2
src/go/types/testdata/fixedbugs/issue43671.go2
src/go/types/testdata/fixedbugs/issue47115.go2
src/go/types/testdata/fixedbugs/issue49735.go2
src/go/types/testdata/fixedbugs/issue50417.go2
src/go/types/type.go
test/typeparam/issue50417.go
test/typeparam/typelist.go

index 8a9afeb0959c533880a25c91b1cd0448d3186eb8..a4e144554c6e2b5e4ca25fcf1f95f37e82f203da 100644 (file)
@@ -332,13 +332,13 @@ func (g *irgen) exprs(exprs []syntax.Expr) []ir.Node {
 }
 
 func (g *irgen) compLit(typ types2.Type, lit *syntax.CompositeLit) ir.Node {
-       if ptr, ok := types2.StructuralType(typ).(*types2.Pointer); ok {
+       if ptr, ok := types2.CoreType(typ).(*types2.Pointer); ok {
                n := ir.NewAddrExpr(g.pos(lit), g.compLit(ptr.Elem(), lit))
                n.SetOp(ir.OPTRLIT)
                return typed(g.typ(typ), n)
        }
 
-       _, isStruct := types2.StructuralType(typ).(*types2.Struct)
+       _, isStruct := types2.CoreType(typ).(*types2.Struct)
 
        exprs := make([]ir.Node, len(lit.ElemList))
        for i, elem := range lit.ElemList {
index 933f5778253a914a4f3552d234abc8d35ade8168..46e833912057d158cdbf899a19abff96db95e62e 100644 (file)
@@ -1338,10 +1338,10 @@ func (w *writer) compLit(lit *syntax.CompositeLit) {
        w.typ(tv.Type)
 
        typ := tv.Type
-       if ptr, ok := types2.StructuralType(typ).(*types2.Pointer); ok {
+       if ptr, ok := types2.CoreType(typ).(*types2.Pointer); ok {
                typ = ptr.Elem()
        }
-       str, isStruct := types2.StructuralType(typ).(*types2.Struct)
+       str, isStruct := types2.CoreType(typ).(*types2.Struct)
 
        w.len(len(lit.ElemList))
        for i, elem := range lit.ElemList {
index 4b122bc54077ef6b618cad8bc90c0384d5fe40d2..428897c62828482f6c05442950351f72c4efde5f 100644 (file)
@@ -82,7 +82,7 @@ func (check *Checker) builtin(x *operand, call *syntax.CallExpr, id builtinId) (
                // of S and the respective parameter passing rules apply."
                S := x.typ
                var T Type
-               if s, _ := structuralType(S).(*Slice); s != nil {
+               if s, _ := coreType(S).(*Slice); s != nil {
                        T = s.elem
                } else {
                        var cause string
@@ -90,10 +90,10 @@ func (check *Checker) builtin(x *operand, call *syntax.CallExpr, id builtinId) (
                        case x.isNil():
                                cause = "have untyped nil"
                        case isTypeParam(S):
-                               if u := structuralType(S); u != nil {
-                                       cause = check.sprintf("%s has structural type %s", x, u)
+                               if u := coreType(S); u != nil {
+                                       cause = check.sprintf("%s has core type %s", x, u)
                                } else {
-                                       cause = check.sprintf("%s has no structural type", x)
+                                       cause = check.sprintf("%s has no core type", x)
                                }
                        default:
                                cause = check.sprintf("have %s", x)
@@ -115,7 +115,7 @@ func (check *Checker) builtin(x *operand, call *syntax.CallExpr, id builtinId) (
                                if x.mode == invalid {
                                        return
                                }
-                               if t := structuralString(x.typ); t != nil && isString(t) {
+                               if t := coreString(x.typ); t != nil && isString(t) {
                                        if check.Types != nil {
                                                sig := makeSig(S, S, x.typ)
                                                sig.variadic = true
@@ -345,14 +345,14 @@ func (check *Checker) builtin(x *operand, call *syntax.CallExpr, id builtinId) (
 
        case _Copy:
                // copy(x, y []T) int
-               dst, _ := structuralType(x.typ).(*Slice)
+               dst, _ := coreType(x.typ).(*Slice)
 
                var y operand
                arg(&y, 1)
                if y.mode == invalid {
                        return
                }
-               src0 := structuralString(y.typ)
+               src0 := coreString(y.typ)
                if src0 != nil && isString(src0) {
                        src0 = NewSlice(universeByte)
                }
@@ -486,13 +486,13 @@ func (check *Checker) builtin(x *operand, call *syntax.CallExpr, id builtinId) (
                }
 
                var min int // minimum number of arguments
-               switch structuralType(T).(type) {
+               switch coreType(T).(type) {
                case *Slice:
                        min = 2
                case *Map, *Chan:
                        min = 1
                case nil:
-                       check.errorf(arg0, invalidArg+"cannot make %s: no structural type", arg0)
+                       check.errorf(arg0, invalidArg+"cannot make %s: no core type", arg0)
                        return
                default:
                        check.errorf(arg0, invalidArg+"cannot make %s; type must be slice, map, or channel", arg0)
index 15a42ca3dc865f1064de314e36cf8046b5670fcd..22f65ed626692689761628677c8bd1d1ffe61e39 100644 (file)
@@ -168,7 +168,7 @@ func (check *Checker) callExpr(x *operand, call *syntax.CallExpr) exprKind {
        cgocall := x.mode == cgofunc
 
        // a type parameter may be "called" if all types have the same signature
-       sig, _ := structuralType(x.typ).(*Signature)
+       sig, _ := coreType(x.typ).(*Signature)
        if sig == nil {
                check.errorf(x, invalidOp+"cannot call non-function %s", x)
                x.mode = invalid
index b35e752b8f7ce51f0e6af8af5b51ede6a81180fe..33dd8e8baace43271c656efcdcd2db74dd89b4d8 100644 (file)
@@ -19,12 +19,12 @@ func AsSignature(t Type) *Signature {
        return u
 }
 
-// If typ is a type parameter, structuralType returns the single underlying
+// If typ is a type parameter, CoreType returns the single underlying
 // type of all types in the corresponding type constraint if it exists, or
 // nil otherwise. If the type set contains only unrestricted and restricted
 // channel types (with identical element types), the single underlying type
 // is the restricted channel type if the restrictions are always the same.
-// If typ is not a type parameter, structuralType returns the underlying type.
-func StructuralType(t Type) Type {
-       return structuralType(t)
+// If typ is not a type parameter, CoreType returns the underlying type.
+func CoreType(t Type) Type {
+       return coreType(t)
 }
index 4fdabe754e472452ebab63a58ea9267a0fff9218..02ece21e675554cdc2cf1c63071bc17b8c1dce77 100644 (file)
@@ -182,9 +182,9 @@ func (check *Checker) unary(x *operand, e *syntax.Operation) {
                return
 
        case syntax.Recv:
-               u := structuralType(x.typ)
+               u := coreType(x.typ)
                if u == nil {
-                       check.errorf(x, invalidOp+"cannot receive from %s: no structural type", x)
+                       check.errorf(x, invalidOp+"cannot receive from %s: no core type", x)
                        x.mode = invalid
                        return
                }
@@ -1359,7 +1359,7 @@ func (check *Checker) exprInternal(x *operand, e syntax.Expr, hint Type) exprKin
                case hint != nil:
                        // no composite literal type present - use hint (element type of enclosing type)
                        typ = hint
-                       base, _ = deref(structuralType(typ)) // *T implies &T{}
+                       base, _ = deref(coreType(typ)) // *T implies &T{}
 
                default:
                        // TODO(gri) provide better error messages depending on context
@@ -1367,7 +1367,7 @@ func (check *Checker) exprInternal(x *operand, e syntax.Expr, hint Type) exprKin
                        goto Error
                }
 
-               switch utyp := structuralType(base).(type) {
+               switch utyp := coreType(base).(type) {
                case *Struct:
                        // Prevent crash if the struct referred to is not yet set up.
                        // See analogous comment for *Array.
index 4995d2d730329cd4673de385ce3a5f28733c62e6..1eaddded9a6cc92da51452805f351f0fd9af527c 100644 (file)
@@ -213,9 +213,9 @@ func (check *Checker) sliceExpr(x *operand, e *syntax.SliceExpr) {
 
        valid := false
        length := int64(-1) // valid if >= 0
-       switch u := structuralString(x.typ).(type) {
+       switch u := coreString(x.typ).(type) {
        case nil:
-               check.errorf(x, invalidOp+"cannot slice %s: %s has no structural type", x, x.typ)
+               check.errorf(x, invalidOp+"cannot slice %s: %s has no core type", x, x.typ)
                x.mode = invalid
                return
 
index 51b26eb2aa25b5c12a656d7b1160c01ea73a38b1..564e91e60adc5b77a0d0975304194fae8c6b7c38 100644 (file)
@@ -416,11 +416,11 @@ func (check *Checker) inferB(pos syntax.Pos, tparams []*TypeParam, targs []Type)
                }
        }
 
-       // If a constraint has a structural type, unify the corresponding type parameter with it.
+       // If a constraint has a core type, unify the corresponding type parameter with it.
        for _, tpar := range tparams {
-               sbound := structuralType(tpar)
+               sbound := coreType(tpar)
                if sbound != nil {
-                       // If the structural type is the underlying type of a single
+                       // If the core type is the underlying type of a single
                        // defined type in the constraint, use that defined type instead.
                        if named, _ := tpar.singleType().(*Named); named != nil {
                                sbound = named
@@ -435,7 +435,7 @@ func (check *Checker) inferB(pos syntax.Pos, tparams []*TypeParam, targs []Type)
        }
 
        // u.x.types() now contains the incoming type arguments plus any additional type
-       // arguments which were inferred from structural types. The newly inferred non-
+       // arguments which were inferred from core types. The newly inferred non-
        // nil entries may still contain references to other type parameters.
        // For instance, for [A any, B interface{ []C }, C interface{ *A }], if A == int
        // was given, unification produced the type list [int, []C, *A]. We eliminate the
@@ -504,8 +504,8 @@ func (check *Checker) inferB(pos syntax.Pos, tparams []*TypeParam, targs []Type)
        }
 
        // Once nothing changes anymore, we may still have type parameters left;
-       // e.g., a structural constraint *P may match a type parameter Q but we
-       // don't have any type arguments to fill in for *P or Q (issue #45548).
+       // e.g., a constraint with core type *P may match a type parameter Q but
+       // we don't have any type arguments to fill in for *P or Q (issue #45548).
        // Don't let such inferences escape, instead nil them out.
        for i, typ := range types {
                if typ != nil && isParameterized(tparams, typ) {
index 9987da485463e70e7fc3579702696a851f3ebf66..0a2d2a579026a834ff770eefe9ac1fd2f8312d4a 100644 (file)
@@ -66,12 +66,12 @@ func LookupFieldOrMethod(T Type, addressable bool, pkg *Package, name string) (o
 
        obj, index, indirect = lookupFieldOrMethod(T, addressable, pkg, name, false)
 
-       // If we didn't find anything and if we have a type parameter with a structural constraint,
-       // see if there is a matching field (but not a method, those need to be declared explicitly
-       // in the constraint). If the structural constraint is a named pointer type (see above), we
-       // are ok here because only fields are accepted as results.
+       // If we didn't find anything and if we have a type parameter with a core type,
+       // see if there is a matching field (but not a method, those need to be declared
+       // explicitly in the constraint). If the constraint is a named pointer type (see
+       // above), we are ok here because only fields are accepted as results.
        if obj == nil && isTypeParam(T) {
-               if t := structuralType(T); t != nil {
+               if t := coreType(T); t != nil {
                        obj, index, indirect = lookupFieldOrMethod(t, addressable, pkg, name, false)
                        if _, ok := obj.(*Var); !ok {
                                obj, index, indirect = nil, nil, false // accept fields (variables) only
index 279d0775bd540e22078b1e90865828ee0aab1b29..0e46333af7f76106f87146be28d7a340334910b3 100644 (file)
@@ -31,7 +31,7 @@ func isBasic(t Type, info BasicInfo) bool {
 // The allX predicates below report whether t is an X.
 // If t is a type parameter the result is true if isX is true
 // for all specified types of the type parameter's type set.
-// allX is an optimized version of isX(structuralType(t)) (which
+// allX is an optimized version of isX(coreType(t)) (which
 // is the same as underIs(t, isX)).
 
 func allBoolean(t Type) bool         { return allBasic(t, IsBoolean) }
@@ -45,7 +45,7 @@ func allNumericOrString(t Type) bool { return allBasic(t, IsNumeric|IsString) }
 // allBasic reports whether under(t) is a basic type with the specified info.
 // If t is a type parameter, the result is true if isBasic(t, info) is true
 // for all specific types of the type parameter's type set.
-// allBasic(t, info) is an optimized version of isBasic(structuralType(t), info).
+// allBasic(t, info) is an optimized version of isBasic(coreType(t), info).
 func allBasic(t Type, info BasicInfo) bool {
        if tpar, _ := t.(*TypeParam); tpar != nil {
                return tpar.is(func(t *term) bool { return t != nil && isBasic(t.typ, info) })
index 03da98af34fd6c9cfed4d4db6eeb579bf246fa96..836b95df8f059598881b47ea60d08f18ce470c9f 100644 (file)
@@ -409,9 +409,9 @@ func (check *Checker) stmt(ctxt stmtContext, s syntax.Stmt) {
                if ch.mode == invalid || val.mode == invalid {
                        return
                }
-               u := structuralType(ch.typ)
+               u := coreType(ch.typ)
                if u == nil {
-                       check.errorf(s, invalidOp+"cannot send to %s: no structural type", &ch)
+                       check.errorf(s, invalidOp+"cannot send to %s: no core type", &ch)
                        return
                }
                uch, _ := u.(*Chan)
@@ -835,9 +835,9 @@ func (check *Checker) rangeStmt(inner stmtContext, s *syntax.ForStmt, rclause *s
        // determine key/value types
        var key, val Type
        if x.mode != invalid {
-               // Ranging over a type parameter is permitted if it has a structural type.
+               // Ranging over a type parameter is permitted if it has a core type.
                var cause string
-               u := structuralType(x.typ)
+               u := coreType(x.typ)
                if t, _ := u.(*Chan); t != nil {
                        if sValue != nil {
                                check.softErrorf(sValue, "range over %s permits only one iteration variable", &x)
@@ -852,7 +852,7 @@ func (check *Checker) rangeStmt(inner stmtContext, s *syntax.ForStmt, rclause *s
                                // ok to continue
                        }
                        if u == nil {
-                               cause = check.sprintf("%s has no structural type", x.typ)
+                               cause = check.sprintf("%s has no core type", x.typ)
                        }
                }
                key, val = rangeKeyVal(u)
index 48a39891bf85874821e6b77fc24504b8a9c6d9ff..7c3f0c96addb3d16c999a07d02ed6ed7a8a7175b 100644 (file)
@@ -148,7 +148,7 @@ func _[
        _ = make /* ERROR expects 2 or 3 arguments */ (S1)
        _ = make(S1, 10, 20)
        _ = make /* ERROR expects 2 or 3 arguments */ (S1, 10, 20, 30)
-       _ = make(S2 /* ERROR cannot make S2: no structural type */ , 10)
+       _ = make(S2 /* ERROR cannot make S2: no core type */ , 10)
 
        type M0 map[string]int
        _ = make(map[string]int)
@@ -156,7 +156,7 @@ func _[
        _ = make(M1)
        _ = make(M1, 10)
        _ = make/* ERROR expects 1 or 2 arguments */(M1, 10, 20)
-       _ = make(M2 /* ERROR cannot make M2: no structural type */ )
+       _ = make(M2 /* ERROR cannot make M2: no core type */ )
 
        type C0 chan int
        _ = make(chan int)
@@ -164,7 +164,7 @@ func _[
        _ = make(C1)
        _ = make(C1, 10)
        _ = make/* ERROR expects 1 or 2 arguments */(C1, 10, 20)
-       _ = make(C2 /* ERROR cannot make C2: no structural type */ )
+       _ = make(C2 /* ERROR cannot make C2: no core type */ )
        _ = make(C3)
 }
 
index ef582415199e0561b6d4d670481908ce3bbad2f0..68b1f0f5c5af387cea4ec05f89d2d34652965c8e 100644 (file)
@@ -134,11 +134,11 @@ func _[T interface{ ~string }] (x T, i, j, k int) { var _ T = x[i:j:k /* ERROR 3
 type myByte1 []byte
 type myByte2 []byte
 func _[T interface{ []byte | myByte1 | myByte2 }] (x T, i, j, k int) { var _ T = x[i:j:k] }
-func _[T interface{ []byte | myByte1 | []int }] (x T, i, j, k int) { var _ T = x[ /* ERROR no structural type */ i:j:k] }
+func _[T interface{ []byte | myByte1 | []int }] (x T, i, j, k int) { var _ T = x[ /* ERROR no core type */ i:j:k] }
 
 func _[T interface{ []byte | myByte1 | myByte2 | string }] (x T, i, j, k int) { var _ T = x[i:j] }
 func _[T interface{ []byte | myByte1 | myByte2 | string }] (x T, i, j, k int) { var _ T = x[i:j:k /* ERROR 3-index slice of string */ ] }
-func _[T interface{ []byte | myByte1 | []int | string }] (x T, i, j, k int) { var _ T = x[ /* ERROR no structural type */ i:j] }
+func _[T interface{ []byte | myByte1 | []int | string }] (x T, i, j, k int) { var _ T = x[ /* ERROR no core type */ i:j] }
 
 // len/cap built-ins
 
@@ -230,7 +230,7 @@ func _[
         for _, _ = range s1 {}
 
         var s2 S2
-        for range s2 /* ERROR cannot range over s2.*no structural type */ {}
+        for range s2 /* ERROR cannot range over s2.*no core type */ {}
 
         var a0 []int
         for range a0 {}
@@ -243,7 +243,7 @@ func _[
         for _, _ = range a1 {}
 
         var a2 A2
-        for range a2 /* ERROR cannot range over a2.*no structural type */ {}
+        for range a2 /* ERROR cannot range over a2.*no core type */ {}
 
         var p0 *[10]int
         for range p0 {}
@@ -256,7 +256,7 @@ func _[
         for _, _ = range p1 {}
 
         var p2 P2
-        for range p2 /* ERROR cannot range over p2.*no structural type */ {}
+        for range p2 /* ERROR cannot range over p2.*no core type */ {}
 
         var m0 map[string]int
         for range m0 {}
@@ -269,7 +269,7 @@ func _[
         for _, _ = range m1 {}
 
         var m2 M2
-        for range m2 /* ERROR cannot range over m2.*no structural type */ {}
+        for range m2 /* ERROR cannot range over m2.*no core type */ {}
 }
 
 // type inference checks
index 0732f06a39ab1c6afb9862771052cc610fcecf97..e762f33605735caaec4b3a55dfacec77f4b82589 100644 (file)
@@ -113,7 +113,7 @@ func _() {
        // from the first one through constraint type inference.
        related3[int]()
 
-       // The inferred type is the structural type of the Slice
+       // The inferred type is the core type of the Slice
        // type parameter.
        var _ []int = related3[int]()
 
index 077fcfdbb76119caf45f104d6751e648347512b7..ae9c0151d136ab76595d1ed6604cac2938449a75 100644 (file)
@@ -292,7 +292,7 @@ func _[T interface{~int|~float64}]() {
 
 // It is possible to create composite literals of type parameter
 // type as long as it's possible to create a composite literal
-// of the structural type of the type parameter's constraint.
+// of the core type of the type parameter's constraint.
 func _[P interface{ ~[]int }]() P {
        return P{}
        return P{1, 2, 3}
@@ -307,7 +307,7 @@ func _[P interface{ ~[]E }, E interface{ map[string]P } ]() P {
 }
 
 // This is a degenerate case with a singleton type set, but we can create
-// composite literals even if the structural type is a defined type.
+// composite literals even if the core type is a defined type.
 type MyInts []int
 
 func _[P MyInts]() P {
index 46ac51ebdd2df27b2007ce66c953b460e693c4e8..3c78f85aa4e79400e9b8f92c0969942e837dd719 100644 (file)
@@ -12,7 +12,7 @@ type C4 interface{ chan int | chan<- int }
 type C5[T any] interface{ ~chan T | <-chan T }
 
 func _[T any](ch T) {
-       <-ch // ERROR cannot receive from ch .* no structural type
+       <-ch // ERROR cannot receive from ch .* no core type
 }
 
 func _[T C0](ch T) {
@@ -28,7 +28,7 @@ func _[T C2](ch T) {
 }
 
 func _[T C3](ch T) {
-       <-ch // ERROR cannot receive from ch .* no structural type
+       <-ch // ERROR cannot receive from ch .* no core type
 }
 
 func _[T C4](ch T) {
index 83a8f3a5da64356cf10b747692018c379e712939..5c1fa80b29590c36afc799b26f724acf9767cf8f 100644 (file)
@@ -12,7 +12,7 @@ type C4 interface{ chan int | chan<- int }
 type C5[T any] interface{ ~chan T | chan<- T }
 
 func _[T any](ch T) {
-       ch /* ERROR cannot send to ch .* no structural type */ <- 0
+       ch /* ERROR cannot send to ch .* no core type */ <- 0
 }
 
 func _[T C0](ch T) {
@@ -28,7 +28,7 @@ func _[T C2](ch T) {
 }
 
 func _[T C3](ch T) {
-       ch /* ERROR cannot send to ch .* no structural type */ <- 0
+       ch /* ERROR cannot send to ch .* no core type */ <- 0
 }
 
 func _[T C4](ch T) {
index 10e8df2776375f9f85ec02db66c66a90892c189a..50870226e47e7d89835d5ec4c096b949477e8a0d 100644 (file)
@@ -6,6 +6,6 @@ package p
 
 func _[P1 any, P2 ~byte](s1 P1, s2 P2) {
         _ = append(nil /* ERROR first argument to append must be a slice; have untyped nil */ , 0)
-        _ = append(s1 /* ERROR s1 .* has no structural type */ , 0)
-        _ = append(s2 /* ERROR s2 .* has structural type byte */ , 0)
+        _ = append(s1 /* ERROR s1 .* has no core type */ , 0)
+        _ = append(s2 /* ERROR s2 .* has core type byte */ , 0)
 }
index b6454ab0031b1036c8e5a6a3e81a0a6d92a284a8..50487fa2ffeeedc97a1344847e70b779d969955d 100644 (file)
@@ -51,7 +51,7 @@ func f2[P interface{ Sfm; m() }](p P) {
 
 var _ = f2[Sfm]
 
-// special case: structural type is a named pointer type
+// special case: core type is a named pointer type
 
 type PSfm *Sfm
 
index 9487ac5a84482ae5edcbc586802cc87cf05f0cf5..ca8f155791bedfdccb61da2838e4380b56f9584d 100644 (file)
@@ -27,13 +27,13 @@ func under(t Type) Type {
        return t.Underlying()
 }
 
-// If t is not a type parameter, structuralType returns the underlying type.
-// If t is a type parameter, structuralType returns the single underlying
+// If t is not a type parameter, coreType returns the underlying type.
+// If t is a type parameter, coreType returns the single underlying
 // type of all types in its type set if it exists, or nil otherwise. If the
 // type set contains only unrestricted and restricted channel types (with
 // identical element types), the single underlying type is the restricted
 // channel type if the restrictions are always the same, or nil otherwise.
-func structuralType(t Type) Type {
+func coreType(t Type) Type {
        tpar, _ := t.(*TypeParam)
        if tpar == nil {
                return under(t)
@@ -59,10 +59,10 @@ func structuralType(t Type) Type {
        return nil
 }
 
-// structuralString is like structuralType but also considers []byte
+// coreString is like coreType but also considers []byte
 // and strings as identical. In this case, if successful and we saw
 // a string, the result is of type (possibly untyped) string.
-func structuralString(t Type) Type {
+func coreString(t Type) Type {
        tpar, _ := t.(*TypeParam)
        if tpar == nil {
                return under(t) // string or untyped string
index b421b38753e8c5b031780f487a574573003fda12..c81e73c828840f76d97062330176497af9d1ec47 100644 (file)
@@ -83,7 +83,7 @@ func (check *Checker) builtin(x *operand, call *ast.CallExpr, id builtinId) (_ b
                // of S and the respective parameter passing rules apply."
                S := x.typ
                var T Type
-               if s, _ := structuralType(S).(*Slice); s != nil {
+               if s, _ := coreType(S).(*Slice); s != nil {
                        T = s.elem
                } else {
                        var cause string
@@ -91,10 +91,10 @@ func (check *Checker) builtin(x *operand, call *ast.CallExpr, id builtinId) (_ b
                        case x.isNil():
                                cause = "have untyped nil"
                        case isTypeParam(S):
-                               if u := structuralType(S); u != nil {
-                                       cause = check.sprintf("%s has structural type %s", x, u)
+                               if u := coreType(S); u != nil {
+                                       cause = check.sprintf("%s has core type %s", x, u)
                                } else {
-                                       cause = check.sprintf("%s has no structural type", x)
+                                       cause = check.sprintf("%s has no core type", x)
                                }
                        default:
                                cause = check.sprintf("have %s", x)
@@ -116,7 +116,7 @@ func (check *Checker) builtin(x *operand, call *ast.CallExpr, id builtinId) (_ b
                                if x.mode == invalid {
                                        return
                                }
-                               if t := structuralString(x.typ); t != nil && isString(t) {
+                               if t := coreString(x.typ); t != nil && isString(t) {
                                        if check.Types != nil {
                                                sig := makeSig(S, S, x.typ)
                                                sig.variadic = true
@@ -350,14 +350,14 @@ func (check *Checker) builtin(x *operand, call *ast.CallExpr, id builtinId) (_ b
 
        case _Copy:
                // copy(x, y []T) int
-               dst, _ := structuralType(x.typ).(*Slice)
+               dst, _ := coreType(x.typ).(*Slice)
 
                var y operand
                arg(&y, 1)
                if y.mode == invalid {
                        return
                }
-               src0 := structuralString(y.typ)
+               src0 := coreString(y.typ)
                if src0 != nil && isString(src0) {
                        src0 = NewSlice(universeByte)
                }
@@ -495,13 +495,13 @@ func (check *Checker) builtin(x *operand, call *ast.CallExpr, id builtinId) (_ b
                }
 
                var min int // minimum number of arguments
-               switch structuralType(T).(type) {
+               switch coreType(T).(type) {
                case *Slice:
                        min = 2
                case *Map, *Chan:
                        min = 1
                case nil:
-                       check.errorf(arg0, _InvalidMake, "cannot make %s: no structural type", arg0)
+                       check.errorf(arg0, _InvalidMake, "cannot make %s: no core type", arg0)
                        return
                default:
                        check.invalidArg(arg0, _InvalidMake, "cannot make %s; type must be slice, map, or channel", arg0)
index aa87c48a65bcd8795380a97093b07350f8ad3a4e..3dab28445965facc07b5deb95fce1bb860279b36 100644 (file)
@@ -171,7 +171,7 @@ func (check *Checker) callExpr(x *operand, call *ast.CallExpr) exprKind {
        cgocall := x.mode == cgofunc
 
        // a type parameter may be "called" if all types have the same signature
-       sig, _ := structuralType(x.typ).(*Signature)
+       sig, _ := coreType(x.typ).(*Signature)
        if sig == nil {
                check.invalidOp(x, _InvalidCall, "cannot call non-function %s", x)
                x.mode = invalid
index 0d21a592f959e7564e374e7a2de0f3a509d6891f..8747838c4bd9247cdce06e92c50746f79b3ee1d0 100644 (file)
@@ -173,9 +173,9 @@ func (check *Checker) unary(x *operand, e *ast.UnaryExpr) {
                return
 
        case token.ARROW:
-               u := structuralType(x.typ)
+               u := coreType(x.typ)
                if u == nil {
-                       check.invalidOp(x, _InvalidReceive, "cannot receive from %s: no structural type", x)
+                       check.invalidOp(x, _InvalidReceive, "cannot receive from %s: no core type", x)
                        x.mode = invalid
                        return
                }
@@ -1338,7 +1338,7 @@ func (check *Checker) exprInternal(x *operand, e ast.Expr, hint Type) exprKind {
                case hint != nil:
                        // no composite literal type present - use hint (element type of enclosing type)
                        typ = hint
-                       base, _ = deref(structuralType(typ)) // *T implies &T{}
+                       base, _ = deref(coreType(typ)) // *T implies &T{}
 
                default:
                        // TODO(gri) provide better error messages depending on context
@@ -1346,7 +1346,7 @@ func (check *Checker) exprInternal(x *operand, e ast.Expr, hint Type) exprKind {
                        goto Error
                }
 
-               switch utyp := structuralType(base).(type) {
+               switch utyp := coreType(base).(type) {
                case *Struct:
                        // Prevent crash if the struct referred to is not yet set up.
                        // See analogous comment for *Array.
index db4732c8e00e466ee5e6e53f646802a952d2b1aa..eac6017ba2154eeadf203839943493df0529d944 100644 (file)
@@ -214,9 +214,9 @@ func (check *Checker) sliceExpr(x *operand, e *ast.SliceExpr) {
 
        valid := false
        length := int64(-1) // valid if >= 0
-       switch u := structuralString(x.typ).(type) {
+       switch u := coreString(x.typ).(type) {
        case nil:
-               check.invalidOp(x, _NonSliceableOperand, "cannot slice %s: %s has no structural type", x, x.typ)
+               check.invalidOp(x, _NonSliceableOperand, "cannot slice %s: %s has no core type", x, x.typ)
                x.mode = invalid
                return
 
index 6a9a66256588247fd12c4915df8c3eb27bc8565f..450d1045105ba143585b5f8c5b99ef8ea8146ec2 100644 (file)
@@ -415,11 +415,11 @@ func (check *Checker) inferB(posn positioner, tparams []*TypeParam, targs []Type
                }
        }
 
-       // If a constraint has a structural type, unify the corresponding type parameter with it.
+       // If a constraint has a core type, unify the corresponding type parameter with it.
        for _, tpar := range tparams {
-               sbound := structuralType(tpar)
+               sbound := coreType(tpar)
                if sbound != nil {
-                       // If the structural type is the underlying type of a single
+                       // If the core type is the underlying type of a single
                        // defined type in the constraint, use that defined type instead.
                        if named, _ := tpar.singleType().(*Named); named != nil {
                                sbound = named
@@ -434,7 +434,7 @@ func (check *Checker) inferB(posn positioner, tparams []*TypeParam, targs []Type
        }
 
        // u.x.types() now contains the incoming type arguments plus any additional type
-       // arguments which were inferred from structural types. The newly inferred non-
+       // arguments which were inferred from core types. The newly inferred non-
        // nil entries may still contain references to other type parameters.
        // For instance, for [A any, B interface{ []C }, C interface{ *A }], if A == int
        // was given, unification produced the type list [int, []C, *A]. We eliminate the
@@ -503,8 +503,8 @@ func (check *Checker) inferB(posn positioner, tparams []*TypeParam, targs []Type
        }
 
        // Once nothing changes anymore, we may still have type parameters left;
-       // e.g., a structural constraint *P may match a type parameter Q but we
-       // don't have any type arguments to fill in for *P or Q (issue #45548).
+       // e.g., a constraint with core type *P may match a type parameter Q but
+       // we don't have any type arguments to fill in for *P or Q (issue #45548).
        // Don't let such inferences escape, instead nil them out.
        for i, typ := range types {
                if typ != nil && isParameterized(tparams, typ) {
index 9f1cd7667ca0c649ae5d99081178f51b8844f033..501c230357b5014ea6b17a26b5985143d1daf77c 100644 (file)
@@ -66,12 +66,12 @@ func LookupFieldOrMethod(T Type, addressable bool, pkg *Package, name string) (o
 
        obj, index, indirect = lookupFieldOrMethod(T, addressable, pkg, name, false)
 
-       // If we didn't find anything and if we have a type parameter with a structural constraint,
-       // see if there is a matching field (but not a method, those need to be declared explicitly
-       // in the constraint). If the structural constraint is a named pointer type (see above), we
-       // are ok here because only fields are accepted as results.
+       // If we didn't find anything and if we have a type parameter with a core type,
+       // see if there is a matching field (but not a method, those need to be declared
+       // explicitly in the constraint). If the constraint is a named pointer type (see
+       // above), we are ok here because only fields are accepted as results.
        if obj == nil && isTypeParam(T) {
-               if t := structuralType(T); t != nil {
+               if t := coreType(T); t != nil {
                        obj, index, indirect = lookupFieldOrMethod(t, addressable, pkg, name, false)
                        if _, ok := obj.(*Var); !ok {
                                obj, index, indirect = nil, nil, false // accept fields (variables) only
index 23dcd7274dbe38eec5b368a90cb5576da13d7644..14e99bf42640bb87bfec099e5b7007f4cf767e22 100644 (file)
@@ -33,7 +33,7 @@ func isBasic(t Type, info BasicInfo) bool {
 // The allX predicates below report whether t is an X.
 // If t is a type parameter the result is true if isX is true
 // for all specified types of the type parameter's type set.
-// allX is an optimized version of isX(structuralType(t)) (which
+// allX is an optimized version of isX(coreType(t)) (which
 // is the same as underIs(t, isX)).
 
 func allBoolean(typ Type) bool         { return allBasic(typ, IsBoolean) }
@@ -47,7 +47,7 @@ func allNumericOrString(typ Type) bool { return allBasic(typ, IsNumeric|IsString
 // allBasic reports whether under(t) is a basic type with the specified info.
 // If t is a type parameter, the result is true if isBasic(t, info) is true
 // for all specific types of the type parameter's type set.
-// allBasic(t, info) is an optimized version of isBasic(structuralType(t), info).
+// allBasic(t, info) is an optimized version of isBasic(coreType(t), info).
 func allBasic(t Type, info BasicInfo) bool {
        if tpar, _ := t.(*TypeParam); tpar != nil {
                return tpar.is(func(t *term) bool { return t != nil && isBasic(t.typ, info) })
index b32eb18bef493d28a8e3a51ef980de6390a43c7e..a5aee482ac144c89672b56db96279df6dc36affe 100644 (file)
@@ -418,9 +418,9 @@ func (check *Checker) stmt(ctxt stmtContext, s ast.Stmt) {
                if ch.mode == invalid || val.mode == invalid {
                        return
                }
-               u := structuralType(ch.typ)
+               u := coreType(ch.typ)
                if u == nil {
-                       check.invalidOp(inNode(s, s.Arrow), _InvalidSend, "cannot send to %s: no structural type", &ch)
+                       check.invalidOp(inNode(s, s.Arrow), _InvalidSend, "cannot send to %s: no core type", &ch)
                        return
                }
                uch, _ := u.(*Chan)
@@ -831,12 +831,12 @@ func (check *Checker) stmt(ctxt stmtContext, s ast.Stmt) {
                // determine key/value types
                var key, val Type
                if x.mode != invalid {
-                       // Ranging over a type parameter is permitted if it has a structural type.
+                       // Ranging over a type parameter is permitted if it has a core type.
                        var cause string
-                       u := structuralType(x.typ)
+                       u := coreType(x.typ)
                        switch t := u.(type) {
                        case nil:
-                               cause = check.sprintf("%s has no structural type", x.typ)
+                               cause = check.sprintf("%s has no core type", x.typ)
                        case *Chan:
                                if s.Value != nil {
                                        check.softErrorf(s.Value, _InvalidIterVar, "range over %s permits only one iteration variable", &x)
index c1accff016a8a54b4a393085e872bf665deae1b9..861597399e3b1f0865de38a7f5bc3ed9310ef5dd 100644 (file)
@@ -148,7 +148,7 @@ func _[
        _ = make /* ERROR expects 2 or 3 arguments */ (S1)
        _ = make(S1, 10, 20)
        _ = make /* ERROR expects 2 or 3 arguments */ (S1, 10, 20, 30)
-       _ = make(S2 /* ERROR cannot make S2: no structural type */ , 10)
+       _ = make(S2 /* ERROR cannot make S2: no core type */ , 10)
 
        type M0 map[string]int
        _ = make(map[string]int)
@@ -156,7 +156,7 @@ func _[
        _ = make(M1)
        _ = make(M1, 10)
        _ = make/* ERROR expects 1 or 2 arguments */(M1, 10, 20)
-       _ = make(M2 /* ERROR cannot make M2: no structural type */ )
+       _ = make(M2 /* ERROR cannot make M2: no core type */ )
 
        type C0 chan int
        _ = make(chan int)
@@ -164,7 +164,7 @@ func _[
        _ = make(C1)
        _ = make(C1, 10)
        _ = make/* ERROR expects 1 or 2 arguments */(C1, 10, 20)
-       _ = make(C2 /* ERROR cannot make C2: no structural type */ )
+       _ = make(C2 /* ERROR cannot make C2: no core type */ )
        _ = make(C3)
 }
 
index d5b9ed6e77e25fe5adf92870b3f5dda365214291..29a3b16cd65535890fd6f49d4f1600cc0b3da42e 100644 (file)
@@ -134,11 +134,11 @@ func _[T interface{ ~string }] (x T, i, j, k int) { var _ T = x[i:j:k /* ERROR 3
 type myByte1 []byte
 type myByte2 []byte
 func _[T interface{ []byte | myByte1 | myByte2 }] (x T, i, j, k int) { var _ T = x[i:j:k] }
-func _[T interface{ []byte | myByte1 | []int }] (x T, i, j, k int) { var _ T = x /* ERROR no structural type */ [i:j:k] }
+func _[T interface{ []byte | myByte1 | []int }] (x T, i, j, k int) { var _ T = x /* ERROR no core type */ [i:j:k] }
 
 func _[T interface{ []byte | myByte1 | myByte2 | string }] (x T, i, j, k int) { var _ T = x[i:j] }
 func _[T interface{ []byte | myByte1 | myByte2 | string }] (x T, i, j, k int) { var _ T = x[i:j:k /* ERROR 3-index slice of string */ ] }
-func _[T interface{ []byte | myByte1 | []int | string }] (x T, i, j, k int) { var _ T = x /* ERROR no structural type */ [i:j] }
+func _[T interface{ []byte | myByte1 | []int | string }] (x T, i, j, k int) { var _ T = x /* ERROR no core type */ [i:j] }
 
 // len/cap built-ins
 
@@ -230,7 +230,7 @@ func _[
         for _, _ = range s1 {}
 
         var s2 S2
-        for range s2 /* ERROR cannot range over s2.*no structural type */ {}
+        for range s2 /* ERROR cannot range over s2.*no core type */ {}
 
         var a0 []int
         for range a0 {}
@@ -243,7 +243,7 @@ func _[
         for _, _ = range a1 {}
 
         var a2 A2
-        for range a2 /* ERROR cannot range over a2.*no structural type */ {}
+        for range a2 /* ERROR cannot range over a2.*no core type */ {}
 
         var p0 *[10]int
         for range p0 {}
@@ -256,7 +256,7 @@ func _[
         for _, _ = range p1 {}
 
         var p2 P2
-        for range p2 /* ERROR cannot range over p2.*no structural type */ {}
+        for range p2 /* ERROR cannot range over p2.*no core type */ {}
 
         var m0 map[string]int
         for range m0 {}
@@ -269,7 +269,7 @@ func _[
         for _, _ = range m1 {}
 
         var m2 M2
-        for range m2 /* ERROR cannot range over m2.*no structural type */ {}
+        for range m2 /* ERROR cannot range over m2.*no core type */ {}
 }
 
 // type inference checks
index ffa30ee2cb03407c528399fb0a1b3daf60480360..70d393b45551f9dd397c0d6b73dbcdbe91a2dd0d 100644 (file)
@@ -113,7 +113,7 @@ func _() {
        // from the first one through constraint type inference.
        related3[int]()
 
-       // The inferred type is the structural type of the Slice
+       // The inferred type is the core type of the Slice
        // type parameter.
        var _ []int = related3[int]()
 
index 33642fa42fd071cf8a181b0d308423e11bf4fec9..1e83f898836f094f00310a7bfee29141d954becc 100644 (file)
@@ -298,7 +298,7 @@ func _[T interface {~int|~float64}]() {
 
 // It is possible to create composite literals of type parameter
 // type as long as it's possible to create a composite literal
-// of the structural type of the type parameter's constraint.
+// of the core type of the type parameter's constraint.
 func _[P interface{ ~[]int }]() P {
        return P{}
        return P{1, 2, 3}
@@ -313,7 +313,7 @@ func _[P interface{ ~[]E }, E interface{ map[string]P } ]() P {
 }
 
 // This is a degenerate case with a singleton type set, but we can create
-// composite literals even if the structural type is a defined type.
+// composite literals even if the core type is a defined type.
 type MyInts []int
 
 func _[P MyInts]() P {
index 46ac51ebdd2df27b2007ce66c953b460e693c4e8..3c78f85aa4e79400e9b8f92c0969942e837dd719 100644 (file)
@@ -12,7 +12,7 @@ type C4 interface{ chan int | chan<- int }
 type C5[T any] interface{ ~chan T | <-chan T }
 
 func _[T any](ch T) {
-       <-ch // ERROR cannot receive from ch .* no structural type
+       <-ch // ERROR cannot receive from ch .* no core type
 }
 
 func _[T C0](ch T) {
@@ -28,7 +28,7 @@ func _[T C2](ch T) {
 }
 
 func _[T C3](ch T) {
-       <-ch // ERROR cannot receive from ch .* no structural type
+       <-ch // ERROR cannot receive from ch .* no core type
 }
 
 func _[T C4](ch T) {
index f71e06c9b23739599cc1eff6513a013f7aa27bae..a0bfe38de8b0509354163c1879db1e38da410bfa 100644 (file)
@@ -12,7 +12,7 @@ type C4 interface{ chan int | chan<- int }
 type C5[T any] interface{ ~chan T | chan<- T }
 
 func _[T any](ch T) {
-       ch <- /* ERROR cannot send to ch .* no structural type */ 0
+       ch <- /* ERROR cannot send to ch .* no core type */ 0
 }
 
 func _[T C0](ch T) {
@@ -28,7 +28,7 @@ func _[T C2](ch T) {
 }
 
 func _[T C3](ch T) {
-       ch <- /* ERROR cannot send to ch .* no structural type */ 0
+       ch <- /* ERROR cannot send to ch .* no core type */ 0
 }
 
 func _[T C4](ch T) {
index 10e8df2776375f9f85ec02db66c66a90892c189a..50870226e47e7d89835d5ec4c096b949477e8a0d 100644 (file)
@@ -6,6 +6,6 @@ package p
 
 func _[P1 any, P2 ~byte](s1 P1, s2 P2) {
         _ = append(nil /* ERROR first argument to append must be a slice; have untyped nil */ , 0)
-        _ = append(s1 /* ERROR s1 .* has no structural type */ , 0)
-        _ = append(s2 /* ERROR s2 .* has structural type byte */ , 0)
+        _ = append(s1 /* ERROR s1 .* has no core type */ , 0)
+        _ = append(s2 /* ERROR s2 .* has core type byte */ , 0)
 }
index b6454ab0031b1036c8e5a6a3e81a0a6d92a284a8..50487fa2ffeeedc97a1344847e70b779d969955d 100644 (file)
@@ -51,7 +51,7 @@ func f2[P interface{ Sfm; m() }](p P) {
 
 var _ = f2[Sfm]
 
-// special case: structural type is a named pointer type
+// special case: core type is a named pointer type
 
 type PSfm *Sfm
 
index 3acb19c41240fcf5713c72f81c50b1b467026d03..323365aefe356d287f230a471dcce9eb6a68e669 100644 (file)
@@ -27,13 +27,13 @@ func under(t Type) Type {
        return t.Underlying()
 }
 
-// If t is not a type parameter, structuralType returns the underlying type.
-// If t is a type parameter, structuralType returns the single underlying
+// If t is not a type parameter, coreType returns the underlying type.
+// If t is a type parameter, coreType returns the single underlying
 // type of all types in its type set if it exists, or nil otherwise. If the
 // type set contains only unrestricted and restricted channel types (with
 // identical element types), the single underlying type is the restricted
 // channel type if the restrictions are always the same, or nil otherwise.
-func structuralType(t Type) Type {
+func coreType(t Type) Type {
        tpar, _ := t.(*TypeParam)
        if tpar == nil {
                return under(t)
@@ -59,10 +59,10 @@ func structuralType(t Type) Type {
        return nil
 }
 
-// structuralString is like structuralType but also considers []byte
+// coreString is like coreType but also considers []byte
 // and strings as identical. In this case, if successful and we saw
 // a string, the result is of type (possibly untyped) string.
-func structuralString(t Type) Type {
+func coreString(t Type) Type {
        tpar, _ := t.(*TypeParam)
        if tpar == nil {
                return under(t) // string or untyped string
index cd46f3feabe4fecfc24927a09c5400b0a656aa6b..12dbd0efb7454886081403c48a512f53020d6c11 100644 (file)
@@ -57,7 +57,7 @@ func f2[P interface {
 
 var _ = f2[Sfm]
 
-// special case: structural type is a named pointer type
+// special case: core type is a named pointer type
 
 type PSfm *Sfm
 
@@ -68,7 +68,7 @@ func f3[P interface{ PSfm }](p P) {
 
 var _ = f3[PSfm]
 
-// special case: structural type is an unnamed pointer type
+// special case: core type is an unnamed pointer type
 
 func f4[P interface{ *Sfm }](p P) {
        _ = p.f
index 34ea4b8aa99219199d13da19524dcb0994014180..477778f8fb25f62eff52855908ff53d3c8eac3cd 100644 (file)
@@ -4,7 +4,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// This file tests type lists & structural constraints.
+// This file tests type lists & constraints with core types.
 
 // Note: This test has been adjusted to use the new
 //       type set notation rather than type lists.
@@ -30,28 +30,28 @@ func _[T interface{ ~int }](x T) {
        var _ T = 42
        var _ T = T(myint(42))
 }
+
 // TODO: put this type declaration back inside the above function when issue 47631 is fixed.
 type myint int
 
-// Indexing a generic type which has a structural contraints to be an array.
+// Indexing a generic type which has a an array as core type.
 func _[T interface{ ~[10]int }](x T) {
        _ = x[9] // ok
 }
 
-// Dereference of a generic type which has a structural contraint to be a pointer.
+// Dereference of a generic type which has a pointer as core type.
 func _[T interface{ ~*int }](p T) int {
        return *p
 }
 
-// Channel send and receive on a generic type which has a structural constraint to
-// be a channel.
+// Channel send and receive on a generic type which has a channel as core type.
 func _[T interface{ ~chan int }](ch T) int {
        // This would deadlock if executed (but ok for a compile test)
        ch <- 0
        return <-ch
 }
 
-// Calling of a generic type which has a structural constraint to be a function.
+// Calling of a generic type which has a function as core type.
 func _[T interface{ ~func() }](f T) {
        f()
        go f()
@@ -62,7 +62,7 @@ func _[T interface{ ~func(string) int }](f T) int {
        return f("hello")
 }
 
-// Map access of a generic type which has a structural constraint to be a map.
+// Map access of a generic type which has a map as core type.
 func _[V any, T interface{ ~map[string]V }](p T) V {
        return p["test"]
 }
@@ -122,7 +122,9 @@ func f5[A interface {
                b B
                c C
        }
-}, B any, C interface{ ~*B }](x B) A { panic(0) }
+}, B any, C interface{ ~*B }](x B) A {
+       panic(0)
+}
 func f5x() {
        x := f5(1.2)
        var _ float64 = x.b