Merge pull request #4745 from roc-lang/i4712

Ensure that disjoint nested lambda sets force parents to be disjoint
This commit is contained in:
Ayaz 2022-12-14 14:55:25 -06:00 committed by GitHub
commit 9b4e30a903
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 431 additions and 202 deletions

View file

@ -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
);
}