summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorNeelesh Chandola <neelesh.chandola@outlook.com>2018-12-15 22:19:39 +0530
committerNeelesh Chandola <neelesh.chandola@outlook.com>2018-12-15 22:19:39 +0530
commitc673607d36d618649524bbf96008f487213ef999 (patch)
tree2f245fc499fa10e19f1daa75cc1b164c2195f6b2
parent50193b95eaa48e87b7f20f6d2803699cb73821d6 (diff)
downloadNim-c673607d36d618649524bbf96008f487213ef999.tar.gz
Fix internal error when casting to invalid enum value
-rw-r--r--compiler/semfold.nim4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/semfold.nim b/compiler/semfold.nim
index 9e7ed5cee..0bdd0b64c 100644
--- a/compiler/semfold.nim
+++ b/compiler/semfold.nim
@@ -132,7 +132,9 @@ proc ordinalValToString*(a: PNode; g: ModuleGraph): string =
           return field.name.s
         else:
           return field.ast.strVal
-    internalError(g.config, a.info, "no symbol for ordinal value: " & $x)
+    localError(g.config, a.info,
+      "Cannot convert int literal to $1. The value is invalid." %
+        [typeToString(t)])
   else:
     result = $x