aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/tests/method_resolution.rs
diff options
context:
space:
mode:
authorBenjamin Coenen <[email protected]>2020-05-21 09:53:29 +0100
committerBenjamin Coenen <[email protected]>2020-05-21 09:53:29 +0100
commita7c8aa7c60c05db66ba4e89ae9e05c82e62507a5 (patch)
treee848f47bdf5d031c408df94222f595d2efcb2070 /crates/ra_hir_ty/src/tests/method_resolution.rs
parentc6143742bd4e625d391ac3ea860be7578ab9f53f (diff)
parenta4e6963a2313971fe7bbec97d03bc67266ef68a9 (diff)
add support of feature flag for runnables #4464
Signed-off-by: Benjamin Coenen <[email protected]>
Diffstat (limited to 'crates/ra_hir_ty/src/tests/method_resolution.rs')
-rw-r--r--crates/ra_hir_ty/src/tests/method_resolution.rs33
1 files changed, 32 insertions, 1 deletions
diff --git a/crates/ra_hir_ty/src/tests/method_resolution.rs b/crates/ra_hir_ty/src/tests/method_resolution.rs
index 67f964ab5..558a70022 100644
--- a/crates/ra_hir_ty/src/tests/method_resolution.rs
+++ b/crates/ra_hir_ty/src/tests/method_resolution.rs
@@ -984,7 +984,7 @@ fn test() { S2.into()<|>; }
984 984
985#[test] 985#[test]
986fn method_resolution_overloaded_method() { 986fn method_resolution_overloaded_method() {
987 test_utils::covers!(impl_self_type_match_without_receiver); 987 test_utils::mark::check!(impl_self_type_match_without_receiver);
988 let t = type_at( 988 let t = type_at(
989 r#" 989 r#"
990//- main.rs 990//- main.rs
@@ -1096,3 +1096,34 @@ fn test() { (S {}).method()<|>; }
1096 ); 1096 );
1097 assert_eq!(t, "()"); 1097 assert_eq!(t, "()");
1098} 1098}
1099
1100#[test]
1101fn dyn_trait_super_trait_not_in_scope() {
1102 assert_snapshot!(
1103 infer(r#"
1104mod m {
1105 pub trait SuperTrait {
1106 fn foo(&self) -> u32 { 0 }
1107 }
1108}
1109trait Trait: m::SuperTrait {}
1110
1111struct S;
1112impl m::SuperTrait for S {}
1113impl Trait for S {}
1114
1115fn test(d: &dyn Trait) {
1116 d.foo();
1117}
1118"#),
1119 @r###"
1120 52..56 'self': &Self
1121 65..70 '{ 0 }': u32
1122 67..68 '0': u32
1123 177..178 'd': &dyn Trait
1124 192..208 '{ ...o(); }': ()
1125 198..199 'd': &dyn Trait
1126 198..205 'd.foo()': u32
1127 "###
1128 );
1129}