aboutsummaryrefslogtreecommitdiff
path: root/crates/ide
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2021-05-08 22:30:19 +0100
committerLukas Wirth <[email protected]>2021-05-08 22:35:18 +0100
commit3a346412cf8ce2f04e123195452bf1b1c86211a7 (patch)
tree4e7fffadda89c9eb111d0ec313ee9f138c448ab0 /crates/ide
parent04717b9bd2decfee70a6fbde90540d3dc16bb76f (diff)
Don't handle Self as a usage for TraitDefs
Diffstat (limited to 'crates/ide')
-rw-r--r--crates/ide/src/references.rs49
1 files changed, 27 insertions, 22 deletions
diff --git a/crates/ide/src/references.rs b/crates/ide/src/references.rs
index 1551cd2a8..ae492a264 100644
--- a/crates/ide/src/references.rs
+++ b/crates/ide/src/references.rs
@@ -1163,33 +1163,38 @@ fn foo<const FOO$0: usize>() -> usize {
1163 } 1163 }
1164 1164
1165 #[test] 1165 #[test]
1166 fn test_find_self_ty_in_trait_def() { 1166 fn test_trait() {
1167 check( 1167 check(
1168 r#" 1168 r#"
1169trait Foo where Self: { 1169trait Foo$0 where Self: {}
1170 fn f() -> Self$0; 1170
1171impl Foo for () {}
1172"#,
1173 expect![[r#"
1174 Foo Trait FileId(0) 0..24 6..9
1175
1176 FileId(0) 31..34
1177 "#]],
1178 );
1179 }
1180
1181 #[test]
1182 fn test_trait_self() {
1183 check(
1184 r#"
1185trait Foo where Self$0 {
1186 fn f() -> Self;
1171} 1187}
1188
1189impl Foo for () {}
1172"#, 1190"#,
1173 expect![[r#" 1191 expect![[r#"
1174 Self TypeParam FileId(0) 6..9 6..9 1192 Self TypeParam FileId(0) 6..9 6..9
1175 1193
1176 FileId(0) 16..20 1194 FileId(0) 16..20
1177 FileId(0) 38..42 1195 FileId(0) 37..41
1178 "#]], 1196 "#]],
1179 ); 1197 );
1180 // check(
1181 // r#"
1182 // trait Foo$0 where Self: {
1183 // fn f() -> Self;
1184 // }
1185 // "#,
1186 // expect![[r#"
1187 // Foo Trait FileId(0) 0..45 6..9
1188
1189 // FileId(0) 16..20
1190 // FileId(0) 38..42
1191 // "#]],
1192 // );
1193 } 1198 }
1194 1199
1195 #[test] 1200 #[test]
@@ -1203,12 +1208,12 @@ trait Foo where Self: {
1203 } 1208 }
1204 "#, 1209 "#,
1205 expect![[r#" 1210 expect![[r#"
1206 Foo Struct FileId(0) 0..11 7..10 1211 Foo Struct FileId(0) 0..11 7..10
1207 1212
1208 FileId(0) 18..21 1213 FileId(0) 18..21
1209 FileId(0) 28..32 1214 FileId(0) 28..32
1210 FileId(0) 50..54 1215 FileId(0) 50..54
1211 "#]], 1216 "#]],
1212 ); 1217 );
1213 check( 1218 check(
1214 r#" 1219 r#"