mirror of https://github.com/golang/go.git
go/types, types2: remove remaining mentions of core type in error messages
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>
This commit is contained in:
parent
0a0e6af39b
commit
7e81bcf39f
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue