From 2644620770ee4519f99c6305fa28919826b76cca Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Thu, 29 Jun 2023 18:14:32 +1000 Subject: [PATCH] check: allow p[i] if p has type "ptr array[N] T" --- lang/check/bounds.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lang/check/bounds.go b/lang/check/bounds.go index 7ed8cf71..9a0983a3 100644 --- a/lang/check/bounds.go +++ b/lang/check/bounds.go @@ -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 {