mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
Merge branch 'main' of github.com:roc-lang/roc into wasm_interp_test_gen
This commit is contained in:
commit
d389601035
61 changed files with 1506 additions and 537 deletions
|
@ -4107,3 +4107,41 @@ fn issue_4349() {
|
|||
RocStr
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
fn issue_4712() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
app "test" provides [main] to "./platform"
|
||||
|
||||
Parser a : {} -> a
|
||||
|
||||
v1 : {}
|
||||
v1 = {}
|
||||
|
||||
v2 : Str
|
||||
v2 = "cd"
|
||||
|
||||
apply : Parser (a -> Str), a -> Parser Str
|
||||
apply = \fnParser, valParser ->
|
||||
\{} ->
|
||||
(fnParser {}) (valParser)
|
||||
|
||||
map : a, (a -> Str) -> Parser Str
|
||||
map = \simpleParser, transform ->
|
||||
apply (\{} -> transform) simpleParser
|
||||
|
||||
gen = \{} ->
|
||||
[ map v1 (\{} -> "ab"), map v2 (\s -> s) ]
|
||||
|> List.map (\f -> f {})
|
||||
|> Str.joinWith ","
|
||||
|
||||
main = gen {}
|
||||
"#
|
||||
),
|
||||
RocStr::from("ab,cd"),
|
||||
RocStr
|
||||
);
|
||||
}
|
||||
|
|
|
@ -2083,3 +2083,53 @@ fn unify_types_with_fixed_fixpoints_outside_fixing_region() {
|
|||
RocStr
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
fn lambda_set_with_imported_toplevels_issue_4733() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
app "test" provides [main] to "./platform"
|
||||
|
||||
fn = \s ->
|
||||
instr = if s == "*" then (Op Num.mul) else (Op Num.add)
|
||||
|
||||
Op op = instr
|
||||
|
||||
\a -> op a a
|
||||
|
||||
main = ((fn "*") 3) * ((fn "+") 5)
|
||||
"#
|
||||
),
|
||||
90,
|
||||
i64
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
fn non_unary_union_with_lambda_set_with_imported_toplevels_issue_4733() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
app "test" provides [main] to "./platform"
|
||||
|
||||
fn = \s ->
|
||||
instr =
|
||||
if s == "*" then (Op Num.mul)
|
||||
else if s == "+" then (Op Num.add)
|
||||
else Noop
|
||||
|
||||
when instr is
|
||||
Op op -> (\a -> op a a)
|
||||
_ -> (\a -> a)
|
||||
|
||||
|
||||
main = ((fn "*") 3) * ((fn "+") 5)
|
||||
"#
|
||||
),
|
||||
90,
|
||||
i64
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue