equal_pattern_types takes type index

This commit is contained in:
Ayaz Hafiz 2022-10-24 17:41:13 -05:00
parent c53e08f63c
commit 0990eda0cb
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
2 changed files with 24 additions and 14 deletions

View file

@ -215,6 +215,10 @@ impl Constraints {
Index::push_new(&mut self.expectations, expected.map(Cell::new))
}
pub fn push_pat_expected_type(&mut self, expected: PExpected<Type>) -> PExpectedTypeIndex {
Index::push_new(&mut self.pattern_expectations, expected.map(Cell::new))
}
#[inline(always)]
pub fn push_category(&mut self, category: Category) -> Index<Category> {
match category {
@ -306,14 +310,11 @@ impl Constraints {
pub fn equal_pattern_types(
&mut self,
typ: Type,
expected: PExpected<Type>,
type_index: TypeOrVar,
expected_index: PExpectedTypeIndex,
category: PatternCategory,
region: Region,
) -> Constraint {
let type_index = self.push_type(typ);
let expected_index =
Index::push_new(&mut self.pattern_expectations, expected.map(Cell::new));
let category_index = Self::push_pattern_category(self, category);
Constraint::Pattern(type_index, expected_index, category_index, region)