case syntax.Recv:
u := coreType(x.typ)
if u == nil {
- check.errorf(x, _InvalidReceive, invalidOp+"cannot receive from %s: no core type", x)
+ check.errorf(x, _InvalidReceive, invalidOp+"cannot receive from %s (no core type)", x)
x.mode = invalid
return
}
if switchCase {
check.errorf(x, code, "invalid case %s in switch on %s (%s)", x.expr, y.expr, cause) // error position always at 1st operand
} else {
- if check.conf.CompilerErrorMessages {
- check.errorf(errOp, code, invalidOp+"%s %s %s (%s)", x.expr, op, y.expr, cause)
- } else {
- check.errorf(errOp, code, invalidOp+"cannot compare %s %s %s (%s)", x.expr, op, y.expr, cause)
- }
+ check.errorf(errOp, code, invalidOp+"%s %s %s (%s)", x.expr, op, y.expr, cause)
}
x.mode = invalid
}
typ = hint
base, _ = deref(coreType(typ)) // *T implies &T{}
if base == nil {
- check.errorf(e, _InvalidLit, "invalid composite literal element type %s: no core type", typ)
+ check.errorf(e, _InvalidLit, "invalid composite literal element type %s (no core type)", typ)
goto Error
}
case token.ARROW:
u := coreType(x.typ)
if u == nil {
- check.invalidOp(x, _InvalidReceive, "cannot receive from %s: no core type", x)
+ check.invalidOp(x, _InvalidReceive, "cannot receive from %s (no core type)", x)
x.mode = invalid
return
}
if switchCase {
check.errorf(x, code, "invalid case %s in switch on %s (%s)", x.expr, y.expr, cause) // error position always at 1st operand
} else {
- if compilerErrorMessages {
- check.invalidOp(errOp, code, "%s %s %s (%s)", x.expr, op, y.expr, cause)
- } else {
- check.invalidOp(errOp, code, "cannot compare %s %s %s (%s)", x.expr, op, y.expr, cause)
- }
+ check.invalidOp(errOp, code, "%s %s %s (%s)", x.expr, op, y.expr, cause)
}
x.mode = invalid
}
typ = hint
base, _ = deref(coreType(typ)) // *T implies &T{}
if base == nil {
- check.errorf(e, _InvalidLit, "invalid composite literal element type %s: no core type", typ)
+ check.errorf(e, _InvalidLit, "invalid composite literal element type %s (no core type)", typ)
goto Error
}
func _bool() {
const t = true == true
const f = true == false
- _ = t /* ERROR cannot compare */ < f
+ _ = t /* ERROR operator .* not defined */ < f
_ = 0 == t /* ERROR mismatched types untyped int and untyped bool */
var b bool
var x, y float32
_ = a == b
_ = a != b
_ = a /* ERROR < not defined */ < b
- _ = a == nil /* ERROR cannot compare.*mismatched types */
+ _ = a == nil /* ERROR mismatched types */
type C [10]int
var c C
_ = s == t
_ = s != t
_ = s /* ERROR < not defined */ < t
- _ = s == nil /* ERROR cannot compare.*mismatched types */
+ _ = s == nil /* ERROR mismatched types */
type S struct {
x int
x int
a [10]map[string]int
}
- _ = u /* ERROR cannot compare */ == u
+ _ = u /* ERROR cannot be compared */ == u
}
func pointers() {
}
func _[T interface{~int | ~float32}](x, y T) bool { return x < y }
-func _[T any](x, y T) bool { return x /* ERROR cannot compare */ < y }
-func _[T interface{~int | ~float32 | ~bool}](x, y T) bool { return x /* ERROR cannot compare */ < y }
+func _[T any](x, y T) bool { return x /* ERROR type parameter T is not comparable */ < y }
+func _[T interface{~int | ~float32 | ~bool}](x, y T) bool { return x /* ERROR type parameter T is not comparable */ < y }
-func _[T C1[T]](x, y T) bool { return x /* ERROR cannot compare */ < y }
+func _[T C1[T]](x, y T) bool { return x /* ERROR type parameter T is not comparable */ < y }
func _[T C2[T]](x, y T) bool { return x < y }
type C1[T any] interface{}
type C5[T any] interface{ ~chan T | <-chan T }
func _[T any](ch T) {
- <-ch // ERROR cannot receive from ch .* no core type
+ <-ch // ERROR cannot receive from ch .* \(no core type\)
}
func _[T C0](ch T) {
}
func _[T C3](ch T) {
- <-ch // ERROR cannot receive from ch .* no core type
+ <-ch // ERROR cannot receive from ch .* \(no core type\)
}
func _[T C4](ch T) {
type S2 struct{}
func _[P *S1|*S2]() {
- _= []P{{ /* ERROR invalid composite literal element type P: no core type */ }}
+ _= []P{{ /* ERROR invalid composite literal element type P \(no core type\) */ }}
}
func _[P *S1|S1]() {
- _= []P{{ /* ERROR invalid composite literal element type P: no core type */ }}
+ _= []P{{ /* ERROR invalid composite literal element type P \(no core type\) */ }}
}
}
func _[T interface{comparable; ~[]byte}](x T) {
- _ = x /* ERROR cannot compare */ == x
+ _ = x /* ERROR empty type set */ == x
}
// TODO(gri) The error message here should be better. See issue #51525.
func _[T interface{comparable; ~int; ~string}](x T) {
- _ = x /* ERROR cannot compare */ == x
+ _ = x /* ERROR empty type set */ == x
}
// TODO(gri) The error message here should be better. See issue #51525.
func _[T interface{~int; ~string}](x T) {
- _ = x /* ERROR cannot compare */ == x
+ _ = x /* ERROR empty type set */ == x
}
func _[T interface{comparable; interface{~int}; interface{int|float64}}](x T) {
}
func _[T interface{interface{comparable; ~int}; interface{~float64; comparable; m()}}](x T) {
- _ = x /* ERROR cannot compare */ == x
+ _ = x /* ERROR empty type set */ == x
}
// test case from issue