diff options
Diffstat (limited to 'crates/ra_hir_ty')
-rw-r--r-- | crates/ra_hir_ty/src/infer/coerce.rs | 4 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/tests/simple.rs | 2 |
2 files changed, 2 insertions, 4 deletions
diff --git a/crates/ra_hir_ty/src/infer/coerce.rs b/crates/ra_hir_ty/src/infer/coerce.rs index 2ee9adb16..32c7c57cd 100644 --- a/crates/ra_hir_ty/src/infer/coerce.rs +++ b/crates/ra_hir_ty/src/infer/coerce.rs | |||
@@ -45,9 +45,7 @@ impl<'a> InferenceContext<'a> { | |||
45 | self.coerce_merge_branch(&ptr_ty1, &ptr_ty2) | 45 | self.coerce_merge_branch(&ptr_ty1, &ptr_ty2) |
46 | } else { | 46 | } else { |
47 | mark::hit!(coerce_merge_fail_fallback); | 47 | mark::hit!(coerce_merge_fail_fallback); |
48 | // For incompatible types, we use the latter one as result | 48 | ty1.clone() |
49 | // to be better recovery for `if` without `else`. | ||
50 | ty2.clone() | ||
51 | } | 49 | } |
52 | } | 50 | } |
53 | } | 51 | } |
diff --git a/crates/ra_hir_ty/src/tests/simple.rs b/crates/ra_hir_ty/src/tests/simple.rs index f1db34160..839491b9e 100644 --- a/crates/ra_hir_ty/src/tests/simple.rs +++ b/crates/ra_hir_ty/src/tests/simple.rs | |||
@@ -957,7 +957,7 @@ fn main(foo: Foo) { | |||
957 | 51..107 'if tru... }': () | 957 | 51..107 'if tru... }': () |
958 | 54..58 'true': bool | 958 | 54..58 'true': bool |
959 | 59..67 '{ }': () | 959 | 59..67 '{ }': () |
960 | 73..107 'if fal... }': () | 960 | 73..107 'if fal... }': i32 |
961 | 76..81 'false': bool | 961 | 76..81 'false': bool |
962 | 82..107 '{ ... }': i32 | 962 | 82..107 '{ ... }': i32 |
963 | 92..95 'foo': Foo | 963 | 92..95 'foo': Foo |