Skip to content

Commit b183612

Browse files
committed
Add INTEGER and FLOAT flags for type variables
1 parent 1bfc732 commit b183612

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

crates/hir-ty/src/infer/unify.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ bitflags::bitflags! {
132132
#[derive(Default)]
133133
pub(crate) struct TypeVariableFlags: u8 {
134134
const DIVERGING = 1 << 0;
135+
const INTEGER = 1 << 1;
136+
const FLOAT = 1 << 2;
135137
}
136138
}
137139

@@ -258,8 +260,14 @@ impl<'a> InferenceTable<'a> {
258260
// Chalk might have created some type variables for its own purposes that we don't know about...
259261
self.extend_type_variable_table(var.index() as usize);
260262
assert_eq!(var.index() as usize, self.type_variable_table.len() - 1);
263+
let flags = self.type_variable_table.get_mut(var.index() as usize).unwrap();
261264
if diverging {
262-
self.type_variable_table[var.index() as usize] |= TypeVariableFlags::DIVERGING;
265+
*flags |= TypeVariableFlags::DIVERGING;
266+
}
267+
if matches!(kind, TyVariableKind::Integer) {
268+
*flags |= TypeVariableFlags::INTEGER;
269+
} else if matches!(kind, TyVariableKind::Float) {
270+
*flags |= TypeVariableFlags::FLOAT;
263271
}
264272
var.to_ty_with_kind(Interner, kind)
265273
}

0 commit comments

Comments
 (0)