mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
Typecheck and compile opaque wrapping functions
This enables you to write something like ``` A := U8 List.map [1, 2, 3] @A ``` which will be compiled as if it was `List.map [1, 2, 3] \x -> @A x`. Closes #3499
This commit is contained in:
parent
d889f1fda9
commit
f1a6ea6a40
9 changed files with 360 additions and 15 deletions
|
@ -7341,4 +7341,30 @@ mod solve_expr {
|
|||
"Rose I64",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn opaque_wrap_function() {
|
||||
infer_eq_without_problem(
|
||||
indoc!(
|
||||
r#"
|
||||
A := U8
|
||||
List.map [1, 2, 3] @A
|
||||
"#
|
||||
),
|
||||
"List A",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn opaque_wrap_function_with_inferred_arg() {
|
||||
infer_eq_without_problem(
|
||||
indoc!(
|
||||
r#"
|
||||
A a := a
|
||||
List.map [1u8, 2u8, 3u8] @A
|
||||
"#
|
||||
),
|
||||
"List (A U8)",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue