mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 19:58:18 +00:00
Treat untyped suffixed functions as effectful
This commit is contained in:
parent
af6fc6306f
commit
cfc4be5254
25 changed files with 139 additions and 21 deletions
|
@ -780,6 +780,12 @@ trait DerivableVisitor {
|
|||
}
|
||||
EmptyRecord => Self::visit_empty_record(var)?,
|
||||
EmptyTagUnion => Self::visit_empty_tag_union(var)?,
|
||||
EffectfulFunc => {
|
||||
return Err(NotDerivable {
|
||||
var,
|
||||
context: NotDerivableContext::NoContext,
|
||||
})
|
||||
}
|
||||
},
|
||||
Alias(
|
||||
Symbol::NUM_NUM | Symbol::NUM_INTEGER,
|
||||
|
|
|
@ -187,7 +187,7 @@ fn deep_copy_var_help(
|
|||
Func(new_arguments, new_closure_var, new_ret_var, new_fx_var)
|
||||
}
|
||||
|
||||
same @ EmptyRecord | same @ EmptyTagUnion => same,
|
||||
same @ (EmptyRecord | EmptyTagUnion | EffectfulFunc) => same,
|
||||
|
||||
Record(fields, ext_var) => {
|
||||
let record_fields = {
|
||||
|
|
|
@ -1660,7 +1660,8 @@ fn solve_suffix_fx(
|
|||
}
|
||||
}
|
||||
Content::FlexVar(_) => {
|
||||
// [purity-inference] TODO: Require effectful fn
|
||||
env.subs
|
||||
.set_content(variable, Content::Structure(FlatType::EffectfulFunc));
|
||||
}
|
||||
_ => {}
|
||||
},
|
||||
|
@ -2379,6 +2380,8 @@ fn adjust_rank_content(
|
|||
// THEORY: an empty tag never needs to get generalized
|
||||
EmptyTagUnion => Rank::toplevel(),
|
||||
|
||||
EffectfulFunc => Rank::toplevel(),
|
||||
|
||||
Record(fields, ext_var) => {
|
||||
let mut rank = adjust_rank(subs, young_mark, visit_mark, group_rank, *ext_var);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue