even more wip

This commit is contained in:
Folkert 2022-03-02 17:32:50 +01:00
parent b8fd6992a2
commit 01a7fe77d4
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
10 changed files with 2710 additions and 64 deletions

View file

@ -360,8 +360,7 @@ fn can_annotation_help(
As(
loc_inner,
_spaces,
alias_header
@ TypeHeader {
alias_header @ TypeHeader {
name,
vars: loc_vars,
},

View file

@ -133,7 +133,7 @@ impl Constraints {
Constraint::Let(let_index)
}
pub fn let_contraint<I1, I2, I3>(
pub fn let_constraint<I1, I2, I3>(
&mut self,
rigid_vars: I1,
flex_vars: I2,
@ -164,7 +164,7 @@ impl Constraints {
Constraint::Let(let_index)
}
pub fn and_contraint<I>(&mut self, constraints: I) -> Constraint
pub fn and_constraint<I>(&mut self, constraints: I) -> Constraint
where
I: IntoIterator<Item = Constraint>,
{
@ -178,6 +178,36 @@ impl Constraints {
Constraint::And(slice)
}
pub fn lookup(
&mut self,
symbol: Symbol,
expected: Expected<Type>,
region: Region,
) -> Constraint {
Constraint::Lookup(
symbol,
Index::push_new(&mut self.expectations, expected),
region,
)
}
pub fn contains_save_the_environment(&self, constraint: Constraint) -> bool {
todo!()
}
pub fn store(
&mut self,
typ: Type,
variable: Variable,
filename: &'static str,
line_number: u32,
) -> Constraint {
let type_index = Index::new(self.types.len() as _);
self.types.push(typ);
Constraint::Store(type_index, variable, filename, line_number)
}
}
static_assertions::assert_eq_size!([u8; 4 * 8], Constraint);