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

using `NimNode` in run-time code crashes the compiler #1395

Open zerbina opened 3 months ago

zerbina commented 3 months ago

Using the NimNode type, either directly (e.g., as the type of a variable) or indirectly (e.g., by calling a procedure that returns a NimNode), in a run-time context crashes the compiler when building with --gc:arc or --gc:orc.

Example

# top-level code
var x: NimNode

Actual Output

compiler crashes with a segmentation fault

Expected Output

Error: cannot use `NimNode` in a non-compile-time-only context

Possible Solution

sem needs to report an error when a "triggers compile-time" type (such as NimNode) is used in a context that's not compile-time only.