Skip to content

Commit bdc470c

Browse files
committed
more test
1 parent a2afb95 commit bdc470c

File tree

2 files changed

+44
-2
lines changed

2 files changed

+44
-2
lines changed

crates/ide-completion/src/render.rs

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2070,7 +2070,7 @@ fn test() {
20702070
// Direct Constructor with args
20712071
// Builder
20722072
// Constructor
2073-
// fn with param that returns itself
2073+
// Others
20742074
expect![[r#"
20752075
fn fn_direct_ctr() [type_could_unify]
20762076
fn fn_ctr_with_args(…) [type_could_unify]
@@ -2081,6 +2081,48 @@ fn test() {
20812081
"#]],
20822082
);
20832083

2084+
// Expected 1
2085+
check_relevance(
2086+
r#"
2087+
struct Random;
2088+
2089+
impl Random {
2090+
fn get_i32(&self) -> i32 {}
2091+
fn get_string(&self) -> String {}
2092+
}
2093+
2094+
fn test() {
2095+
let r = Random;
2096+
let name: String = r.$0;
2097+
}
2098+
"#,
2099+
expect![[r#"
2100+
me get_string() [type]
2101+
me get_i32() [type_could_unify]
2102+
"#]],
2103+
);
2104+
2105+
// Expected 2
2106+
check_relevance(
2107+
r#"
2108+
struct Random;
2109+
2110+
impl Random {
2111+
fn get_i32(&self) -> i32 {}
2112+
fn get_string(&self) -> String {}
2113+
}
2114+
2115+
fn age() -> i32 {
2116+
let r = Random;
2117+
r.$0
2118+
}
2119+
"#,
2120+
expect![[r#"
2121+
me get_i32() [type]
2122+
me get_string() [type_could_unify]
2123+
"#]],
2124+
);
2125+
20842126
// Generic 1
20852127
check_relevance(
20862128
r#"

crates/ide-completion/src/render/function.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ fn compute_associated_fn(
203203
// let _: u32 = foo.$0; // baz is preferred as it returns expected u32
204204
CompletionRelevanceAssociatedFnType::ReturnsExpectedType
205205
} else if ret_type.display(db).to_string().ends_with("Builder") {
206-
// -> [..]Builder
206+
// fn([..]) -> [..]Builder
207207
CompletionRelevanceAssociatedFnType::Builder
208208
} else if returns_self_wrapped {
209209
// fn([..]) -> Result<A>

0 commit comments

Comments
 (0)