| author | |
| committer | |
| log | 3e084d8de352927dad182f99aeb3f166b348c192 |
| tree | 1476e9edc967d1475bd6f91d984cf6178c5b46ea |
| parent | 01dba1c054724b4957778932fb5cd0df14d214b3 |
Closes #139582 files changed, 12 insertions(+), 1 deletions(-)
src/Sema.zig+1-1| ... | ... | @@ -24477,7 +24477,7 @@ fn coerceExtra( |
| 24477 | 24477 | return block.addBitCast(dest_ty, inst); |
| 24478 | 24478 | } |
| 24479 | 24479 | |
| 24480 | const is_undef = if (maybe_inst_val) |val| val.isUndef() else false; | |
| 24480 | const is_undef = inst_ty.zigTypeTag() == .Undefined; | |
| 24481 | 24481 | |
| 24482 | 24482 | switch (dest_ty.zigTypeTag()) { |
| 24483 | 24483 | .Optional => optional: { |
test/cases/compile_errors/only_untyped_undef_coerces_to_all_types.zig created+11| ... | ... | @@ -0,0 +1,11 @@ |
| 1 | pub export fn entry() void { | |
| 2 | const x: []u8 = undefined; | |
| 3 | const y: f32 = x; | |
| 4 | _ = y; | |
| 5 | } | |
| 6 | ||
| 7 | // error | |
| 8 | // backend=stage2 | |
| 9 | // target=native | |
| 10 | // | |
| 11 | // :3:20: error: expected type 'f32', found '[]u8' |