diff options
author | Bung <crc32@qq.com> | 2022-11-23 03:08:17 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-22 20:08:17 +0100 |
commit | 8cfce70738de2d488b621e6936e6398bfbe0a3ce (patch) | |
tree | 5e99bfa8de4c107c44e6c3d7e0cb8a67786a2ff4 /tests/casestmt/t18964.nim | |
parent | 0448f30fd9c2e53084ee8b284f6fa24684661bc3 (diff) | |
download | Nim-8cfce70738de2d488b621e6936e6398bfbe0a3ce.tar.gz |
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
Diffstat (limited to 'tests/casestmt/t18964.nim')
-rw-r--r-- | tests/casestmt/t18964.nim | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/casestmt/t18964.nim b/tests/casestmt/t18964.nim new file mode 100644 index 000000000..1d2de2bbc --- /dev/null +++ b/tests/casestmt/t18964.nim @@ -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") |