From 48f3014429723903f763b2a8755d3437f91875c3 Mon Sep 17 00:00:00 2001 From: mappu Date: Sat, 11 Apr 2020 12:45:05 +1200 Subject: [PATCH] node: add more diagnostics for mixed array/map literals --- node.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/node.go b/node.go index ec58faf..d7b2c99 100644 --- a/node.go +++ b/node.go @@ -1658,8 +1658,9 @@ func (this *conversionState) convertArrayLiteralCommon(items []node.Node) (strin if idx == 0 { isMapType = (itm.Key != nil) } else { - if isMapType != (itm.Key != nil) { - return "", parseErr{itm, fmt.Errorf("Can't represent array and map in a single type")} + thisElemIsMapType := (itm.Key != nil) + 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)} } }