| ... | ... | @@ -6639,9 +6639,9 @@ fn zirNegate( |
| 6639 | 6639 | defer tracy.end(); |
| 6640 | 6640 | |
| 6641 | 6641 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 6642 | | const src: LazySrcLoc = .{ .node_offset_bin_op = inst_data.src_node }; |
| 6643 | | const lhs_src: LazySrcLoc = .{ .node_offset_bin_lhs = inst_data.src_node }; |
| 6644 | | const rhs_src: LazySrcLoc = .{ .node_offset_bin_rhs = inst_data.src_node }; |
| 6642 | const src = inst_data.src(); |
| 6643 | const lhs_src = src; |
| 6644 | const rhs_src = src; // TODO better source location |
| 6645 | 6645 | const lhs = sema.resolveInst(.zero); |
| 6646 | 6646 | const rhs = sema.resolveInst(inst_data.operand); |
| 6647 | 6647 | |
| ... | ... | @@ -9909,7 +9909,8 @@ fn zirCDefine( |
| 9909 | 9909 | const src: LazySrcLoc = .{ .node_offset = extra.node }; |
| 9910 | 9910 | |
| 9911 | 9911 | const name = try sema.resolveConstString(block, src, extra.lhs); |
| 9912 | | if (sema.typeOf(extra.rhs).zigTypeTag() != .Void) { |
| 9912 | const rhs = sema.resolveInst(extra.rhs); |
| 9913 | if (sema.typeOf(rhs).zigTypeTag() != .Void) { |
| 9913 | 9914 | const value = try sema.resolveConstString(block, src, extra.rhs); |
| 9914 | 9915 | try block.c_import_buf.?.writer().print("#define {s} {s}\n", .{ name, value }); |
| 9915 | 9916 | } else { |
| ... | ... | @@ -12085,16 +12086,19 @@ fn resolvePeerTypes( |
| 12085 | 12086 | const chosen_ty = sema.typeOf(chosen); |
| 12086 | 12087 | if (candidate_ty.eql(chosen_ty)) |
| 12087 | 12088 | continue; |
| 12088 | | if (candidate_ty.zigTypeTag() == .NoReturn) |
| 12089 | const candidate_ty_tag = candidate_ty.zigTypeTag(); |
| 12090 | const chosen_ty_tag = chosen_ty.zigTypeTag(); |
| 12091 | |
| 12092 | if (candidate_ty_tag == .NoReturn) |
| 12089 | 12093 | continue; |
| 12090 | | if (chosen_ty.zigTypeTag() == .NoReturn) { |
| 12094 | if (chosen_ty_tag == .NoReturn) { |
| 12091 | 12095 | chosen = candidate; |
| 12092 | 12096 | chosen_i = candidate_i + 1; |
| 12093 | 12097 | continue; |
| 12094 | 12098 | } |
| 12095 | | if (candidate_ty.zigTypeTag() == .Undefined) |
| 12099 | if (candidate_ty_tag == .Undefined) |
| 12096 | 12100 | continue; |
| 12097 | | if (chosen_ty.zigTypeTag() == .Undefined) { |
| 12101 | if (chosen_ty_tag == .Undefined) { |
| 12098 | 12102 | chosen = candidate; |
| 12099 | 12103 | chosen_i = candidate_i + 1; |
| 12100 | 12104 | continue; |
| ... | ... | @@ -12117,30 +12121,41 @@ fn resolvePeerTypes( |
| 12117 | 12121 | continue; |
| 12118 | 12122 | } |
| 12119 | 12123 | |
| 12120 | | if (chosen_ty.zigTypeTag() == .ComptimeInt and candidate_ty.isInt()) { |
| 12124 | if (chosen_ty_tag == .ComptimeInt and candidate_ty.isInt()) { |
| 12121 | 12125 | chosen = candidate; |
| 12122 | 12126 | chosen_i = candidate_i + 1; |
| 12123 | 12127 | continue; |
| 12124 | 12128 | } |
| 12125 | 12129 | |
| 12126 | | if (chosen_ty.isInt() and candidate_ty.zigTypeTag() == .ComptimeInt) { |
| 12130 | if (chosen_ty.isInt() and candidate_ty_tag == .ComptimeInt) { |
| 12127 | 12131 | continue; |
| 12128 | 12132 | } |
| 12129 | 12133 | |
| 12130 | | if (chosen_ty.zigTypeTag() == .ComptimeFloat and candidate_ty.isRuntimeFloat()) { |
| 12134 | if ((chosen_ty_tag == .ComptimeFloat or chosen_ty_tag == .ComptimeInt) and |
| 12135 | candidate_ty.isRuntimeFloat()) |
| 12136 | { |
| 12131 | 12137 | chosen = candidate; |
| 12132 | 12138 | chosen_i = candidate_i + 1; |
| 12133 | 12139 | continue; |
| 12134 | 12140 | } |
| 12135 | | |
| 12136 | | if (chosen_ty.isRuntimeFloat() and candidate_ty.zigTypeTag() == .ComptimeFloat) { |
| 12141 | if (chosen_ty.isRuntimeFloat() and |
| 12142 | (candidate_ty_tag == .ComptimeFloat or candidate_ty_tag == .ComptimeInt)) |
| 12143 | { |
| 12137 | 12144 | continue; |
| 12138 | 12145 | } |
| 12139 | 12146 | |
| 12140 | | if (chosen_ty.zigTypeTag() == .Enum and candidate_ty.zigTypeTag() == .EnumLiteral) { |
| 12147 | if (chosen_ty_tag == .Enum and candidate_ty_tag == .EnumLiteral) { |
| 12141 | 12148 | continue; |
| 12142 | 12149 | } |
| 12143 | | if (chosen_ty.zigTypeTag() == .EnumLiteral and candidate_ty.zigTypeTag() == .Enum) { |
| 12150 | if (chosen_ty_tag == .EnumLiteral and candidate_ty_tag == .Enum) { |
| 12151 | chosen = candidate; |
| 12152 | chosen_i = candidate_i + 1; |
| 12153 | continue; |
| 12154 | } |
| 12155 | |
| 12156 | if (chosen_ty_tag == .ComptimeFloat and candidate_ty_tag == .ComptimeInt) |
| 12157 | continue; |
| 12158 | if (chosen_ty_tag == .ComptimeInt and candidate_ty_tag == .ComptimeFloat) { |
| 12144 | 12159 | chosen = candidate; |
| 12145 | 12160 | chosen_i = candidate_i + 1; |
| 12146 | 12161 | continue; |