Implement Chalk variable kinds
This means we need to keep track of the kinds (general/int/float) of variables in `Canonical`, which requires some more ceremony. (It also exposes some places where we're not really dealing with canonicalization correctly -- another thing to be cleaned up when we switch to using Chalk's types directly.) Should fix the last remaining issue of #2534.
This commit is contained in:
committed by
Florian Diebold
parent
4a19d5954a
commit
d5d485ef92
@@ -1187,7 +1187,7 @@ impl Type {
|
||||
None => return false,
|
||||
};
|
||||
|
||||
let canonical_ty = Canonical { value: self.ty.value.clone(), num_vars: 0 };
|
||||
let canonical_ty = Canonical { value: self.ty.value.clone(), kinds: Arc::new([]) };
|
||||
method_resolution::implements_trait(
|
||||
&canonical_ty,
|
||||
db,
|
||||
@@ -1211,7 +1211,7 @@ impl Type {
|
||||
self.ty.environment.clone(),
|
||||
hir_ty::Obligation::Trait(trait_ref),
|
||||
),
|
||||
num_vars: 0,
|
||||
kinds: Arc::new([]),
|
||||
};
|
||||
|
||||
db.trait_solve(self.krate, goal).is_some()
|
||||
@@ -1286,7 +1286,7 @@ impl Type {
|
||||
pub fn autoderef<'a>(&'a self, db: &'a dyn HirDatabase) -> impl Iterator<Item = Type> + 'a {
|
||||
// There should be no inference vars in types passed here
|
||||
// FIXME check that?
|
||||
let canonical = Canonical { value: self.ty.value.clone(), num_vars: 0 };
|
||||
let canonical = Canonical { value: self.ty.value.clone(), kinds: Arc::new([]) };
|
||||
let environment = self.ty.environment.clone();
|
||||
let ty = InEnvironment { value: canonical, environment };
|
||||
autoderef(db, Some(self.krate), ty)
|
||||
@@ -1327,7 +1327,7 @@ impl Type {
|
||||
// There should be no inference vars in types passed here
|
||||
// FIXME check that?
|
||||
// FIXME replace Unknown by bound vars here
|
||||
let canonical = Canonical { value: self.ty.value.clone(), num_vars: 0 };
|
||||
let canonical = Canonical { value: self.ty.value.clone(), kinds: Arc::new([]) };
|
||||
|
||||
let env = self.ty.environment.clone();
|
||||
let krate = krate.id;
|
||||
@@ -1358,7 +1358,7 @@ impl Type {
|
||||
// There should be no inference vars in types passed here
|
||||
// FIXME check that?
|
||||
// FIXME replace Unknown by bound vars here
|
||||
let canonical = Canonical { value: self.ty.value.clone(), num_vars: 0 };
|
||||
let canonical = Canonical { value: self.ty.value.clone(), kinds: Arc::new([]) };
|
||||
|
||||
let env = self.ty.environment.clone();
|
||||
let krate = krate.id;
|
||||
|
||||
Reference in New Issue
Block a user