mirror of
https://github.com/roc-lang/roc.git
synced 2024-09-22 00:09:33 +03:00
Allelujah! Don't Trust! Assert!
This commit is contained in:
parent
b89dc60d7e
commit
a3c1788d48
@ -65,16 +65,22 @@ impl SolvedBool {
|
||||
pub fn from_bool(boolean: &boolean_algebra::Bool, subs: &Subs) -> Self {
|
||||
use boolean_algebra::Bool;
|
||||
|
||||
// NOTE we blindly trust that `cvar` is a root and has a FlexVar as content
|
||||
match boolean {
|
||||
Bool::Shared => SolvedBool::SolvedShared,
|
||||
Bool::Container(cvar, mvars) => SolvedBool::SolvedContainer(
|
||||
VarId::from_var(*cvar, subs),
|
||||
mvars
|
||||
.iter()
|
||||
.map(|mvar| VarId::from_var(*mvar, subs))
|
||||
.collect(),
|
||||
),
|
||||
Bool::Container(cvar, mvars) => {
|
||||
debug_assert!(matches!(
|
||||
subs.get_without_compacting(*cvar).content,
|
||||
crate::subs::Content::FlexVar(_)
|
||||
));
|
||||
|
||||
SolvedBool::SolvedContainer(
|
||||
VarId::from_var(*cvar, subs),
|
||||
mvars
|
||||
.iter()
|
||||
.map(|mvar| VarId::from_var(*mvar, subs))
|
||||
.collect(),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user