various small type-related changes

This commit is contained in:
Folkert 2022-03-18 22:35:12 +01:00
parent 9cb6261a4d
commit 21a51464f3
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
2 changed files with 20 additions and 10 deletions

View file

@ -428,6 +428,7 @@ impl Env {
it1.zip(it2)
}
#[inline(always)]
fn get_var_by_symbol(&self, symbol: &Symbol) -> Option<Variable> {
self.symbols
.iter()
@ -435,6 +436,7 @@ impl Env {
.map(|index| self.variables[index])
}
#[inline(always)]
fn insert_symbol_var_if_vacant(&mut self, symbol: Symbol, var: Variable) {
match self.symbols.iter().position(|s| *s == symbol) {
None => {
@ -725,23 +727,27 @@ fn solve(
// check that things went well
debug_assert!({
// NOTE the `subs.redundant` check is added for the uniqueness
// inference, and does not come from elm. It's unclear whether this is
// a bug with uniqueness inference (something is redundant that
// shouldn't be) or that it just never came up in elm.
let rigid_vars = &constraints.variables[let_con.rigid_vars.indices()];
let failing: Vec<_> = rigid_vars
// NOTE the `subs.redundant` check does not come from elm.
// It's unclear whether this is a bug with our implementation
// (something is redundant that shouldn't be)
// or that it just never came up in elm.
let mut it = rigid_vars
.iter()
.filter(|&var| !subs.redundant(*var) && subs.get_rank(*var) != Rank::NONE)
.collect();
.peekable();
if !failing.is_empty() {
if it.peek().is_some() {
let failing: Vec<_> = it.collect();
println!("Rigids {:?}", &rigid_vars);
println!("Failing {:?}", failing);
}
failing.is_empty()
// nicer error message
failing.is_empty()
} else {
true
}
});
let mut new_env = env.clone();