aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2020-06-28 20:17:27 +0100
committerFlorian Diebold <[email protected]>2020-07-01 19:40:38 +0100
commitd5d485ef9289589332893f2c0ad96cb366afe9d6 (patch)
tree2a722d6d6c4b41aa4bd0479e5eca2dd5250d1588 /crates/ra_hir/src
parent4a19d5954a4665a7a8572f9592f855f68cf0f2c6 (diff)
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.
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r--crates/ra_hir/src/code_model.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs
index e86077dd6..479c82fa4 100644
--- a/crates/ra_hir/src/code_model.rs
+++ b/crates/ra_hir/src/code_model.rs
@@ -1187,7 +1187,7 @@ impl Type {
1187 None => return false, 1187 None => return false,
1188 }; 1188 };
1189 1189
1190 let canonical_ty = Canonical { value: self.ty.value.clone(), num_vars: 0 }; 1190 let canonical_ty = Canonical { value: self.ty.value.clone(), kinds: Arc::new([]) };
1191 method_resolution::implements_trait( 1191 method_resolution::implements_trait(
1192 &canonical_ty, 1192 &canonical_ty,
1193 db, 1193 db,
@@ -1211,7 +1211,7 @@ impl Type {
1211 self.ty.environment.clone(), 1211 self.ty.environment.clone(),
1212 hir_ty::Obligation::Trait(trait_ref), 1212 hir_ty::Obligation::Trait(trait_ref),
1213 ), 1213 ),
1214 num_vars: 0, 1214 kinds: Arc::new([]),
1215 }; 1215 };
1216 1216
1217 db.trait_solve(self.krate, goal).is_some() 1217 db.trait_solve(self.krate, goal).is_some()
@@ -1286,7 +1286,7 @@ impl Type {
1286 pub fn autoderef<'a>(&'a self, db: &'a dyn HirDatabase) -> impl Iterator<Item = Type> + 'a { 1286 pub fn autoderef<'a>(&'a self, db: &'a dyn HirDatabase) -> impl Iterator<Item = Type> + 'a {
1287 // There should be no inference vars in types passed here 1287 // There should be no inference vars in types passed here
1288 // FIXME check that? 1288 // FIXME check that?
1289 let canonical = Canonical { value: self.ty.value.clone(), num_vars: 0 }; 1289 let canonical = Canonical { value: self.ty.value.clone(), kinds: Arc::new([]) };
1290 let environment = self.ty.environment.clone(); 1290 let environment = self.ty.environment.clone();
1291 let ty = InEnvironment { value: canonical, environment }; 1291 let ty = InEnvironment { value: canonical, environment };
1292 autoderef(db, Some(self.krate), ty) 1292 autoderef(db, Some(self.krate), ty)
@@ -1327,7 +1327,7 @@ impl Type {
1327 // There should be no inference vars in types passed here 1327 // There should be no inference vars in types passed here
1328 // FIXME check that? 1328 // FIXME check that?
1329 // FIXME replace Unknown by bound vars here 1329 // FIXME replace Unknown by bound vars here
1330 let canonical = Canonical { value: self.ty.value.clone(), num_vars: 0 }; 1330 let canonical = Canonical { value: self.ty.value.clone(), kinds: Arc::new([]) };
1331 1331
1332 let env = self.ty.environment.clone(); 1332 let env = self.ty.environment.clone();
1333 let krate = krate.id; 1333 let krate = krate.id;
@@ -1358,7 +1358,7 @@ impl Type {
1358 // There should be no inference vars in types passed here 1358 // There should be no inference vars in types passed here
1359 // FIXME check that? 1359 // FIXME check that?
1360 // FIXME replace Unknown by bound vars here 1360 // FIXME replace Unknown by bound vars here
1361 let canonical = Canonical { value: self.ty.value.clone(), num_vars: 0 }; 1361 let canonical = Canonical { value: self.ty.value.clone(), kinds: Arc::new([]) };
1362 1362
1363 let env = self.ty.environment.clone(); 1363 let env = self.ty.environment.clone();
1364 let krate = krate.id; 1364 let krate = krate.id;