mirror of
https://github.com/roc-lang/roc.git
synced 2024-09-22 00:09:33 +03:00
Mark patterns in lambda argument position as having a presence constraint
Closes #2299
This commit is contained in:
parent
aaa041cee5
commit
fda6c70835
@ -77,7 +77,7 @@ fn constrain_untyped_args(
|
||||
loc_pattern.region,
|
||||
pattern_expected,
|
||||
&mut pattern_state,
|
||||
false,
|
||||
true,
|
||||
);
|
||||
|
||||
vars.push(*pattern_var);
|
||||
|
@ -1327,7 +1327,7 @@ mod solve_expr {
|
||||
\Foo -> 42
|
||||
"#
|
||||
),
|
||||
"[ Foo ]* -> Num *",
|
||||
"[ Foo ] -> Num *",
|
||||
);
|
||||
}
|
||||
|
||||
@ -1339,7 +1339,7 @@ mod solve_expr {
|
||||
\@Foo -> 42
|
||||
"#
|
||||
),
|
||||
"[ @Foo ]* -> Num *",
|
||||
"[ @Foo ] -> Num *",
|
||||
);
|
||||
}
|
||||
|
||||
@ -1419,7 +1419,7 @@ mod solve_expr {
|
||||
\Foo x -> Foo x
|
||||
"#
|
||||
),
|
||||
"[ Foo a ]* -> [ Foo a ]*",
|
||||
"[ Foo a ] -> [ Foo a ]*",
|
||||
);
|
||||
}
|
||||
|
||||
@ -1431,7 +1431,7 @@ mod solve_expr {
|
||||
\Foo x _ -> Foo x "y"
|
||||
"#
|
||||
),
|
||||
"[ Foo a * ]* -> [ Foo a Str ]*",
|
||||
"[ Foo a * ] -> [ Foo a Str ]*",
|
||||
);
|
||||
}
|
||||
|
||||
@ -4909,4 +4909,17 @@ mod solve_expr {
|
||||
"{ x : [ Blue, Red ], y ? Num a }* -> Num a",
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
// Issue #2299
|
||||
fn infer_union_argument_position() {
|
||||
infer_eq_without_problem(
|
||||
indoc!(
|
||||
r#"
|
||||
\UserId id -> id + 1
|
||||
"#
|
||||
),
|
||||
"[ UserId (Num a) ] -> Num a",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user