feat: annotated data for option datum

This commit is contained in:
rvcas
2024-08-23 17:15:54 -04:00
committed by KtorZ
parent d8723c5497
commit ff1464b462
3 changed files with 15 additions and 11 deletions

View File

@@ -22,6 +22,8 @@ mod pattern;
mod pipe;
pub mod pretty;
pub use environment::collapse_links;
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
pub struct TypeAliasAnnotation {
pub alias: String,
@@ -1099,13 +1101,11 @@ impl TypeVar {
Self::Link { tipo } => tipo.get_inner_types(),
Self::Unbound { .. } => vec![],
var => {
vec![
Type::Var {
tipo: RefCell::new(var.clone()).into(),
alias: None,
}
.into(),
]
vec![Type::Var {
tipo: RefCell::new(var.clone()).into(),
alias: None,
}
.into()]
}
}
}

View File

@@ -1967,7 +1967,7 @@ pub(super) fn assert_no_labeled_arguments<A>(args: &[CallArg<A>]) -> Option<(Spa
None
}
pub(super) fn collapse_links(t: Rc<Type>) -> Rc<Type> {
pub fn collapse_links(t: Rc<Type>) -> Rc<Type> {
if let Type::Var { tipo, alias } = t.deref() {
if let TypeVar::Link { tipo } = tipo.borrow().deref() {
return Type::with_alias(tipo.clone(), alias.clone());