File tree Expand file tree Collapse file tree 1 file changed +51
-0
lines changed
crates/ide-completion/src/tests Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Original file line number Diff line number Diff line change @@ -374,6 +374,57 @@ fn main() {
374374 ) ;
375375}
376376
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+ use dep::TestStruct;
403+ use std::boxed::Box;
404+
405+ fn main() {
406+ let test_struct = TestStruct;
407+ test_struct.$0
408+ }
409+ "# ;
410+
411+ check ( fixture, expect ! [ "some_method" ] ) ;
412+
413+ check_edit (
414+ "fmt" ,
415+ fixture,
416+ r#"
417+ use dep::TestStruct;
418+ use std::boxed::Box;
419+
420+ fn main() {
421+ let test_struct = Box::new(TestStruct);
422+ test_struct.fmt()$0
423+ }
424+ "# ,
425+ ) ;
426+ }
427+
377428#[ test]
378429fn trait_method_from_alias ( ) {
379430 let fixture = r#"
You can’t perform that action at this time.
0 commit comments