From 19fdbfc173bfccb64cb64e0a963e69f52f71fc73 Mon Sep 17 00:00:00 2001 From: Nikolay Nikolov Date: Sat, 6 Apr 2024 15:33:03 +0300 Subject: [PATCH] Converted the 'invalid kind for firstOrd/lastOrd(XXX)' messages from internal errors to fatal errors. (#23443) (#23447) 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 (cherry picked from commit c934d5986d241c2a34c89ae3c16047299fd3a86b) --- compiler/types.nim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/types.nim b/compiler/types.nim index ca5c89944e..40ad4a3f7a 100644 --- a/compiler/types.nim +++ b/compiler/types.nim @@ -831,11 +831,11 @@ proc firstOrd*(conf: ConfigRef; t: PType): Int128 = result = firstOrd(conf, lastSon(t)) of tyOrdinal: if t.len > 0: result = firstOrd(conf, lastSon(t)) - else: internalError(conf, "invalid kind for firstOrd(" & $t.kind & ')') + else: fatal(conf, unknownLineInfo, "invalid kind for firstOrd(" & $t.kind & ')') of tyUncheckedArray, tyCstring: result = Zero else: - internalError(conf, "invalid kind for firstOrd(" & $t.kind & ')') + fatal(conf, unknownLineInfo, "invalid kind for firstOrd(" & $t.kind & ')') result = Zero proc firstFloat*(t: PType): BiggestFloat = @@ -890,11 +890,11 @@ proc lastOrd*(conf: ConfigRef; t: PType): Int128 = of tyProxy: result = Zero of tyOrdinal: if t.len > 0: result = lastOrd(conf, lastSon(t)) - else: internalError(conf, "invalid kind for lastOrd(" & $t.kind & ')') + else: fatal(conf, unknownLineInfo, "invalid kind for lastOrd(" & $t.kind & ')') of tyUncheckedArray: result = Zero else: - internalError(conf, "invalid kind for lastOrd(" & $t.kind & ')') + fatal(conf, unknownLineInfo, "invalid kind for lastOrd(" & $t.kind & ')') result = Zero proc lastFloat*(t: PType): BiggestFloat =