aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/tests/method_resolution.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_ty/src/tests/method_resolution.rs')
-rw-r--r--crates/hir_ty/src/tests/method_resolution.rs22
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]
1111fn method_on_dyn_impl() {
1112 check_types(
1113 r#"
1114trait Foo {}
1115
1116impl Foo for u32 {}
1117impl dyn Foo {
1118 pub fn dyn_foo(&self) -> u32 {
1119 0
1120 }
1121}
1122
1123fn main() {
1124 let f = &42u32 as &dyn Foo<u32>;
1125 f.dyn_foo();
1126 // ^u32
1127}
1128"#,
1129 );
1130}