Sema: explain why we tried to call an extern fn at comptime

I recently saw a user hit the "comptime call of extern function" error,
and get confused because they didn't know why the scope was `comptime`.
So, use `explainWhyBlockIsComptime` on this and related errors to add
all the relevant notes.

The added test case shows the motivating situation.
This commit is contained in:
mlugg
2025-01-29 06:39:29 +00:00
committed by Matthew Lugg
parent 484f72311e
commit 107b65ec5d
8 changed files with 78 additions and 13 deletions

View File

@@ -11,4 +11,5 @@ export fn entry1() void {
// error
//
// :4:15: error: comptime call of extern function
// :4:5: note: 'comptime' keyword forces comptime evaluation
// :8:5: error: inline call of extern function