@@ -2477,6 +2477,18 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
24772477 assert (file .zir_loaded );
24782478 const decl_inst = file .zir .instructions .get (@intFromEnum (inst_info .inst ));
24792479 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+
24802492 const tree = try file .getTree (dwarf .gpa );
24812493 const loc = tree .tokenLocation (0 , tree .nodes .items (.main_token )[decl_inst .data .declaration .src_node ]);
24822494 assert (loc .line == zcu .navSrcLine (nav_index ));
@@ -2582,7 +2594,6 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
25822594 if (loaded_struct .zir_index == .none ) break :decl_struct ;
25832595
25842596 const value_inst = value_inst : {
2585- const decl_extra = file .zir .extraData (Zir .Inst .Declaration , decl_inst .data .declaration .payload_index );
25862597 const decl_value_body = decl_extra .data .getBodies (@intCast (decl_extra .end ), file .zir ).value_body ;
25872598 const break_inst = file .zir .instructions .get (@intFromEnum (decl_value_body [decl_value_body .len - 1 ]));
25882599 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
27042715 if (loaded_enum .zir_index == .none ) break :decl_enum ;
27052716
27062717 const value_inst = value_inst : {
2707- const decl_extra = file .zir .extraData (Zir .Inst .Declaration , decl_inst .data .declaration .payload_index );
27082718 const decl_value_body = decl_extra .data .getBodies (@intCast (decl_extra .end ), file .zir ).value_body ;
27092719 const break_inst = file .zir .instructions .get (@intFromEnum (decl_value_body [decl_value_body .len - 1 ]));
27102720 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
27882798
27892799 decl_union : {
27902800 const value_inst = value_inst : {
2791- const decl_extra = file .zir .extraData (Zir .Inst .Declaration , decl_inst .data .declaration .payload_index );
27922801 const decl_value_body = decl_extra .data .getBodies (@intCast (decl_extra .end ), file .zir ).value_body ;
27932802 const break_inst = file .zir .instructions .get (@intFromEnum (decl_value_body [decl_value_body .len - 1 ]));
27942803 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
29112920
29122921 decl_opaque : {
29132922 const value_inst = value_inst : {
2914- const decl_extra = file .zir .extraData (Zir .Inst .Declaration , decl_inst .data .declaration .payload_index );
29152923 const decl_value_body = decl_extra .data .getBodies (@intCast (decl_extra .end ), file .zir ).value_body ;
29162924 const break_inst = file .zir .instructions .get (@intFromEnum (decl_value_body [decl_value_body .len - 1 ]));
29172925 if (break_inst .tag != .break_inline ) break :value_inst null ;
0 commit comments