Treat untyped suffixed functions as effectful

This commit is contained in:
Agus Zubiaga 2024-10-23 22:33:57 -03:00
parent af6fc6306f
commit cfc4be5254
No known key found for this signature in database
25 changed files with 139 additions and 21 deletions

View file

@ -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,

View file

@ -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 = {

View file

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