aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/ty')
-rw-r--r--crates/ra_hir/src/ty/method_resolution.rs17
-rw-r--r--crates/ra_hir/src/ty/tests/data/function_generics.txt20
-rw-r--r--crates/ra_hir/src/ty/tests/data/generic_chain.txt44
-rw-r--r--crates/ra_hir/src/ty/tests/data/struct_generics.txt22
4 files changed, 57 insertions, 46 deletions
diff --git a/crates/ra_hir/src/ty/method_resolution.rs b/crates/ra_hir/src/ty/method_resolution.rs
index b221bd142..53b6d15a8 100644
--- a/crates/ra_hir/src/ty/method_resolution.rs
+++ b/crates/ra_hir/src/ty/method_resolution.rs
@@ -8,7 +8,11 @@ use rustc_hash::FxHashMap;
8 8
9use ra_db::SourceRootId; 9use ra_db::SourceRootId;
10 10
11use crate::{HirDatabase, DefId, module_tree::ModuleId, Module, Crate, Name, Function, impl_block::{ImplId, ImplBlock, ImplItem}}; 11use crate::{
12 HirDatabase, DefId, module_tree::ModuleId, Module, Crate, Name, Function,
13 impl_block::{ImplId, ImplBlock, ImplItem},
14 generics::Generics
15};
12use super::Ty; 16use super::Ty;
13 17
14/// This is used as a key for indexing impls. 18/// This is used as a key for indexing impls.
@@ -64,8 +68,15 @@ impl CrateImplBlocks {
64 if let Some(_target_trait) = impl_data.target_trait() { 68 if let Some(_target_trait) = impl_data.target_trait() {
65 // ignore for now 69 // ignore for now
66 } else { 70 } else {
67 let target_ty = 71 // TODO provide generics of impl
68 Ty::from_hir(db, &module, Some(&impl_block), impl_data.target_type()); 72 let generics = Generics::default();
73 let target_ty = Ty::from_hir(
74 db,
75 &module,
76 Some(&impl_block),
77 &generics,
78 impl_data.target_type(),
79 );
69 if let Some(target_ty_fp) = TyFingerprint::for_impl(&target_ty) { 80 if let Some(target_ty_fp) = TyFingerprint::for_impl(&target_ty) {
70 self.impls 81 self.impls
71 .entry(target_ty_fp) 82 .entry(target_ty_fp)
diff --git a/crates/ra_hir/src/ty/tests/data/function_generics.txt b/crates/ra_hir/src/ty/tests/data/function_generics.txt
index 179e136a0..e44d26cfd 100644
--- a/crates/ra_hir/src/ty/tests/data/function_generics.txt
+++ b/crates/ra_hir/src/ty/tests/data/function_generics.txt
@@ -2,13 +2,13 @@
2[21; 26) '{ t }': [unknown] 2[21; 26) '{ t }': [unknown]
3[23; 24) 't': [unknown] 3[23; 24) 't': [unknown]
4[38; 98) '{ ...(1); }': () 4[38; 98) '{ ...(1); }': ()
5[44; 46) 'id': fn([unknown]) -> [unknown] 5[44; 46) 'id': fn(T) -> T
6[44; 52) 'id(1u32)': [unknown] 6[44; 52) 'id(1u32)': T
7[47; 51) '1u32': [unknown] 7[47; 51) '1u32': u32
8[58; 68) 'id::<i128>': fn([unknown]) -> [unknown] 8[58; 68) 'id::<i128>': fn(T) -> T
9[58; 71) 'id::<i128>(1)': [unknown] 9[58; 71) 'id::<i128>(1)': T
10[69; 70) '1': [unknown] 10[69; 70) '1': T
11[81; 82) 'x': u64 11[81; 82) 'x': T
12[90; 92) 'id': fn([unknown]) -> u64 12[90; 92) 'id': fn(T) -> T
13[90; 95) 'id(1)': u64 13[90; 95) 'id(1)': T
14[93; 94) '1': [unknown] 14[93; 94) '1': T
diff --git a/crates/ra_hir/src/ty/tests/data/generic_chain.txt b/crates/ra_hir/src/ty/tests/data/generic_chain.txt
index 720609153..568e00846 100644
--- a/crates/ra_hir/src/ty/tests/data/generic_chain.txt
+++ b/crates/ra_hir/src/ty/tests/data/generic_chain.txt
@@ -1,29 +1,29 @@
1[53; 57) 'self': A 1[53; 57) 'self': A<[unknown]>
2[65; 87) '{ ... }': [unknown] 2[65; 87) '{ ... }': [unknown]
3[75; 79) 'self': A 3[75; 79) 'self': A<[unknown]>
4[75; 81) 'self.x': [unknown] 4[75; 81) 'self.x': [unknown]
5[99; 100) 't': [unknown] 5[99; 100) 't': [unknown]
6[110; 115) '{ t }': [unknown] 6[110; 115) '{ t }': [unknown]
7[112; 113) 't': [unknown] 7[112; 113) 't': [unknown]
8[135; 261) '{ ....x() }': i128 8[135; 261) '{ ....x() }': i128
9[146; 147) 'x': [unknown] 9[146; 147) 'x': T
10[150; 151) '1': [unknown] 10[150; 151) '1': T
11[162; 163) 'y': [unknown] 11[162; 163) 'y': T
12[166; 168) 'id': fn([unknown]) -> [unknown] 12[166; 168) 'id': fn(T) -> T
13[166; 171) 'id(x)': [unknown] 13[166; 171) 'id(x)': T
14[169; 170) 'x': [unknown] 14[169; 170) 'x': T
15[182; 183) 'a': A 15[182; 183) 'a': A<T>
16[186; 200) 'A { x: id(y) }': A 16[186; 200) 'A { x: id(y) }': A<T>
17[193; 195) 'id': fn([unknown]) -> [unknown] 17[193; 195) 'id': fn(T) -> T
18[193; 198) 'id(y)': [unknown] 18[193; 198) 'id(y)': T
19[196; 197) 'y': [unknown] 19[196; 197) 'y': T
20[211; 212) 'z': [unknown] 20[211; 212) 'z': T
21[215; 217) 'id': fn([unknown]) -> [unknown] 21[215; 217) 'id': fn(T) -> T
22[215; 222) 'id(a.x)': [unknown] 22[215; 222) 'id(a.x)': T
23[218; 219) 'a': A 23[218; 219) 'a': A<T>
24[218; 221) 'a.x': [unknown] 24[218; 221) 'a.x': T
25[233; 234) 'b': A 25[233; 234) 'b': A<T>
26[237; 247) 'A { x: z }': A 26[237; 247) 'A { x: z }': A<T>
27[244; 245) 'z': [unknown] 27[244; 245) 'z': T
28[254; 255) 'b': A 28[254; 255) 'b': A<T>
29[254; 259) 'b.x()': i128 29[254; 259) 'b.x()': i128
diff --git a/crates/ra_hir/src/ty/tests/data/struct_generics.txt b/crates/ra_hir/src/ty/tests/data/struct_generics.txt
index d1026b459..88cd2b409 100644
--- a/crates/ra_hir/src/ty/tests/data/struct_generics.txt
+++ b/crates/ra_hir/src/ty/tests/data/struct_generics.txt
@@ -1,15 +1,15 @@
1[36; 38) 'a1': A 1[36; 38) 'a1': A<[unknown]>
2[48; 49) 'i': i32 2[48; 49) 'i': i32
3[56; 147) '{ ...3.x; }': () 3[56; 147) '{ ...3.x; }': ()
4[62; 64) 'a1': A 4[62; 64) 'a1': A<[unknown]>
5[62; 66) 'a1.x': [unknown] 5[62; 66) 'a1.x': [unknown]
6[76; 78) 'a2': A 6[76; 78) 'a2': A<i32>
7[81; 91) 'A { x: i }': A 7[81; 91) 'A { x: i }': A<i32>
8[88; 89) 'i': i32 8[88; 89) 'i': i32
9[97; 99) 'a2': A 9[97; 99) 'a2': A<i32>
10[97; 101) 'a2.x': [unknown] 10[97; 101) 'a2.x': i32
11[111; 113) 'a3': A 11[111; 113) 'a3': A<i32>
12[116; 134) 'A::<i1...x: 1 }': A 12[116; 134) 'A::<i1...x: 1 }': A<i32>
13[131; 132) '1': [unknown] 13[131; 132) '1': i32
14[140; 142) 'a3': A 14[140; 142) 'a3': A<i32>
15[140; 144) 'a3.x': [unknown] 15[140; 144) 'a3.x': i32