aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/tests
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2021-02-08 18:13:54 +0000
committerLukas Wirth <[email protected]>2021-02-08 18:13:54 +0000
commit965d31ce5b8315e39f72e40da283d2f3d1367e87 (patch)
treec13f2f34f50295fd96e3e27b8139c239076333eb /crates/hir_ty/src/tests
parent4cc333c889af82931222d5cdf7a5107df1afa834 (diff)
Check for dyn impls in method resolution
Diffstat (limited to 'crates/hir_ty/src/tests')
-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}