mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 22:34:45 +00:00
constraint default unique
This commit is contained in:
parent
36574e6ff7
commit
ae966c8933
3 changed files with 123 additions and 9 deletions
|
@ -3075,4 +3075,44 @@ mod solve_uniq_expr {
|
|||
"Attr * { a : (Attr * { x : (Attr * (Num (Attr * a))), y : (Attr * Float), z : (Attr * c) }), b : (Attr * { blah : (Attr * Str), x : (Attr * (Num (Attr * a))), y : (Attr * Float), z : (Attr * c) }) }"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn optional_field_function() {
|
||||
infer_eq(
|
||||
indoc!(
|
||||
r#"
|
||||
\{ x, y ? 0 } -> x + y
|
||||
"#
|
||||
),
|
||||
"Attr * (Attr (* | b | c) { x : (Attr b (Num (Attr b a))), y ? (Attr c (Num (Attr c a))) }* -> Attr d (Num (Attr d a)))"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn optional_field_let() {
|
||||
infer_eq(
|
||||
indoc!(
|
||||
r#"
|
||||
{ x, y ? 0 } = { x: 32 }
|
||||
|
||||
x + y
|
||||
"#
|
||||
),
|
||||
"Attr a (Num (Attr a *))",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn optional_field_when() {
|
||||
infer_eq(
|
||||
indoc!(
|
||||
r#"
|
||||
\r ->
|
||||
when r is
|
||||
{ x, y ? 0 } -> x + y
|
||||
"#
|
||||
),
|
||||
"Attr * (Attr (* | b | c) { x : (Attr b (Num (Attr b a))), y ? (Attr c (Num (Attr c a))) }* -> Attr d (Num (Attr d a)))"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue