@@ -2477,6 +2477,18 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
2477
2477
assert (file .zir_loaded );
2478
2478
const decl_inst = file .zir .instructions .get (@intFromEnum (inst_info .inst ));
2479
2479
assert (decl_inst .tag == .declaration );
2480
+ const decl_extra = file .zir .extraData (Zir .Inst .Declaration , decl_inst .data .declaration .payload_index );
2481
+
2482
+ const is_test = switch (decl_extra .data .name ) {
2483
+ .unnamed_test , .decltest = > true ,
2484
+ .@"comptime" , .@"usingnamespace" = > false ,
2485
+ _ = > decl_extra .data .name .isNamedTest (file .zir ),
2486
+ };
2487
+ if (is_test ) {
2488
+ // This isn't actually a comptime Nav! It's a test, so it'll definitely never be referenced at comptime.
2489
+ return ;
2490
+ }
2491
+
2480
2492
const tree = try file .getTree (dwarf .gpa );
2481
2493
const loc = tree .tokenLocation (0 , tree .nodes .items (.main_token )[decl_inst .data .declaration .src_node ]);
2482
2494
assert (loc .line == zcu .navSrcLine (nav_index ));
@@ -2582,7 +2594,6 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
2582
2594
if (loaded_struct .zir_index == .none ) break :decl_struct ;
2583
2595
2584
2596
const value_inst = value_inst : {
2585
- const decl_extra = file .zir .extraData (Zir .Inst .Declaration , decl_inst .data .declaration .payload_index );
2586
2597
const decl_value_body = decl_extra .data .getBodies (@intCast (decl_extra .end ), file .zir ).value_body ;
2587
2598
const break_inst = file .zir .instructions .get (@intFromEnum (decl_value_body [decl_value_body .len - 1 ]));
2588
2599
if (break_inst .tag != .break_inline ) break :value_inst null ;
@@ -2704,7 +2715,6 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
2704
2715
if (loaded_enum .zir_index == .none ) break :decl_enum ;
2705
2716
2706
2717
const value_inst = value_inst : {
2707
- const decl_extra = file .zir .extraData (Zir .Inst .Declaration , decl_inst .data .declaration .payload_index );
2708
2718
const decl_value_body = decl_extra .data .getBodies (@intCast (decl_extra .end ), file .zir ).value_body ;
2709
2719
const break_inst = file .zir .instructions .get (@intFromEnum (decl_value_body [decl_value_body .len - 1 ]));
2710
2720
if (break_inst .tag != .break_inline ) break :value_inst null ;
@@ -2788,7 +2798,6 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
2788
2798
2789
2799
decl_union : {
2790
2800
const value_inst = value_inst : {
2791
- const decl_extra = file .zir .extraData (Zir .Inst .Declaration , decl_inst .data .declaration .payload_index );
2792
2801
const decl_value_body = decl_extra .data .getBodies (@intCast (decl_extra .end ), file .zir ).value_body ;
2793
2802
const break_inst = file .zir .instructions .get (@intFromEnum (decl_value_body [decl_value_body .len - 1 ]));
2794
2803
if (break_inst .tag != .break_inline ) break :value_inst null ;
@@ -2911,7 +2920,6 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
2911
2920
2912
2921
decl_opaque : {
2913
2922
const value_inst = value_inst : {
2914
- const decl_extra = file .zir .extraData (Zir .Inst .Declaration , decl_inst .data .declaration .payload_index );
2915
2923
const decl_value_body = decl_extra .data .getBodies (@intCast (decl_extra .end ), file .zir ).value_body ;
2916
2924
const break_inst = file .zir .instructions .get (@intFromEnum (decl_value_body [decl_value_body .len - 1 ]));
2917
2925
if (break_inst .tag != .break_inline ) break :value_inst null ;
0 commit comments