| ... | @@ -28340,8 +28340,16 @@ fn resolvePeerTypes( | ... | @@ -28340,8 +28340,16 @@ fn resolvePeerTypes( |
| 28340 | const candidate_ty_tag = try candidate_ty.zigTypeTagOrPoison(); | 28340 | const candidate_ty_tag = try candidate_ty.zigTypeTagOrPoison(); |
| 28341 | const chosen_ty_tag = try chosen_ty.zigTypeTagOrPoison(); | 28341 | const chosen_ty_tag = try chosen_ty.zigTypeTagOrPoison(); |
| 28342 | | 28342 | |
| 28343 | if (candidate_ty.eql(chosen_ty, sema.mod)) | 28343 | // If the candidate can coerce into our chosen type, we're done. |
| | 28344 | // If the chosen type can coerce into the candidate, use that. |
| | 28345 | if ((try sema.coerceInMemoryAllowed(block, chosen_ty, candidate_ty, false, target, src, src)) == .ok) { |
| | 28346 | continue; |
| | 28347 | } |
| | 28348 | if ((try sema.coerceInMemoryAllowed(block, candidate_ty, chosen_ty, false, target, src, src)) == .ok) { |
| | 28349 | chosen = candidate; |
| | 28350 | chosen_i = candidate_i + 1; |
| 28344 | continue; | 28351 | continue; |
| | 28352 | } |
| 28345 | | 28353 | |
| 28346 | switch (candidate_ty_tag) { | 28354 | switch (candidate_ty_tag) { |
| 28347 | .NoReturn, .Undefined => continue, | 28355 | .NoReturn, .Undefined => continue, |
| ... | @@ -28741,17 +28749,6 @@ fn resolvePeerTypes( | ... | @@ -28741,17 +28749,6 @@ fn resolvePeerTypes( |
| 28741 | else => {}, | 28749 | else => {}, |
| 28742 | } | 28750 | } |
| 28743 | | 28751 | |
| 28744 | // If the candidate can coerce into our chosen type, we're done. | | |
| 28745 | // If the chosen type can coerce into the candidate, use that. | | |
| 28746 | if ((try sema.coerceInMemoryAllowed(block, chosen_ty, candidate_ty, false, target, src, src)) == .ok) { | | |
| 28747 | continue; | | |
| 28748 | } | | |
| 28749 | if ((try sema.coerceInMemoryAllowed(block, candidate_ty, chosen_ty, false, target, src, src)) == .ok) { | | |
| 28750 | chosen = candidate; | | |
| 28751 | chosen_i = candidate_i + 1; | | |
| 28752 | continue; | | |
| 28753 | } | | |
| 28754 | | | |
| 28755 | // At this point, we hit a compile error. We need to recover | 28752 | // At this point, we hit a compile error. We need to recover |
| 28756 | // the source locations. | 28753 | // the source locations. |
| 28757 | const chosen_src = candidate_srcs.resolve( | 28754 | const chosen_src = candidate_srcs.resolve( |