File tree Expand file tree Collapse file tree 1 file changed +66
-0
lines changed
crates/ide-completion/src/tests Expand file tree Collapse file tree 1 file changed +66
-0
lines changed Original file line number Diff line number Diff line change @@ -374,6 +374,72 @@ fn main() {
374
374
) ;
375
375
}
376
376
377
+ #[ test]
378
+ fn trait_method_fuzzy_completion_aware_of_fundamental_traits ( ) {
379
+ let fixture = r#"
380
+ //- /std.rs crate:std
381
+ pub mod boxed {
382
+ #[lang = "owned_box"]
383
+ #[fundamental]
384
+ pub struct Box<T>(T);
385
+ }
386
+
387
+ //- /trait-dep.rs crate:trait-dep deps:std
388
+ pub trait TestTrait {
389
+ fn some_method(&self) -> Result;
390
+ }
391
+
392
+ //- /lib.rs crate:dep deps:std,trait-dep
393
+ pub struct TestStruct;
394
+
395
+ impl<T> trait_dep::TestTrait for TestStruct {
396
+ fn some_method(&self) -> Result {
397
+ todo!()
398
+ }
399
+ }
400
+
401
+ //- /main.rs crate:main deps:dep,trait-dep,std
402
+ pub struct TestStruct;
403
+
404
+ impl<T> trait_dep::TestTrait for TestStruct {
405
+ fn some_method(&self) -> Result {
406
+ todo!()
407
+ }
408
+ }
409
+
410
+ fn main() {
411
+ let test_struct = TestStruct;
412
+ test_struct.$0
413
+ }"# ;
414
+
415
+ check (
416
+ fixture,
417
+ expect ! [ [ r#"
418
+ me some_method() (use trait_dep::TestTrait) fn(&self) -> {unknown}
419
+ "# ] ] ,
420
+ ) ;
421
+
422
+ check_edit (
423
+ "some_method" ,
424
+ fixture,
425
+ r#"
426
+ use trait_dep::TestTrait;
427
+
428
+ pub struct TestStruct;
429
+
430
+ impl<T> trait_dep::TestTrait for TestStruct {
431
+ fn some_method(&self) -> Result {
432
+ todo!()
433
+ }
434
+ }
435
+
436
+ fn main() {
437
+ let test_struct = TestStruct;
438
+ test_struct.some_method()$0
439
+ }"# ,
440
+ ) ;
441
+ }
442
+
377
443
#[ test]
378
444
fn trait_method_from_alias ( ) {
379
445
let fixture = r#"
You can’t perform that action at this time.
0 commit comments