summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorLemonBoy <LemonBoy@users.noreply.github.com>2018-07-16 16:19:31 +0200
committerAndreas Rumpf <rumpf_a@web.de>2018-07-16 16:19:31 +0200
commit217a2cf0982302b9d89d2c06fc96eaf72f0518fe (patch)
tree3c78d5c17be78081023c2d11085253aaa1a8beaf /compiler
parentd07489abf4a04273adfb0cf36860c64d1831221a (diff)
downloadNim-217a2cf0982302b9d89d2c06fc96eaf72f0518fe.tar.gz
Resolve converter call to constants in case arms (#8336)
Fixes #8333
Diffstat (limited to 'compiler')
-rw-r--r--compiler/semtypes.nim5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim
index 17420111f..25d8674b8 100644
--- a/compiler/semtypes.nim
+++ b/compiler/semtypes.nim
@@ -557,7 +557,10 @@ proc semCaseBranch(c: PContext, t, branch: PNode, branchIndex: int,
         return
       elif r.kind notin {nkCurly, nkBracket} or len(r) == 0:
         checkMinSonsLen(t, 1, c.config)
-        branch.sons[i] = skipConv(fitNode(c, t.sons[0].typ, r, r.info))
+        var tmp = fitNode(c, t.sons[0].typ, r, r.info)
+        # the call to fitNode may introduce a call to a converter
+        if tmp.kind in {nkHiddenCallConv}: tmp = semConstExpr(c, tmp)
+        branch.sons[i] = skipConv(tmp)
         inc(covered)
       else:
         if r.kind == nkCurly: