Non-comptime local functions silently fail in a `comptime` context
Closed this issue · 0 comments
jfecher commented
Aim
Calling a non-comptime function in the same crate from within a comptime block:
fn main() {
comptime { foo(); }
}
fn foo() {
println("foo!");
}
Expected Behavior
An error since non-comptime functions in the same crate cannot be called from comptime contexts. This is because comptime items are elaborated before all non-comptime items.
Bug
The comptime interpreter will silently see only an empty block as the definition of foo
and nothing will be printed out.
To Reproduce
Project Impact
None
Impact Context
No response
Workaround
None
Workaround Description
No response
Additional Context
No response
Installation Method
None
Nargo Version
No response
NoirJS Version
No response
Would you like to submit a PR for this Issue?
None
Support Needs
No response