aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/tests/coercion.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_ty/src/tests/coercion.rs')
-rw-r--r--crates/hir_ty/src/tests/coercion.rs17
1 files changed, 16 insertions, 1 deletions
diff --git a/crates/hir_ty/src/tests/coercion.rs b/crates/hir_ty/src/tests/coercion.rs
index 190471069..67295b663 100644
--- a/crates/hir_ty/src/tests/coercion.rs
+++ b/crates/hir_ty/src/tests/coercion.rs
@@ -1,6 +1,6 @@
1use expect_test::expect; 1use expect_test::expect;
2 2
3use super::{check_infer, check_infer_with_mismatches}; 3use super::{check_infer, check_infer_with_mismatches, check_types};
4 4
5#[test] 5#[test]
6fn infer_block_expr_type_mismatch() { 6fn infer_block_expr_type_mismatch() {
@@ -858,3 +858,18 @@ fn coerce_unsize_generic() {
858 "]], 858 "]],
859 ); 859 );
860} 860}
861
862#[test]
863fn infer_two_closures_lub() {
864 check_types(
865 r#"
866fn foo(c: i32) {
867 let add = |a: i32, b: i32| a + b;
868 let sub = |a, b| a - b;
869 //^ |i32, i32| -> i32
870 if c > 42 { add } else { sub };
871 //^ fn(i32, i32) -> i32
872}
873 "#,
874 )
875}