Files
Nim/tests/casestmt/t18964.nim
Bung 8cfce70738 fix #18964 Small string case with else statement first in AST evaluat… (#20862)
fix #18964 Small string case with else statement first in AST evaluates wrongly
2022-11-22 20:08:17 +01:00

13 lines
284 B
Nim

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")