summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2018-03-14 11:49:27 +0100
committerAndreas Rumpf <rumpf_a@web.de>2018-03-14 11:49:27 +0100
commit12f7b96be08cce291f33f79ea2d504d93fdc7974 (patch)
tree79441879b985e9d207687b776eeb0ef97303bf8a
parent55a5dcf8a47a47028707c46491072c438eb2f6ce (diff)
downloadNim-12f7b96be08cce291f33f79ea2d504d93fdc7974.tar.gz
prevent yet another compiler crash from happening
-rw-r--r--compiler/semtypes.nim3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim
index e9f4e1a98..d097a373f 100644
--- a/compiler/semtypes.nim
+++ b/compiler/semtypes.nim
@@ -257,7 +257,8 @@ proc semArrayIndex(c: PContext, n: PNode): PType =
       if e.sym.ast != nil:
         return semArrayIndex(c, e.sym.ast)
       if not isOrdinalType(e.typ.lastSon):
-        localError(n[1].info, errOrdinalTypeExpected)
+        let info = if n.safeLen > 1: n[1].info else: n.info
+        localError(info, errOrdinalTypeExpected)
       result = makeRangeWithStaticExpr(c, e)
       if c.inGenericContext > 0: result.flags.incl tfUnresolved
     elif e.kind in nkCallKinds and hasGenericArguments(e):