Resolve vars before emitting coerce error

This commit is contained in:
Michael Goulet 2022-08-04 03:05:57 +00:00
parent c62a8ea9df
commit 1f463ac407
11 changed files with 102 additions and 12 deletions

View file

@ -5,6 +5,11 @@ LL | let x = if true { 10i32 } else { 10u32 };
| ----- ^^^^^ expected `i32`, found `u32`
| |
| expected because of this
|
help: change the type of the numeric literal from `u32` to `i32`
|
LL | let x = if true { 10i32 } else { 10i32 };
| ~~~
error: aborting due to previous error

View file

@ -10,6 +10,11 @@ LL | | 2u32
| | ^^^^ expected `i32`, found `u32`
LL | | };
| |_____- `if` and `else` have incompatible types
|
help: change the type of the numeric literal from `u32` to `i32`
|
LL | 2i32
| ~~~
error[E0308]: `if` and `else` have incompatible types
--> $DIR/if-else-type-mismatch.rs:8:38
@ -18,6 +23,11 @@ LL | let _ = if true { 42i32 } else { 42u32 };
| ----- ^^^^^ expected `i32`, found `u32`
| |
| expected because of this
|
help: change the type of the numeric literal from `u32` to `i32`
|
LL | let _ = if true { 42i32 } else { 42i32 };
| ~~~
error[E0308]: `if` and `else` have incompatible types
--> $DIR/if-else-type-mismatch.rs:13:9