parent
d07489abf4
commit
217a2cf098
2 changed files with 14 additions and 1 deletions
|
|
@ -557,7 +557,10 @@ proc semCaseBranch(c: PContext, t, branch: PNode, branchIndex: int,
|
||||||
return
|
return
|
||||||
elif r.kind notin {nkCurly, nkBracket} or len(r) == 0:
|
elif r.kind notin {nkCurly, nkBracket} or len(r) == 0:
|
||||||
checkMinSonsLen(t, 1, c.config)
|
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)
|
inc(covered)
|
||||||
else:
|
else:
|
||||||
if r.kind == nkCurly:
|
if r.kind == nkCurly:
|
||||||
|
|
|
||||||
10
tests/casestmt/t8333.nim
Normal file
10
tests/casestmt/t8333.nim
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
discard """
|
||||||
|
output: "1"
|
||||||
|
"""
|
||||||
|
|
||||||
|
converter toInt*(x: char): int =
|
||||||
|
x.int
|
||||||
|
|
||||||
|
case 0
|
||||||
|
of 'a': echo 0
|
||||||
|
else: echo 1
|
||||||
Loading…
Add table
Add a link
Reference in a new issue