lang/check: tighten checkConstElement constraint

This commit is contained in:
Nigel Tao committed 2023-04-16 11:50:30 +10:00
1 parent 4834cb97c8
commit 95630b6677
1 file changed
+1 -1
+1 -1
View File
@@ -405,7 +405,7 @@ func (c *Checker) checkConst(node *a.Node) error {
func (c *Checker) checkConstElement(typ *a.TypeExpr, n *a.Expr, nb bounds, nLists int) error {
if nLists > 0 {
nLists--
if !typ.IsEitherArrayType() {
if typ.Decorator() != t.IDRoarray {
return fmt.Errorf("internal error: inconsistent element type %q", typ.Str(c.tm))
}
cv := typ.ArrayLength().ConstValue()