Open levovix0 opened 3 years ago
Compiling in static
section gives expected results (no action/crash at compile-time). In general NimNode
cannot be used at runtime, so I suspect it is a compiler bug instead, and has nothing to do with pattern matching itself (except it being able to trigger sempass failure. Just using newLit(0).kind
fails with "kind can only be used in compile-time context"
)
import macros, fusion/matching
{.experimental: "caseStmtMacros".}
static:
case newLit(0):
else:
discard
^ Simply compiles with no error, outputs "executed else"
but in macros it gives same error
import macros, fusion/matching
{.experimental: "caseStmtMacros".}
macro m =
case newLit 0
else: discard
m()
Fixed in #94 along with your example added to test suite.
current output
(stack trace from nim compiler, compiled without -d:release)
expected output compiles and do nothing