mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-05 19:34:12 +00:00
fix #18964 Small string case with else statement first in AST evaluates wrongly
This commit is contained in:
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")
|
||||
Reference in New Issue
Block a user