mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-21 19:19:45 +00:00
Support extension variables in record and tag union encoding derive keys
This commit is contained in:
parent
a8b348506f
commit
b5e59d22e3
4 changed files with 86 additions and 20 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue