about summary refs log tree commit diff
path: root/tests/ui/parser/expr-as-stmt-2.rs
blob: 4b1f62d8056df3654933e6c7e465c1acec1924c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// This is not autofixable because we give extra suggestions to end the first expression with `;`.
fn foo(a: Option<u32>, b: Option<u32>) -> bool {
    if let Some(x) = a { true } else { false }
    //~^ ERROR mismatched types
    //~| ERROR mismatched types
    && //~ ERROR mismatched types
    if let Some(y) = a { true } else { false }
}

fn bar() -> bool {
    false
}

fn main() {
    if true { true } else { false } && true;
    //~^ ERROR mismatched types
    //~| ERROR mismatched types
    if true { true } else { false } && if true { true } else { false };
    //~^ ERROR mismatched types
    //~| ERROR mismatched types
    if true { true } else { false } if true { true } else { false };
    //~^ ERROR mismatched types
    //~| ERROR mismatched types
    if true { bar() } else { bar() } && if true { bar() } else { bar() };
    //~^ ERROR mismatched types
    //~| ERROR mismatched types
    if true { bar() } else { bar() } if true { bar() } else { bar() };
    //~^ ERROR mismatched types
    //~| ERROR mismatched types
    let _ = if true { true } else { false } && true; // ok
}