typ = hint
base = typ
// *T implies &T{}
- if b, ok := deref(coreType(base)); ok {
+ if b, ok := deref(commonUnder(check, base, nil)); ok {
base = b
}
isElem = true
base = typ
}
- switch utyp := coreType(base).(type) {
+ switch utyp := commonUnder(check, base, nil).(type) {
case *Struct:
// Prevent crash if the struct referred to is not yet set up.
// See analogous comment for *Array.
}
var cause string
if utyp == nil {
- cause = " (no core type)"
+ cause = " (no common underlying type)"
}
check.errorf(e, InvalidLit, "invalid composite literal%s type %s%s", qualifier, typ, cause)
x.mode = invalid
typ = hint
base = typ
// *T implies &T{}
- if b, ok := deref(coreType(base)); ok {
+ if b, ok := deref(commonUnder(check, base, nil)); ok {
base = b
}
isElem = true
base = typ
}
- switch utyp := coreType(base).(type) {
+ switch utyp := commonUnder(check, base, nil).(type) {
case *Struct:
// Prevent crash if the struct referred to is not yet set up.
// See analogous comment for *Array.
}
var cause string
if utyp == nil {
- cause = " (no core type)"
+ cause = " (no common underlying type)"
}
check.errorf(e, InvalidLit, "invalid composite literal%s type %s%s", qualifier, typ, cause)
x.mode = invalid
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 common underlying 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 common underlying type)" */ }}
}