mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 05:49:08 +00:00
Ambient lambda set unification means we can have nice things again
This commit is contained in:
parent
640ca78bc5
commit
89e356b5eb
3 changed files with 31 additions and 2 deletions
|
@ -123,7 +123,10 @@ impl Phase for LatePhase<'_> {
|
|||
|
||||
let copied = module_types
|
||||
.storage_subs
|
||||
.export_variable_to(target_subs, ambient_function);
|
||||
// TODO: I think this is always okay, but revisit later when we're in a more
|
||||
// stable position to see if we can get rid of the bookkeeping done as a result
|
||||
// of this.
|
||||
.export_variable_to_directly_to_use_site(target_subs, ambient_function);
|
||||
let our_ambient_function_var = copied.variable;
|
||||
|
||||
debug_assert!(matches!(
|
||||
|
|
|
@ -1131,8 +1131,9 @@ fn resolve_lambda_set(subs: &Subs, mut var: Variable) -> ResolvedLambdaSet {
|
|||
}) => {
|
||||
debug_assert!(
|
||||
unspecialized.is_empty(),
|
||||
"unspecialized lambda sets left over during resolution: {:?}",
|
||||
"unspecialized lambda sets left over during resolution: {:?}, {:?}",
|
||||
roc_types::subs::SubsFmtContent(subs.get_content_without_compacting(var), subs),
|
||||
subs.uls_of_var
|
||||
);
|
||||
roc_types::pretty_print::push_union(subs, solved, &mut set);
|
||||
return ResolvedLambdaSet::Set(set);
|
||||
|
|
|
@ -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
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue