* make unary minus part of number literals, refs #17020 * fixes regression
This commit is contained in:
parent
465a41c308
commit
86af2f7b50
5 changed files with 173 additions and 39 deletions
|
|
@ -299,7 +299,7 @@ proc semArrayIndex(c: PContext, n: PNode): PType =
|
|||
result = makeRangeWithStaticExpr(c, e.typ.n)
|
||||
elif e.kind in {nkIntLit..nkUInt64Lit}:
|
||||
if e.intVal < 0:
|
||||
localError(c.config, n[1].info,
|
||||
localError(c.config, n.info,
|
||||
"Array length can't be negative, but was " & $e.intVal)
|
||||
result = makeRangeType(c, 0, e.intVal-1, n.info, e.typ)
|
||||
elif e.kind == nkSym and e.typ.kind == tyStatic:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue