fix #18964 Small string case with else statement first in AST evaluates wrongly
This commit is contained in:
parent
0448f30fd9
commit
8cfce70738
2 changed files with 18 additions and 1 deletions
12
tests/casestmt/t18964.nim
Normal file
12
tests/casestmt/t18964.nim
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
discard """
|
||||
errormsg: "invalid order of case branches"
|
||||
"""
|
||||
|
||||
import macros
|
||||
|
||||
macro genCase(val: string): untyped =
|
||||
result = nnkCaseStmt.newTree(val,
|
||||
nnkElse.newTree(quote do: echo "else"),
|
||||
nnkOfBranch.newTree(newLit("miauz"), quote do: echo "first branch"))
|
||||
|
||||
genCase("miauz")
|
||||
Loading…
Add table
Add a link
Reference in a new issue