Unnamed repository; edit this file 'description' to name the repository.
Add test for private method inference fallback
Lukas Wirth 2022-12-31
parent 5d54c55 · commit 1d782a9
-rw-r--r--crates/hir-ty/src/tests/method_resolution.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/crates/hir-ty/src/tests/method_resolution.rs b/crates/hir-ty/src/tests/method_resolution.rs
index b6958c362c..6c7a532997 100644
--- a/crates/hir-ty/src/tests/method_resolution.rs
+++ b/crates/hir-ty/src/tests/method_resolution.rs
@@ -1896,3 +1896,24 @@ impl dyn Error + Send {
"#,
);
}
+
+#[test]
+fn fallback_private_methods() {
+ check(
+ r#"
+mod module {
+ pub struct Struct;
+
+ impl Struct {
+ fn func(&self) {}
+ }
+}
+
+fn foo() {
+ let s = module::Struct;
+ s.func();
+ //^^^^^^^^ type: ()
+}
+"#,
+ );
+}