Unwrap layouts containing void layouts as newtypes

Addresses the attempt to do so in https://github.com/roc-lang/roc/pull/3465

Co-authored-by: Folkert <folkert@folkertdev.nl>
This commit is contained in:
Ayaz Hafiz 2022-09-19 16:47:27 -05:00
parent 639c1e5fa3
commit f41936d5e5
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
9 changed files with 228 additions and 14 deletions

View file

@ -4,6 +4,7 @@ use crate::ir::{
use crate::layout::{Builtin, Layout, LayoutCache, TagIdIntType, UnionLayout};
use roc_builtins::bitcode::{FloatWidth, IntWidth};
use roc_collections::all::{MutMap, MutSet};
use roc_error_macros::internal_error;
use roc_exhaustive::{Ctor, CtorName, RenderAs, TagId, Union};
use roc_module::ident::TagName;
use roc_module::low_level::LowLevel;
@ -577,6 +578,8 @@ fn test_at_path<'a>(
arguments: arguments.to_vec(),
},
Voided { .. } => internal_error!("unreachable"),
OpaqueUnwrap { opaque, argument } => {
let union = Union {
render_as: RenderAs::Tag,
@ -875,6 +878,7 @@ fn to_relevant_branch_help<'a>(
_ => None,
}
}
Voided { .. } => internal_error!("unreachable"),
StrLiteral(string) => match test {
IsStr(test_str) if string == *test_str => {
start.extend(end);
@ -1018,6 +1022,8 @@ fn needs_tests(pattern: &Pattern) -> bool {
| FloatLiteral(_, _)
| DecimalLiteral(_)
| StrLiteral(_) => true,
Voided { .. } => internal_error!("unreachable"),
}
}