mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-12 21:28:51 +00:00
Add test from #7273
This commit is contained in:
parent
48ae948b22
commit
d03cfe141c
1 changed files with 45 additions and 0 deletions
|
@ -955,6 +955,51 @@ fn test() { foo.call(); }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn super_trait_impl_return_trait_method_resolution() {
|
||||||
|
check_infer(
|
||||||
|
r#"
|
||||||
|
trait Base {
|
||||||
|
fn foo(self) -> usize;
|
||||||
|
}
|
||||||
|
|
||||||
|
trait Super : Base {}
|
||||||
|
|
||||||
|
fn base1() -> impl Base { loop {} }
|
||||||
|
fn super1() -> impl Super { loop {} }
|
||||||
|
|
||||||
|
fn test(base2: impl Base, super2: impl Super) {
|
||||||
|
base1().foo();
|
||||||
|
super1().foo();
|
||||||
|
base2.foo();
|
||||||
|
super2.foo();
|
||||||
|
}
|
||||||
|
"#,
|
||||||
|
expect![[r#"
|
||||||
|
24..28 'self': Self
|
||||||
|
90..101 '{ loop {} }': !
|
||||||
|
92..99 'loop {}': !
|
||||||
|
97..99 '{}': ()
|
||||||
|
128..139 '{ loop {} }': !
|
||||||
|
130..137 'loop {}': !
|
||||||
|
135..137 '{}': ()
|
||||||
|
149..154 'base2': impl Base
|
||||||
|
167..173 'super2': impl Super
|
||||||
|
187..264 '{ ...o(); }': ()
|
||||||
|
193..198 'base1': fn base1() -> impl Base
|
||||||
|
193..200 'base1()': impl Base
|
||||||
|
193..206 'base1().foo()': usize
|
||||||
|
212..218 'super1': fn super1() -> impl Super
|
||||||
|
212..220 'super1()': impl Super
|
||||||
|
212..226 'super1().foo()': usize
|
||||||
|
232..237 'base2': impl Base
|
||||||
|
232..243 'base2.foo()': usize
|
||||||
|
249..255 'super2': impl Super
|
||||||
|
249..261 'super2.foo()': usize
|
||||||
|
"#]],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn method_resolution_non_parameter_type() {
|
fn method_resolution_non_parameter_type() {
|
||||||
check_types(
|
check_types(
|
||||||
|
|
Loading…
Reference in a new issue