summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorNikolay Nikolov <nickysn@gmail.com>2024-03-27 11:51:44 +0200
committerGitHub <noreply@github.com>2024-03-27 10:51:44 +0100
commitc934d5986d241c2a34c89ae3c16047299fd3a86b (patch)
treeb11e14505c63f6df97c1f57c0dff6e13f5415190 /compiler
parent4c38569229ade43d9570f92e08637f2bcd66bdc5 (diff)
downloadNim-c934d5986d241c2a34c89ae3c16047299fd3a86b.tar.gz
Converted the 'invalid kind for firstOrd/lastOrd(XXX)' messages from internal errors to fatal errors. (#23443)
This fixes a nimsuggest crash when opening:
    beacon_chain/consensus_object_pools/blockchain_dag.nim
from the nimbus-eth2 project and many other .nim files (44 files, to be
precise) in the same project.

Replaces: https://github.com/nim-lang/Nim/pull/23402
Diffstat (limited to 'compiler')
-rw-r--r--compiler/types.nim8
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler/types.nim b/compiler/types.nim
index 372637827..e5ce0aea1 100644
--- a/compiler/types.nim
+++ b/compiler/types.nim
@@ -809,12 +809,12 @@ proc firstOrd*(conf: ConfigRef; t: PType): Int128 =
     if t.hasElementType: result = firstOrd(conf, skipModifier(t))
     else:
       result = Zero
-      internalError(conf, "invalid kind for firstOrd(" & $t.kind & ')')
+      fatal(conf, unknownLineInfo, "invalid kind for firstOrd(" & $t.kind & ')')
   of tyUncheckedArray, tyCstring:
     result = Zero
   else:
     result = Zero
-    internalError(conf, "invalid kind for firstOrd(" & $t.kind & ')')
+    fatal(conf, unknownLineInfo, "invalid kind for firstOrd(" & $t.kind & ')')
 
 proc firstFloat*(t: PType): BiggestFloat =
   case t.kind
@@ -905,12 +905,12 @@ proc lastOrd*(conf: ConfigRef; t: PType): Int128 =
     if t.hasElementType: result = lastOrd(conf, skipModifier(t))
     else:
       result = Zero
-      internalError(conf, "invalid kind for lastOrd(" & $t.kind & ')')
+      fatal(conf, unknownLineInfo, "invalid kind for lastOrd(" & $t.kind & ')')
   of tyUncheckedArray:
     result = Zero
   else:
     result = Zero
-    internalError(conf, "invalid kind for lastOrd(" & $t.kind & ')')
+    fatal(conf, unknownLineInfo, "invalid kind for lastOrd(" & $t.kind & ')')
 
 proc lastFloat*(t: PType): BiggestFloat =
   case t.kind