nim-works / nimskull

An in development statically typed systems programming language; with sustainability at its core. We, the community of users, maintain it.
https://nim-works.github.io/nimskull/index.html
Other
279 stars 39 forks source link

Compiler crash on compile-time NimNode variable as a `static NimNode` param to macros. #1448

Closed Luyten-Orion closed 2 months ago

Luyten-Orion commented 2 months ago

Example

import std/macros

var myNode {.compileTime.} = newStmtList()

macro test(n: static NimNode) = discard

myNode.test()

Actual Output

fatal.nim(50)            sysFatal
Error: unhandled exception: mirgen.nim(2501, 18) unreachable: nkNimNodeLit [AssertionDefect]

Expected Output

The compiler should allow this as valid code.

Luyten-Orion commented 2 months ago

nim_dbg output for convenience: https://paste.ecorous.org/bixarokipe.apache