diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-02-08 18:22:35 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-02-08 18:22:35 +0000 |
commit | 876c4519e37db3cd134efb5dda604ac5a29c3853 (patch) | |
tree | 1e6712e32800db2f1d69c7bbbbaa7bc46f0223af /crates/hir_ty/src/tests | |
parent | 669efad231ec95ab4b80ab5b083beed233d17843 (diff) | |
parent | 965d31ce5b8315e39f72e40da283d2f3d1367e87 (diff) |
Merge #7602
7602: Check for dyn impls in method resolution r=flodiebold a=Veykril
Fixes #6777
Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/tests')
-rw-r--r-- | crates/hir_ty/src/tests/method_resolution.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/crates/hir_ty/src/tests/method_resolution.rs b/crates/hir_ty/src/tests/method_resolution.rs index a6a54e542..80e795fbf 100644 --- a/crates/hir_ty/src/tests/method_resolution.rs +++ b/crates/hir_ty/src/tests/method_resolution.rs | |||
@@ -1106,3 +1106,25 @@ fn main() { | |||
1106 | "#, | 1106 | "#, |
1107 | ); | 1107 | ); |
1108 | } | 1108 | } |
1109 | |||
1110 | #[test] | ||
1111 | fn method_on_dyn_impl() { | ||
1112 | check_types( | ||
1113 | r#" | ||
1114 | trait Foo {} | ||
1115 | |||
1116 | impl Foo for u32 {} | ||
1117 | impl dyn Foo { | ||
1118 | pub fn dyn_foo(&self) -> u32 { | ||
1119 | 0 | ||
1120 | } | ||
1121 | } | ||
1122 | |||
1123 | fn main() { | ||
1124 | let f = &42u32 as &dyn Foo<u32>; | ||
1125 | f.dyn_foo(); | ||
1126 | // ^u32 | ||
1127 | } | ||
1128 | "#, | ||
1129 | ); | ||
1130 | } | ||