zig icon indicating copy to clipboard operation
zig copied to clipboard

Ast check error log order is non-deterministic

Open tauoverpi opened this issue 3 years ago • 0 comments

Zig Version

0.11.0-dev.18+81c27677d

Steps to Reproduce and Observed Behavior

Given two files with a missing identifier declaration, the error trace will differ in order between invocations of zig based on which thread finishes parsing first.

a.zig and b.zig:

pub fn f(x: u32) u32 {
    return x + index;
}

c.zig

const a = @import("a.zig");
const b = @import("b.zig");

Which results in the given trace:

(deck@steamdeck det)$ zig test c.zig 
b.zig:2:16: error: use of undeclared identifier 'index'
    return x + index;
               ^~~~~
a.zig:2:16: error: use of undeclared identifier 'index'
    return x + index;
               ^~~~~
(1)(deck@steamdeck det)$ zig test c.zig 
b.zig:2:16: error: use of undeclared identifier 'index'
    return x + index;
               ^~~~~
a.zig:2:16: error: use of undeclared identifier 'index'
    return x + index;
               ^~~~~
(1)(deck@steamdeck det)$ zig test c.zig 
a.zig:2:16: error: use of undeclared identifier 'index'
    return x + index;
               ^~~~~
b.zig:2:16: error: use of undeclared identifier 'index'
    return x + index;
               ^~~~~
(1)(deck@steamdeck det)$ zig test c.zig 
b.zig:2:16: error: use of undeclared identifier 'index'
    return x + index;
               ^~~~~
a.zig:2:16: error: use of undeclared identifier 'index'
    return x + index;
               ^~~~~

Expected Behavior

Errors to always show in the same order.

tauoverpi avatar Nov 02 '22 13:11 tauoverpi