Ambient lambda set unification means we can have nice things again

This commit is contained in:
Ayaz Hafiz 2022-07-06 12:57:37 -04:00
parent 640ca78bc5
commit 89e356b5eb
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
3 changed files with 31 additions and 2 deletions

View file

@ -353,3 +353,28 @@ fn encode_use_stdlib() {
RocStr
)
}
#[test]
#[cfg(any(feature = "gen-llvm"))]
fn encode_use_stdlib_without_wrapping_custom() {
assert_evals_to!(
indoc!(
r#"
app "test"
imports [Encode.{ toEncoder }, Json]
provides [main] to "./platform"
HelloWorld := {}
toEncoder = \@HelloWorld {} -> Encode.string "Hello, World!\n"
main =
result = Str.fromUtf8 (Encode.toBytes (@HelloWorld {}) Json.format)
when result is
Ok s -> s
_ -> "<bad>"
"#
),
RocStr::from("\"Hello, World!\n\""),
RocStr
)
}