Commit 2606498409

John Schmidt <john.schmidt.h@gmail.com>
2023-05-07 22:58:15
module: return null if no candidate src
Closes #15572.
1 parent 20cc693
Changed files (2)
src/Module.zig
@@ -6115,6 +6115,8 @@ pub const PeerTypeCandidateSrc = union(enum) {
                 return null;
             },
             .override => |candidate_srcs| {
+                if (candidate_i >= candidate_srcs.len)
+                    return null;
                 return candidate_srcs[candidate_i];
             },
             .typeof_builtin_call_node_offset => |node_offset| {
test/cases/compile_errors/issue_15572_break_on_inline_while.zig
@@ -0,0 +1,20 @@
+const std = @import("std");
+
+pub const DwarfSection = enum {
+    eh_frame,
+    eh_frame_hdr,
+};
+
+pub fn main() void {
+    const section = inline for (@typeInfo(DwarfSection).Enum.fields) |section| {
+        if (std.mem.eql(u8, section.name, "eh_frame")) break section;
+    };
+
+    _ = section;
+}
+
+// error
+// backend=stage2
+// target=native
+//
+// :9:28: error: incompatible types: 'builtin.Type.EnumField' and 'void'