node: add more diagnostics for mixed array/map literals
This commit is contained in:
parent
d3d3d34116
commit
48f3014429
5
node.go
5
node.go
@ -1658,8 +1658,9 @@ func (this *conversionState) convertArrayLiteralCommon(items []node.Node) (strin
|
|||||||
if idx == 0 {
|
if idx == 0 {
|
||||||
isMapType = (itm.Key != nil)
|
isMapType = (itm.Key != nil)
|
||||||
} else {
|
} else {
|
||||||
if isMapType != (itm.Key != nil) {
|
thisElemIsMapType := (itm.Key != nil)
|
||||||
return "", parseErr{itm, fmt.Errorf("Can't represent array and map in a single type")}
|
if isMapType != thisElemIsMapType {
|
||||||
|
return "", parseErr{itm, fmt.Errorf("Can't represent array and map in a single type (idx[0].isMap=%v != idx[%d].isMap=%v)", isMapType, idx, thisElemIsMapType)}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user