get fancy, store variable directly in the index

This commit is contained in:
Folkert 2022-03-13 01:59:28 +01:00
parent b3d9f9c2de
commit eccb461b01
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
2 changed files with 6 additions and 3 deletions

View file

@ -125,7 +125,10 @@ impl Constraints {
Type::EmptyRec => EitherIndex::from_left(Self::EMPTY_RECORD),
Type::EmptyTagUnion => EitherIndex::from_left(Self::EMPTY_TAG_UNION),
Type::Variable(var) => {
let index: Index<Variable> = Index::push_new(&mut self.variables, var);
// that's right, we use the variable's integer value as the index
// that way, we don't need to push anything onto a vector
let index: Index<Variable> = Index::new(var.index());
EitherIndex::from_right(index)
}
other => {