check: allow p[i] if p has type "ptr array[N] T"

This commit is contained in:
Nigel Tao committed 2023-06-29 18:15:08 +10:00
1 parent b97560b292
commit 2644620770
1 file changed
+3 -1
+3 -1
View File
@@ -1026,7 +1026,9 @@ func (q *checker) bcheckExprOther(n *a.Expr, depth uint32) (bounds, error) {
lengthExpr = lTyp.ArrayLength()
} else if lTyp.IsPointerType() && lTyp.Inner().IsEitherArrayType() {
lengthExpr = lTyp.Inner().ArrayLength()
if err := q.proveRecvNotEqNullptr(lhs); err != nil {
if lTyp.Decorator() == t.IDPtr {
// No-op.
} else if err := q.proveRecvNotEqNullptr(lhs); err != nil {
return bounds{}, err
}
} else {