aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/tests/method_resolution.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_ty/src/tests/method_resolution.rs')
-rw-r--r--crates/ra_hir_ty/src/tests/method_resolution.rs378
1 files changed, 189 insertions, 189 deletions
diff --git a/crates/ra_hir_ty/src/tests/method_resolution.rs b/crates/ra_hir_ty/src/tests/method_resolution.rs
index a98efb1cc..20329bae4 100644
--- a/crates/ra_hir_ty/src/tests/method_resolution.rs
+++ b/crates/ra_hir_ty/src/tests/method_resolution.rs
@@ -22,15 +22,15 @@ fn test(x: &[u8]) {
22} 22}
23"#), 23"#),
24 @r###" 24 @r###"
25 45..49 'self': &[T] 25 44..48 'self': &[T]
26 56..79 '{ ... }': T 26 55..78 '{ ... }': T
27 66..73 'loop {}': ! 27 65..72 'loop {}': !
28 71..73 '{}': () 28 70..72 '{}': ()
29 131..132 'x': &[u8] 29 130..131 'x': &[u8]
30 141..163 '{ ...(x); }': () 30 140..162 '{ ...(x); }': ()
31 147..157 '<[_]>::foo': fn foo<u8>(&[u8]) -> u8 31 146..156 '<[_]>::foo': fn foo<u8>(&[u8]) -> u8
32 147..160 '<[_]>::foo(x)': u8 32 146..159 '<[_]>::foo(x)': u8
33 158..159 'x': &[u8] 33 157..158 'x': &[u8]
34 "### 34 "###
35 ); 35 );
36} 36}
@@ -52,15 +52,15 @@ fn test() {
52} 52}
53"#), 53"#),
54 @r###" 54 @r###"
55 49..75 '{ ... }': A 55 48..74 '{ ... }': A
56 59..69 'A { x: 0 }': A 56 58..68 'A { x: 0 }': A
57 66..67 '0': u32 57 65..66 '0': u32
58 88..122 '{ ...a.x; }': () 58 87..121 '{ ...a.x; }': ()
59 98..99 'a': A 59 97..98 'a': A
60 102..108 'A::new': fn new() -> A 60 101..107 'A::new': fn new() -> A
61 102..110 'A::new()': A 61 101..109 'A::new()': A
62 116..117 'a': A 62 115..116 'a': A
63 116..119 'a.x': u32 63 115..118 'a.x': u32
64 "### 64 "###
65 ); 65 );
66} 66}
@@ -87,19 +87,19 @@ fn test() {
87} 87}
88"#), 88"#),
89 @r###" 89 @r###"
90 47..67 '{ ... }': A 90 46..66 '{ ... }': A
91 57..61 'A::B': A 91 56..60 'A::B': A
92 88..108 '{ ... }': A 92 87..107 '{ ... }': A
93 98..102 'A::C': A 93 97..101 'A::C': A
94 121..178 '{ ... c; }': () 94 120..177 '{ ... c; }': ()
95 131..132 'a': A 95 130..131 'a': A
96 135..139 'A::b': fn b() -> A 96 134..138 'A::b': fn b() -> A
97 135..141 'A::b()': A 97 134..140 'A::b()': A
98 147..148 'a': A 98 146..147 'a': A
99 158..159 'c': A 99 157..158 'c': A
100 162..166 'A::c': fn c() -> A 100 161..165 'A::c': fn c() -> A
101 162..168 'A::c()': A 101 161..167 'A::c()': A
102 174..175 'c': A 102 173..174 'c': A
103 "### 103 "###
104 ); 104 );
105} 105}
@@ -131,22 +131,22 @@ fn test() {
131} 131}
132"#), 132"#),
133 @r###" 133 @r###"
134 56..64 '{ A {} }': A 134 55..63 '{ A {} }': A
135 58..62 'A {}': A 135 57..61 'A {}': A
136 126..132 '{ 99 }': u32 136 125..131 '{ 99 }': u32
137 128..130 '99': u32 137 127..129 '99': u32
138 202..210 '{ C {} }': C 138 201..209 '{ C {} }': C
139 204..208 'C {}': C 139 203..207 'C {}': C
140 241..325 '{ ...g(); }': () 140 240..324 '{ ...g(); }': ()
141 251..252 'x': A 141 250..251 'x': A
142 255..266 'a::A::thing': fn thing() -> A 142 254..265 'a::A::thing': fn thing() -> A
143 255..268 'a::A::thing()': A 143 254..267 'a::A::thing()': A
144 278..279 'y': u32 144 277..278 'y': u32
145 282..293 'b::B::thing': fn thing() -> u32 145 281..292 'b::B::thing': fn thing() -> u32
146 282..295 'b::B::thing()': u32 146 281..294 'b::B::thing()': u32
147 305..306 'z': C 147 304..305 'z': C
148 309..320 'c::C::thing': fn thing() -> C 148 308..319 'c::C::thing': fn thing() -> C
149 309..322 'c::C::thing()': C 149 308..321 'c::C::thing()': C
150 "### 150 "###
151 ); 151 );
152} 152}
@@ -170,15 +170,15 @@ fn test() {
170} 170}
171"#), 171"#),
172 @r###" 172 @r###"
173 64..67 'val': T 173 63..66 'val': T
174 82..109 '{ ... }': Gen<T> 174 81..108 '{ ... }': Gen<T>
175 92..103 'Gen { val }': Gen<T> 175 91..102 'Gen { val }': Gen<T>
176 98..101 'val': T 176 97..100 'val': T
177 123..155 '{ ...32); }': () 177 122..154 '{ ...32); }': ()
178 133..134 'a': Gen<u32> 178 132..133 'a': Gen<u32>
179 137..146 'Gen::make': fn make<u32>(u32) -> Gen<u32> 179 136..145 'Gen::make': fn make<u32>(u32) -> Gen<u32>
180 137..152 'Gen::make(0u32)': Gen<u32> 180 136..151 'Gen::make(0u32)': Gen<u32>
181 147..151 '0u32': u32 181 146..150 '0u32': u32
182 "### 182 "###
183 ); 183 );
184} 184}
@@ -202,13 +202,13 @@ fn test() {
202} 202}
203"#), 203"#),
204 @r###" 204 @r###"
205 76..100 '{ ... }': Gen<T> 205 75..99 '{ ... }': Gen<T>
206 86..94 'loop { }': ! 206 85..93 'loop { }': !
207 91..94 '{ }': () 207 90..93 '{ }': ()
208 114..149 '{ ...e(); }': () 208 113..148 '{ ...e(); }': ()
209 124..125 'a': Gen<u32> 209 123..124 'a': Gen<u32>
210 128..144 'Gen::<...::make': fn make<u32>() -> Gen<u32> 210 127..143 'Gen::<...::make': fn make<u32>() -> Gen<u32>
211 128..146 'Gen::<...make()': Gen<u32> 211 127..145 'Gen::<...make()': Gen<u32>
212 "### 212 "###
213 ); 213 );
214} 214}
@@ -233,13 +233,13 @@ fn test() {
233} 233}
234"#), 234"#),
235 @r###" 235 @r###"
236 102..126 '{ ... }': Gen<u32, T> 236 101..125 '{ ... }': Gen<u32, T>
237 112..120 'loop { }': ! 237 111..119 'loop { }': !
238 117..120 '{ }': () 238 116..119 '{ }': ()
239 140..180 '{ ...e(); }': () 239 139..179 '{ ...e(); }': ()
240 150..151 'a': Gen<u32, u64> 240 149..150 'a': Gen<u32, u64>
241 154..175 'Gen::<...::make': fn make<u64>() -> Gen<u32, u64> 241 153..174 'Gen::<...::make': fn make<u64>() -> Gen<u32, u64>
242 154..177 'Gen::<...make()': Gen<u32, u64> 242 153..176 'Gen::<...make()': Gen<u32, u64>
243 "### 243 "###
244 ); 244 );
245} 245}
@@ -287,13 +287,13 @@ fn test() {
287} 287}
288"#), 288"#),
289 @r###" 289 @r###"
290 31..35 'self': &Self 290 30..34 'self': &Self
291 110..114 'self': &Self 291 109..113 'self': &Self
292 170..228 '{ ...i128 }': () 292 169..227 '{ ...i128 }': ()
293 176..178 'S1': S1 293 175..177 'S1': S1
294 176..187 'S1.method()': u32 294 175..186 'S1.method()': u32
295 203..205 'S2': S2 295 202..204 'S2': S2
296 203..214 'S2.method()': i128 296 202..213 'S2.method()': i128
297 "### 297 "###
298 ); 298 );
299} 299}
@@ -334,14 +334,14 @@ mod bar_test {
334} 334}
335"#), 335"#),
336 @r###" 336 @r###"
337 63..67 'self': &Self 337 62..66 'self': &Self
338 169..173 'self': &Self 338 168..172 'self': &Self
339 300..337 '{ ... }': () 339 299..336 '{ ... }': ()
340 310..311 'S': S 340 309..310 'S': S
341 310..320 'S.method()': u32 341 309..319 'S.method()': u32
342 416..454 '{ ... }': () 342 415..453 '{ ... }': ()
343 426..427 'S': S 343 425..426 'S': S
344 426..436 'S.method()': i128 344 425..435 'S.method()': i128
345 "### 345 "###
346 ); 346 );
347} 347}
@@ -361,10 +361,10 @@ fn test() {
361} 361}
362"#), 362"#),
363 @r###" 363 @r###"
364 33..37 'self': &Self 364 32..36 'self': &Self
365 92..111 '{ ...d(); }': () 365 91..110 '{ ...d(); }': ()
366 98..99 'S': S 366 97..98 'S': S
367 98..108 'S.method()': u32 367 97..107 'S.method()': u32
368 "### 368 "###
369 ); 369 );
370} 370}
@@ -390,17 +390,17 @@ fn test() {
390} 390}
391"#), 391"#),
392 @r###" 392 @r###"
393 43..47 'self': &Self 393 42..46 'self': &Self
394 82..86 'self': &Self 394 81..85 'self': &Self
395 210..361 '{ ..., i8 }': () 395 209..360 '{ ..., i8 }': ()
396 216..218 'S1': S1 396 215..217 'S1': S1
397 216..228 'S1.method1()': (u8, u16, u32) 397 215..227 'S1.method1()': (u8, u16, u32)
398 250..252 'S1': S1 398 249..251 'S1': S1
399 250..262 'S1.method2()': (u32, u16, u8) 399 249..261 'S1.method2()': (u32, u16, u8)
400 284..286 'S2': S2 400 283..285 'S2': S2
401 284..296 'S2.method1()': (i8, i16, {unknown}) 401 283..295 'S2.method1()': (i8, i16, {unknown})
402 324..326 'S2': S2 402 323..325 'S2': S2
403 324..336 'S2.method2()': ({unknown}, i16, i8) 403 323..335 'S2.method2()': ({unknown}, i16, i8)
404 "### 404 "###
405 ); 405 );
406} 406}
@@ -420,12 +420,12 @@ fn test() {
420} 420}
421"#), 421"#),
422 @r###" 422 @r###"
423 33..37 'self': &Self 423 32..36 'self': &Self
424 102..127 '{ ...d(); }': () 424 101..126 '{ ...d(); }': ()
425 108..109 'S': S<u32>(u32) -> S<u32> 425 107..108 'S': S<u32>(u32) -> S<u32>
426 108..115 'S(1u32)': S<u32> 426 107..114 'S(1u32)': S<u32>
427 108..124 'S(1u32...thod()': u32 427 107..123 'S(1u32...thod()': u32
428 110..114 '1u32': u32 428 109..113 '1u32': u32
429 "### 429 "###
430 ); 430 );
431} 431}
@@ -446,16 +446,16 @@ fn test() {
446} 446}
447"#), 447"#),
448 @r###" 448 @r###"
449 87..193 '{ ...t(); }': () 449 86..192 '{ ...t(); }': ()
450 97..99 's1': S 450 96..98 's1': S
451 105..121 'Defaul...efault': fn default<S>() -> S 451 104..120 'Defaul...efault': fn default<S>() -> S
452 105..123 'Defaul...ault()': S 452 104..122 'Defaul...ault()': S
453 133..135 's2': S 453 132..134 's2': S
454 138..148 'S::default': fn default<S>() -> S 454 137..147 'S::default': fn default<S>() -> S
455 138..150 'S::default()': S 455 137..149 'S::default()': S
456 160..162 's3': S 456 159..161 's3': S
457 165..188 '<S as ...efault': fn default<S>() -> S 457 164..187 '<S as ...efault': fn default<S>() -> S
458 165..190 '<S as ...ault()': S 458 164..189 '<S as ...ault()': S
459 "### 459 "###
460 ); 460 );
461} 461}
@@ -478,16 +478,16 @@ fn test() {
478} 478}
479"#), 479"#),
480 @r###" 480 @r###"
481 127..211 '{ ...e(); }': () 481 126..210 '{ ...e(); }': ()
482 137..138 'a': u32 482 136..137 'a': u32
483 141..148 'S::make': fn make<S, u32>() -> u32 483 140..147 'S::make': fn make<S, u32>() -> u32
484 141..150 'S::make()': u32 484 140..149 'S::make()': u32
485 160..161 'b': u64 485 159..160 'b': u64
486 164..178 'G::<u64>::make': fn make<G<u64>, u64>() -> u64 486 163..177 'G::<u64>::make': fn make<G<u64>, u64>() -> u64
487 164..180 'G::<u6...make()': u64 487 163..179 'G::<u6...make()': u64
488 190..191 'c': f64 488 189..190 'c': f64
489 199..206 'G::make': fn make<G<f64>, f64>() -> f64 489 198..205 'G::make': fn make<G<f64>, f64>() -> f64
490 199..208 'G::make()': f64 490 198..207 'G::make()': f64
491 "### 491 "###
492 ); 492 );
493} 493}
@@ -512,22 +512,22 @@ fn test() {
512} 512}
513"#), 513"#),
514 @r###" 514 @r###"
515 135..313 '{ ...e(); }': () 515 134..312 '{ ...e(); }': ()
516 145..146 'a': (u32, i64) 516 144..145 'a': (u32, i64)
517 149..163 'S::make::<i64>': fn make<S, u32, i64>() -> (u32, i64) 517 148..162 'S::make::<i64>': fn make<S, u32, i64>() -> (u32, i64)
518 149..165 'S::mak...i64>()': (u32, i64) 518 148..164 'S::mak...i64>()': (u32, i64)
519 175..176 'b': (u32, i64) 519 174..175 'b': (u32, i64)
520 189..196 'S::make': fn make<S, u32, i64>() -> (u32, i64) 520 188..195 'S::make': fn make<S, u32, i64>() -> (u32, i64)
521 189..198 'S::make()': (u32, i64) 521 188..197 'S::make()': (u32, i64)
522 208..209 'c': (u32, i64) 522 207..208 'c': (u32, i64)
523 212..233 'G::<u3...:<i64>': fn make<G<u32>, u32, i64>() -> (u32, i64) 523 211..232 'G::<u3...:<i64>': fn make<G<u32>, u32, i64>() -> (u32, i64)
524 212..235 'G::<u3...i64>()': (u32, i64) 524 211..234 'G::<u3...i64>()': (u32, i64)
525 245..246 'd': (u32, i64) 525 244..245 'd': (u32, i64)
526 259..273 'G::make::<i64>': fn make<G<u32>, u32, i64>() -> (u32, i64) 526 258..272 'G::make::<i64>': fn make<G<u32>, u32, i64>() -> (u32, i64)
527 259..275 'G::mak...i64>()': (u32, i64) 527 258..274 'G::mak...i64>()': (u32, i64)
528 285..286 'e': (u32, i64) 528 284..285 'e': (u32, i64)
529 301..308 'G::make': fn make<G<u32>, u32, i64>() -> (u32, i64) 529 300..307 'G::make': fn make<G<u32>, u32, i64>() -> (u32, i64)
530 301..310 'G::make()': (u32, i64) 530 300..309 'G::make()': (u32, i64)
531 "### 531 "###
532 ); 532 );
533} 533}
@@ -546,10 +546,10 @@ fn test() {
546} 546}
547"#), 547"#),
548 @r###" 548 @r###"
549 101..127 '{ ...e(); }': () 549 100..126 '{ ...e(); }': ()
550 111..112 'a': (S<i32>, i64) 550 110..111 'a': (S<i32>, i64)
551 115..122 'S::make': fn make<S<i32>, i64>() -> (S<i32>, i64) 551 114..121 'S::make': fn make<S<i32>, i64>() -> (S<i32>, i64)
552 115..124 'S::make()': (S<i32>, i64) 552 114..123 'S::make()': (S<i32>, i64)
553 "### 553 "###
554 ); 554 );
555} 555}
@@ -570,13 +570,13 @@ fn test() {
570} 570}
571"#), 571"#),
572 @r###" 572 @r###"
573 131..203 '{ ...e(); }': () 573 130..202 '{ ...e(); }': ()
574 141..142 'a': (S<u64>, i64) 574 140..141 'a': (S<u64>, i64)
575 158..165 'S::make': fn make<S<u64>, i64>() -> (S<u64>, i64) 575 157..164 'S::make': fn make<S<u64>, i64>() -> (S<u64>, i64)
576 158..167 'S::make()': (S<u64>, i64) 576 157..166 'S::make()': (S<u64>, i64)
577 177..178 'b': (S<u32>, i32) 577 176..177 'b': (S<u32>, i32)
578 191..198 'S::make': fn make<S<u32>, i32>() -> (S<u32>, i32) 578 190..197 'S::make': fn make<S<u32>, i32>() -> (S<u32>, i32)
579 191..200 'S::make()': (S<u32>, i32) 579 190..199 'S::make()': (S<u32>, i32)
580 "### 580 "###
581 ); 581 );
582} 582}
@@ -596,13 +596,13 @@ fn test() {
596} 596}
597"#), 597"#),
598 @r###" 598 @r###"
599 107..211 '{ ...>(); }': () 599 106..210 '{ ...>(); }': ()
600 117..118 'a': (S<u64>, i64, u8) 600 116..117 'a': (S<u64>, i64, u8)
601 121..150 '<S as ...::<u8>': fn make<S<u64>, i64, u8>() -> (S<u64>, i64, u8) 601 120..149 '<S as ...::<u8>': fn make<S<u64>, i64, u8>() -> (S<u64>, i64, u8)
602 121..152 '<S as ...<u8>()': (S<u64>, i64, u8) 602 120..151 '<S as ...<u8>()': (S<u64>, i64, u8)
603 162..163 'b': (S<u64>, i64, u8) 603 161..162 'b': (S<u64>, i64, u8)
604 182..206 'Trait:...::<u8>': fn make<S<u64>, i64, u8>() -> (S<u64>, i64, u8) 604 181..205 'Trait:...::<u8>': fn make<S<u64>, i64, u8>() -> (S<u64>, i64, u8)
605 182..208 'Trait:...<u8>()': (S<u64>, i64, u8) 605 181..207 'Trait:...<u8>()': (S<u64>, i64, u8)
606 "### 606 "###
607 ); 607 );
608} 608}
@@ -619,11 +619,11 @@ fn test<T: Trait>(t: T) {
619} 619}
620"#), 620"#),
621 @r###" 621 @r###"
622 30..34 'self': &Self 622 29..33 'self': &Self
623 64..65 't': T 623 63..64 't': T
624 70..89 '{ ...d(); }': () 624 69..88 '{ ...d(); }': ()
625 76..77 't': T 625 75..76 't': T
626 76..86 't.method()': u32 626 75..85 't.method()': u32
627 "### 627 "###
628 ); 628 );
629} 629}
@@ -640,11 +640,11 @@ fn test<U, T: Trait<U>>(t: T) {
640} 640}
641"#), 641"#),
642 @r###" 642 @r###"
643 33..37 'self': &Self 643 32..36 'self': &Self
644 71..72 't': T 644 70..71 't': T
645 77..96 '{ ...d(); }': () 645 76..95 '{ ...d(); }': ()
646 83..84 't': T 646 82..83 't': T
647 83..93 't.method()': U 647 82..92 't.method()': U
648 "### 648 "###
649 ); 649 );
650} 650}
@@ -666,18 +666,18 @@ fn test() {
666} 666}
667"#), 667"#),
668 @r###" 668 @r###"
669 29..33 'self': Self 669 28..32 'self': Self
670 111..202 '{ ...(S); }': () 670 110..201 '{ ...(S); }': ()
671 121..122 'x': u32 671 120..121 'x': u32
672 130..131 'S': S 672 129..130 'S': S
673 130..138 'S.into()': u32 673 129..137 'S.into()': u32
674 148..149 'y': u64 674 147..148 'y': u64
675 157..158 'S': S 675 156..157 'S': S
676 157..165 'S.into()': u64 676 156..164 'S.into()': u64
677 175..176 'z': u64 677 174..175 'z': u64
678 179..196 'Into::...::into': fn into<S, u64>(S) -> u64 678 178..195 'Into::...::into': fn into<S, u64>(S) -> u64
679 179..199 'Into::...nto(S)': u64 679 178..198 'Into::...nto(S)': u64
680 197..198 'S': S 680 196..197 'S': S
681 "### 681 "###
682 ); 682 );
683} 683}
@@ -1063,13 +1063,13 @@ fn test(d: &dyn Trait) {
1063} 1063}
1064"#), 1064"#),
1065 @r###" 1065 @r###"
1066 52..56 'self': &Self 1066 51..55 'self': &Self
1067 65..70 '{ 0 }': u32 1067 64..69 '{ 0 }': u32
1068 67..68 '0': u32 1068 66..67 '0': u32
1069 177..178 'd': &dyn Trait 1069 176..177 'd': &dyn Trait
1070 192..208 '{ ...o(); }': () 1070 191..207 '{ ...o(); }': ()
1071 198..199 'd': &dyn Trait 1071 197..198 'd': &dyn Trait
1072 198..205 'd.foo()': u32 1072 197..204 'd.foo()': u32
1073 "### 1073 "###
1074 ); 1074 );
1075} 1075}