From 4be68447564fbf19d2c9e260ecb127b391dece07 Mon Sep 17 00:00:00 2001 From: Adam Strzelecki Date: Mon, 28 Sep 2015 23:34:52 +0200 Subject: [PATCH] vm: Don't fail on unknown enum position to string Previously trying to convert constant of enum type, where this enum type has no entry with given constant position leaded to "internal error: opConv for enum". Instead of producing error, now we gracefully convert it to "EnumType position". --- compiler/vm.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/vm.nim b/compiler/vm.nim index 4dd3b5232d..ad4aa1017f 100644 --- a/compiler/vm.nim +++ b/compiler/vm.nim @@ -311,7 +311,7 @@ proc opConv*(dest: var TFullReg, src: TFullReg, desttyp, srctyp: PType): bool = if f.position == x: dest.node.strVal = if f.ast.isNil: f.name.s else: f.ast.strVal return - internalError("opConv for enum") + dest.node.strVal = styp.sym.name.s & " " & $x of tyInt..tyInt64: dest.node.strVal = $src.intVal of tyUInt..tyUInt64: