diff --git a/src/Zcu/PerThread.zig b/src/Zcu/PerThread.zig index bfcf8dca46a25500bda95171d37dfa4a27710fed..d63b4778c1d5c075237f3fc9d62112fc9916974a 100644 --- a/src/Zcu/PerThread.zig +++ b/src/Zcu/PerThread.zig @@ -2709,7 +2709,7 @@ fn computeAliveFiles(pt: Zcu.PerThread) Allocator.Error!bool { // have a huge number of them by transitive imports, so just reporting this one // hopefully keeps the error focused. zcu.multi_module_err = .{ - .file = file_idx, + .file = res.file, .modules = .{ imported_file.mod.?, imported_mod }, .refs = .{ gop.value_ptr.*, imported_ref }, }; diff --git a/test/compile_errors.zig b/test/compile_errors.zig index 8b4e97520a88039fd1e7591d395cca98488114c4..71418076c93b92818ea92a493981a72299f3239c 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -126,10 +126,10 @@ pub fn addCases(ctx: *Cases, b: *std.Build) !void { \\ _ = @import("foo.zig"); \\} , &[_][]const u8{ - ":1:1: error: file exists in modules 'foo' and 'root'", - ":1:1: note: files must belong to only one module", - ":1:1: note: file is the root of module 'foo'", - ":3:17: note: file is imported here by the root of module 'root'", + "foo.zig:1:1: error: file exists in modules 'foo' and 'root'", + "foo.zig:1:1: note: files must belong to only one module", + "foo.zig:1:1: note: file is the root of module 'foo'", + "tmp.zig:3:17: note: file is imported here by the root of module 'root'", }); case.addSourceFile("foo.zig", \\const dummy = 0; diff --git a/test/incremental/change_module b/test/incremental/change_module index 4e573eecac23bd86de3bfe3df850585dbb7a8a77..73129f9eec6db02e446ff663c5600ffac2345994 100644 --- a/test/incremental/change_module +++ b/test/incremental/change_module @@ -43,8 +43,8 @@ pub fn main() void { comptime { _ = @import("other.zig"); } -#expect_error=foo.zig:1:1: error: file exists in modules 'root' and 'foo' -#expect_error=foo.zig:1:1: note: files must belong to only one module +#expect_error=other.zig:1:1: error: file exists in modules 'root' and 'foo' +#expect_error=other.zig:1:1: note: files must belong to only one module #expect_error=main.zig:3:17: note: file is imported here by the root of module 'root' #expect_error=foo.zig:2:17: note: file is imported here by the root of module 'foo'