summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2014-08-13 02:53:00 +0200
committerAraq <rumpf_a@web.de>2014-08-13 02:53:00 +0200
commit32a5d4baf0e4930dbb9da47b060784a948bc2bee (patch)
tree5bfc4cda1c7ad68665ccbf4e7f387f0b490c0944 /compiler
parentabc844733157441ed5a1aee23476e55c2fcd8a83 (diff)
downloadNim-32a5d4baf0e4930dbb9da47b060784a948bc2bee.tar.gz
fixes #1442
Diffstat (limited to 'compiler')
-rw-r--r--compiler/types.nim10
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/types.nim b/compiler/types.nim
index 786eea14e..7559f4d2d 100644
--- a/compiler/types.nim
+++ b/compiler/types.nim
@@ -582,7 +582,10 @@ proc firstOrd(t: PType): BiggestInt =
   of tyGenericInst, tyDistinct, tyConst, tyMutable,
      tyTypeDesc, tyFieldAccessor:
     result = firstOrd(lastSon(t))
-  else: 
+  of tyOrdinal:
+    if t.len > 0: result = firstOrd(lastSon(t))
+    else: internalError("invalid kind for first(" & $t.kind & ')')
+  else:
     internalError("invalid kind for first(" & $t.kind & ')')
     result = 0
 
@@ -617,7 +620,10 @@ proc lastOrd(t: PType): BiggestInt =
      tyTypeDesc, tyFieldAccessor:
     result = lastOrd(lastSon(t))
   of tyProxy: result = 0
-  else: 
+  of tyOrdinal:
+    if t.len > 0: result = lastOrd(lastSon(t))
+    else: internalError("invalid kind for last(" & $t.kind & ')')
+  else:
     internalError("invalid kind for last(" & $t.kind & ')')
     result = 0