Mark flex fx vars as pure after solving body

This commit is contained in:
Agus Zubiaga 2024-10-22 00:19:22 -03:00
parent 89a918cebe
commit 2859829ea8
No known key found for this signature in database
3 changed files with 33 additions and 0 deletions

View file

@ -623,6 +623,7 @@ impl Constraints {
| Constraint::Pattern(..)
| Constraint::EffectfulStmt(..)
| Constraint::FxCall(_)
| Constraint::FlexToPure(_)
| Constraint::True
| Constraint::IsOpenType(_)
| Constraint::IncludesTag(_)
@ -797,6 +798,8 @@ pub enum Constraint {
),
/// Check call fx against enclosing function fx
FxCall(Index<FxCallConstraint>),
/// Mark a function that doesn't call any effectful functions as pure
FlexToPure(Variable),
/// Expect statement to be effectful
EffectfulStmt(Variable, Region),
/// Used for things that always unify, e.g. blanks and runtime errors
@ -913,6 +916,9 @@ impl std::fmt::Debug for Constraint {
Self::EffectfulStmt(arg0, arg1) => {
write!(f, "EffectfulStmt({arg0:?}, {arg1:?})")
}
Self::FlexToPure(arg0) => {
write!(f, "FlexToPure({arg0:?})")
}
Self::True => write!(f, "True"),
Self::SaveTheEnvironment => write!(f, "SaveTheEnvironment"),
Self::Let(arg0, arg1) => f.debug_tuple("Let").field(arg0).field(arg1).finish(),