You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
conststd=@import("std");
constx=@import("blablabla"); // this package does not exist and is not added to build.zigpubfnmain() !void {
std.debug.print("Somehow this compiles\n", .{});
}
Expected Behavior
The compilation fails as the package does not exist.
I noticed that this does fail when trying to do something with const x. If trying to use the package then the right error shows up:
error: no package named 'blablabla' available within package 'root'
const x = @import("blablabla");
^~~~~~~~~~~
Maybe a solution to avoid this case is detecting unused imports.
The text was updated successfully, but these errors were encountered:
clebs
added
the
bug
Observed behavior contradicts documented or intended behavior
label
Dec 5, 2022
I see, thanks for the clarification. I was confused because the code sample in that issue uses this statement: const mylib = @import("nonexistent");. So I assumed by importing a file, both files and packages were meant.
Zig Version
0.11.0-dev.231+476b94680
Steps to Reproduce and Observed Behavior
Compile an executable with this
main.zig
:Expected Behavior
The compilation fails as the package does not exist.
I noticed that this does fail when trying to do something with
const x
. If trying to use the package then the right error shows up:Maybe a solution to avoid this case is detecting unused imports.
The text was updated successfully, but these errors were encountered: