mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 00:01:16 +00:00
constrain the default
This commit is contained in:
parent
d779e68773
commit
1f55355ee0
2 changed files with 31 additions and 1 deletions
|
@ -2641,4 +2641,32 @@ mod solve_expr {
|
|||
"{ x : Num a, y ? Num a }* -> Num a",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn optional_field_let() {
|
||||
infer_eq_without_problem(
|
||||
indoc!(
|
||||
r#"
|
||||
{ x, y ? 0 } = { x: 32 }
|
||||
|
||||
x + y
|
||||
"#
|
||||
),
|
||||
"Num *",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn optional_field_when() {
|
||||
infer_eq_without_problem(
|
||||
indoc!(
|
||||
r#"
|
||||
\r ->
|
||||
when r is
|
||||
{ x, y ? 0 } -> x + y
|
||||
"#
|
||||
),
|
||||
"{ x : Num a, y ? Num a }* -> Num a",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue