Add test marks
This commit is contained in:
parent
0ce05633a1
commit
c1f47c3788
@ -11,4 +11,9 @@ test_utils::marks!(
|
|||||||
match_ergonomics_ref
|
match_ergonomics_ref
|
||||||
trait_resolution_on_fn_type
|
trait_resolution_on_fn_type
|
||||||
infer_while_let
|
infer_while_let
|
||||||
|
match_complex_arm_ty
|
||||||
|
match_first_arm_never
|
||||||
|
match_second_arm_never
|
||||||
|
match_all_arms_never
|
||||||
|
match_no_never_arms
|
||||||
);
|
);
|
||||||
|
@ -1096,8 +1096,10 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
|
|||||||
}
|
}
|
||||||
let arm_ty = self.infer_expr(arm.expr, &expected);
|
let arm_ty = self.infer_expr(arm.expr, &expected);
|
||||||
if all_arms_never && Self::is_never(&arm_ty) {
|
if all_arms_never && Self::is_never(&arm_ty) {
|
||||||
|
tested_by!(match_first_arm_never);
|
||||||
resulting_match_ty = Some(arm_ty);
|
resulting_match_ty = Some(arm_ty);
|
||||||
} else {
|
} else {
|
||||||
|
tested_by!(match_second_arm_never);
|
||||||
all_arms_never = false;
|
all_arms_never = false;
|
||||||
resulting_match_ty = None;
|
resulting_match_ty = None;
|
||||||
}
|
}
|
||||||
@ -1106,10 +1108,13 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
|
|||||||
if let (Ty::Infer(expected_tv), Some(match_ty)) =
|
if let (Ty::Infer(expected_tv), Some(match_ty)) =
|
||||||
(&expected.ty, &resulting_match_ty)
|
(&expected.ty, &resulting_match_ty)
|
||||||
{
|
{
|
||||||
|
tested_by!(match_all_arms_never);
|
||||||
self.var_unification_table
|
self.var_unification_table
|
||||||
.union_value(expected_tv.to_inner(), TypeVarValue::Known(match_ty.clone()));
|
.union_value(expected_tv.to_inner(), TypeVarValue::Known(match_ty.clone()));
|
||||||
match_ty.clone()
|
match_ty.clone()
|
||||||
} else {
|
} else {
|
||||||
|
tested_by!(match_no_never_arms);
|
||||||
|
tested_by!(match_complex_arm_ty);
|
||||||
expected.ty
|
expected.ty
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3595,12 +3595,13 @@ fn no_such_field_diagnostics() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod match_with_never_tests {
|
mod match_with_never_tests {
|
||||||
use super::type_at;
|
use super::type_at;
|
||||||
|
use test_utils::covers;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn match_complex_arm_ty() {
|
fn match_complex_arm_ty() {
|
||||||
|
covers!(match_complex_arm_ty);
|
||||||
let t = type_at(
|
let t = type_at(
|
||||||
r#"
|
r#"
|
||||||
//- /main.rs
|
//- /main.rs
|
||||||
@ -3624,6 +3625,7 @@ fn test(a: i32) {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn match_first_arm_never() {
|
fn match_first_arm_never() {
|
||||||
|
covers!(match_first_arm_never);
|
||||||
let t = type_at(
|
let t = type_at(
|
||||||
r#"
|
r#"
|
||||||
//- /main.rs
|
//- /main.rs
|
||||||
@ -3644,6 +3646,7 @@ fn test(a: i32) {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn match_second_arm_never() {
|
fn match_second_arm_never() {
|
||||||
|
covers!(match_second_arm_never);
|
||||||
let t = type_at(
|
let t = type_at(
|
||||||
r#"
|
r#"
|
||||||
//- /main.rs
|
//- /main.rs
|
||||||
@ -3664,6 +3667,7 @@ fn test(a: i32) {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn match_all_arms_never() {
|
fn match_all_arms_never() {
|
||||||
|
covers!(match_all_arms_never);
|
||||||
let t = type_at(
|
let t = type_at(
|
||||||
r#"
|
r#"
|
||||||
//- /main.rs
|
//- /main.rs
|
||||||
@ -3682,6 +3686,7 @@ fn test(a: i32) {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn match_no_never_arms() {
|
fn match_no_never_arms() {
|
||||||
|
covers!(match_no_never_arms);
|
||||||
let t = type_at(
|
let t = type_at(
|
||||||
r#"
|
r#"
|
||||||
//- /main.rs
|
//- /main.rs
|
||||||
|
Loading…
x
Reference in New Issue
Block a user