Able variables that are never used can become void

This commit is contained in:
Ayaz Hafiz 2022-10-10 13:33:28 -05:00
parent f3a6b45452
commit bc2f4569aa
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58

View file

@ -2214,7 +2214,16 @@ impl<'a> Layout<'a> {
// completely, but for now we represent it with the empty tag union
cacheable(Ok(Layout::VOID))
}
FlexAbleVar(_, _) | RigidAbleVar(_, _) => todo_abilities!("Not reachable yet"),
FlexAbleVar(_, _) | RigidAbleVar(_, _) => {
roc_debug_flags::dbg_do!(roc_debug_flags::ROC_NO_UNBOUND_LAYOUT, {
return todo_abilities!("Able var is unbound!");
});
// If we encounter an unbound type var (e.g. `*` or `a`)
// then it's zero-sized; In the future we may drop this argument
// completely, but for now we represent it with the empty tag union
cacheable(Ok(Layout::VOID))
}
RecursionVar { structure, .. } => {
let structure_content = env.subs.get_content_without_compacting(structure);
Self::new_help(env, structure, *structure_content)