]> Cypherpunks repositories - gostls13.git/commitdiff
go/types, types2: remove remaining mentions of core type in error messages
authorRobert Griesemer <gri@golang.org>
Mon, 3 Mar 2025 20:26:51 +0000 (12:26 -0800)
committerGopher Robot <gobot@golang.org>
Mon, 3 Mar 2025 21:41:04 +0000 (13:41 -0800)
The implementatiom still calls coreType in places and refers to
"core types" in comments, but user-visible error messages don't
know about core types anymore.

This brings the user-visible part of the implementation in sync with
the spec which doesn't have the notion of core types anymore.

For #70128.

Change-Id: I14bc6767a83e8f54b10ebe99a7df0b98cd9fca87
Reviewed-on: https://go-review.googlesource.com/c/go/+/654395
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Griesemer <gri@google.com>
src/cmd/compile/internal/types2/index.go
src/cmd/compile/internal/types2/infer.go
src/cmd/compile/internal/types2/signature.go
src/go/types/index.go
src/go/types/infer.go
src/go/types/signature.go
src/internal/types/testdata/check/typeparams.go

index d1d7a530b6e74384b98d1d72baa692a4989b306b..451c5e2f9aba8e473f76d10871629ffcc8b369a5 100644 (file)
@@ -217,7 +217,7 @@ func (check *Checker) sliceExpr(x *operand, e *syntax.SliceExpr) {
        length := int64(-1) // valid if >= 0
        switch u := coreString(x.typ).(type) {
        case nil:
-               check.errorf(x, NonSliceableOperand, invalidOp+"cannot slice %s: %s has no core type", x, x.typ)
+               check.errorf(x, NonSliceableOperand, invalidOp+"cannot slice %s: %s has no common underlying type", x, x.typ)
                x.mode = invalid
                return
 
index 56f044468637232610e577ab1c6a8f41a3a8eb5c..865cabe31cbf7247a0205e6e2267215ca5a86a5c 100644 (file)
@@ -265,7 +265,7 @@ func (check *Checker) infer(pos syntax.Pos, tparams []*TypeParam, targs []Type,
                                        }
                                case single && !core.tilde:
                                        if traceInference {
-                                               u.tracef("-> set type parameter %s to constraint core type %s", tpar, core.typ)
+                                               u.tracef("-> set type parameter %s to constraint's common underlying type %s", tpar, core.typ)
                                        }
                                        // The corresponding type argument tx is unknown and the core term
                                        // describes a single specific type and no tilde.
index 622eb1383da00099473eaf47f4f5e6270baa8501..892fa0e460b21dbc726c35f932589e81949e224a 100644 (file)
@@ -45,7 +45,7 @@ func NewSignatureType(recv *Var, recvTypeParams, typeParams []*TypeParam, params
                }
                core := coreString(params.At(n - 1).typ)
                if _, ok := core.(*Slice); !ok && !isString(core) {
-                       panic(fmt.Sprintf("got %s, want variadic parameter with unnamed slice type or string as core type", core.String()))
+                       panic(fmt.Sprintf("got %s, want variadic parameter with unnamed slice type or string as common underlying type", core.String()))
                }
        }
        sig := &Signature{recv: recv, params: params, results: results, variadic: variadic}
index 1c04f16a9727cb845b399906782757dca9625f8a..88c32706ee63e9025e1934065ae0e643a74fada5 100644 (file)
@@ -219,7 +219,7 @@ func (check *Checker) sliceExpr(x *operand, e *ast.SliceExpr) {
        length := int64(-1) // valid if >= 0
        switch u := coreString(x.typ).(type) {
        case nil:
-               check.errorf(x, NonSliceableOperand, invalidOp+"cannot slice %s: %s has no core type", x, x.typ)
+               check.errorf(x, NonSliceableOperand, invalidOp+"cannot slice %s: %s has no common underlying type", x, x.typ)
                x.mode = invalid
                return
 
index 873e351732fa6d1bd556f7bf6d9aac67c69a5bf9..c04ca98fb5b863287319b75cfaf0a7fdf6fdfad5 100644 (file)
@@ -268,7 +268,7 @@ func (check *Checker) infer(posn positioner, tparams []*TypeParam, targs []Type,
                                        }
                                case single && !core.tilde:
                                        if traceInference {
-                                               u.tracef("-> set type parameter %s to constraint core type %s", tpar, core.typ)
+                                               u.tracef("-> set type parameter %s to constraint's common underlying type %s", tpar, core.typ)
                                        }
                                        // The corresponding type argument tx is unknown and the core term
                                        // describes a single specific type and no tilde.
index 365b1119393dd25aa734708af44189147ffd8d04..babb24b0ca6eafbaec14c8383b337ba938c178d4 100644 (file)
@@ -58,7 +58,7 @@ func NewSignatureType(recv *Var, recvTypeParams, typeParams []*TypeParam, params
                }
                core := coreString(params.At(n - 1).typ)
                if _, ok := core.(*Slice); !ok && !isString(core) {
-                       panic(fmt.Sprintf("got %s, want variadic parameter with unnamed slice type or string as core type", core.String()))
+                       panic(fmt.Sprintf("got %s, want variadic parameter with unnamed slice type or string as common underlying type", core.String()))
                }
        }
        sig := &Signature{recv: recv, params: params, results: results, variadic: variadic}
index d4fd35645ff2b09e8fe1cae0759ff33edc3ebed4..1504442e069e8a4c8b70051865ffce2ffff63dd6 100644 (file)
@@ -134,11 +134,11 @@ func _[T interface{ ~string }] (x T, i, j, k int) { var _ T = x[i:j:k /* ERROR "
 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 core type" */ [i:j:k] }
+func _[T interface{ []byte | myByte1 | []int }] (x T, i, j, k int) { var _ T = x /* ERROR "no common underlying 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 core type" */ [i:j] }
+func _[T interface{ []byte | myByte1 | []int | string }] (x T, i, j, k int) { var _ T = x /* ERROR "no common underlying type" */ [i:j] }
 
 // len/cap built-ins