Add another test
This commit is contained in:
parent
6f41053ede
commit
5cff355059
1 changed files with 20 additions and 0 deletions
|
@ -1094,3 +1094,23 @@ fn parse_arule() {
|
||||||
"#,
|
"#,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn call_expected_type_closure() {
|
||||||
|
check_types(
|
||||||
|
r#"
|
||||||
|
//- minicore: fn, option
|
||||||
|
|
||||||
|
fn map<T, U>(o: Option<T>, f: impl FnOnce(T) -> U) -> Option<U> { loop {} }
|
||||||
|
struct S {
|
||||||
|
field: u32
|
||||||
|
}
|
||||||
|
|
||||||
|
fn test() {
|
||||||
|
let o = Some(S { field: 2 });
|
||||||
|
let _: Option<()> = map(o, |s| { s.field; });
|
||||||
|
// ^^^^^^^ u32
|
||||||
|
}
|
||||||
|
"#,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue