compiler: allow @import of ZON without a result type

In particular, this allows importing `build.zig.zon` at comptime.
This commit is contained in:
Mason Remaley
2025-02-15 15:42:59 -08:00
committed by mlugg
parent 1b62a22268
commit 06ee383da9
11 changed files with 302 additions and 37 deletions

View File

@@ -0,0 +1,9 @@
export fn entry() void {
_ = @import("zon/inf.zon");
}
// error
// imports=zon/inf.zon
//
// inf.zon:1:1: error: infinity requires a known result type
// tmp.zig:2:17: note: imported here

View File

@@ -0,0 +1,9 @@
export fn entry() void {
_ = @import("zon/nan.zon");
}
// error
// imports=zon/nan.zon
//
// nan.zon:1:1: error: NaN requires a known result type
// tmp.zig:2:17: note: imported here

View File

@@ -0,0 +1,9 @@
export fn entry() void {
_ = @import("zon/neg_inf.zon");
}
// error
// imports=zon/neg_inf.zon
//
// neg_inf.zon:1:1: error: negative infinity requires a known result type
// tmp.zig:2:17: note: imported here

View File

@@ -1,9 +0,0 @@
export fn entry() void {
const f = @import("zon/simple_union.zon");
_ = f;
}
// error
// imports=zon/simple_union.zon
//
// tmp.zig:2:23: error: '@import' of ZON must have a known result type