diff --git a/crates/ide-completion/src/tests/flyimport.rs b/crates/ide-completion/src/tests/flyimport.rs index fff193ba4c9b..5548dc519e3f 100644 --- a/crates/ide-completion/src/tests/flyimport.rs +++ b/crates/ide-completion/src/tests/flyimport.rs @@ -374,6 +374,57 @@ fn main() { ); } +#[test] +fn trait_method_fuzzy_completion_aware_of_fundamental_traits() { + let fixture = r#" +//- /std.rs crate:std +pub mod boxed { + #[lang = "owned_box"] + #[fundamental] + pub struct Box(T); +} + +//- /trait-dep.rs crate:trait-dep deps:std +pub trait TestTrait { + fn some_method(&self) -> Result; +} + +//- /lib.rs crate:dep deps:std,trait-dep +pub struct TestStruct; + +impl trait_dep::TestTrait for TestStruct { + fn some_method(&self) -> Result { + todo!() + } +} + +//- /main.rs crate:main deps:dep,trait-dep,std +use dep::TestStruct; +use std::boxed::Box; + +fn main() { + let test_struct = TestStruct; + test_struct.$0 +} + "#; + + check(fixture, expect!["some_method"]); + + check_edit( + "fmt", + fixture, + r#" +use dep::TestStruct; +use std::boxed::Box; + +fn main() { + let test_struct = Box::new(TestStruct); + test_struct.fmt()$0 +} +"#, + ); +} + #[test] fn trait_method_from_alias() { let fixture = r#"