diff options
Diffstat (limited to 'compiler/semfold.nim')
-rw-r--r-- | compiler/semfold.nim | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/semfold.nim b/compiler/semfold.nim index 237a5127a..f0b03018f 100644 --- a/compiler/semfold.nim +++ b/compiler/semfold.nim @@ -493,11 +493,11 @@ proc foldArrayAccess(m: PSym, n: PNode; g: ModuleGraph): PNode = result = x.sons[int(idx)] if result.kind == nkExprColonExpr: result = result.sons[1] else: - localError(g.config, n.info, formatErrorIndexBound(idx, sonsLen(x)+1) & $n) + localError(g.config, n.info, formatErrorIndexBound(idx, sonsLen(x)-1) & $n) of nkBracket: idx = idx - firstOrd(g.config, x.typ) if idx >= 0 and idx < x.len: result = x.sons[int(idx)] - else: localError(g.config, n.info, formatErrorIndexBound(idx, x.len+1) & $n) + else: localError(g.config, n.info, formatErrorIndexBound(idx, x.len-1) & $n) of nkStrLit..nkTripleStrLit: result = newNodeIT(nkCharLit, x.info, n.typ) if idx >= 0 and idx < len(x.strVal): |