Support extension variables in record and tag union encoding derive keys

This commit is contained in:
Ayaz Hafiz 2022-08-17 09:48:38 -05:00
parent a8b348506f
commit b5e59d22e3
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
4 changed files with 86 additions and 20 deletions

View file

@ -3,13 +3,15 @@ use roc_types::subs::{Content, Subs, Variable};
use crate::DeriveError;
pub(crate) fn check_empty_ext_var(
pub(crate) fn check_derivable_ext_var(
subs: &Subs,
ext_var: Variable,
is_empty_ext: impl Fn(&Content) -> bool,
) -> Result<(), DeriveError> {
let ext_content = subs.get_content_without_compacting(ext_var);
if is_empty_ext(ext_content) {
if is_empty_ext(ext_content)
|| matches!(ext_content, Content::FlexVar(_) | Content::RigidVar(_))
{
Ok(())
} else {
match ext_content {