diff options
Diffstat (limited to 'crates/hir_ty/src/tests/traits.rs')
-rw-r--r-- | crates/hir_ty/src/tests/traits.rs | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/crates/hir_ty/src/tests/traits.rs b/crates/hir_ty/src/tests/traits.rs index 1298e5a88..e185b1c0a 100644 --- a/crates/hir_ty/src/tests/traits.rs +++ b/crates/hir_ty/src/tests/traits.rs | |||
@@ -1,5 +1,4 @@ | |||
1 | use expect_test::expect; | 1 | use expect_test::expect; |
2 | use test_utils::mark; | ||
3 | 2 | ||
4 | use super::{check_infer, check_infer_with_mismatches, check_types}; | 3 | use super::{check_infer, check_infer_with_mismatches, check_types}; |
5 | 4 | ||
@@ -319,7 +318,7 @@ fn infer_from_bound_2() { | |||
319 | 318 | ||
320 | #[test] | 319 | #[test] |
321 | fn trait_default_method_self_bound_implements_trait() { | 320 | fn trait_default_method_self_bound_implements_trait() { |
322 | mark::check!(trait_self_implements_self); | 321 | cov_mark::check!(trait_self_implements_self); |
323 | check_infer( | 322 | check_infer( |
324 | r#" | 323 | r#" |
325 | trait Trait { | 324 | trait Trait { |
@@ -1189,7 +1188,7 @@ fn impl_trait() { | |||
1189 | 1188 | ||
1190 | #[test] | 1189 | #[test] |
1191 | fn simple_return_pos_impl_trait() { | 1190 | fn simple_return_pos_impl_trait() { |
1192 | mark::check!(lower_rpit); | 1191 | cov_mark::check!(lower_rpit); |
1193 | check_infer( | 1192 | check_infer( |
1194 | r#" | 1193 | r#" |
1195 | trait Trait<T> { | 1194 | trait Trait<T> { |
@@ -3175,6 +3174,39 @@ fn f() { | |||
3175 | } | 3174 | } |
3176 | 3175 | ||
3177 | #[test] | 3176 | #[test] |
3177 | fn trait_in_scope_with_inner_item() { | ||
3178 | check_infer( | ||
3179 | r#" | ||
3180 | mod m { | ||
3181 | pub trait Tr { | ||
3182 | fn method(&self) -> u8 { 0 } | ||
3183 | } | ||
3184 | |||
3185 | impl Tr for () {} | ||
3186 | } | ||
3187 | |||
3188 | use m::Tr; | ||
3189 | |||
3190 | fn f() { | ||
3191 | fn inner() { | ||
3192 | ().method(); | ||
3193 | //^^^^^^^^^^^ u8 | ||
3194 | } | ||
3195 | } | ||
3196 | "#, | ||
3197 | expect![[r#" | ||
3198 | 46..50 'self': &Self | ||
3199 | 58..63 '{ 0 }': u8 | ||
3200 | 60..61 '0': u8 | ||
3201 | 115..185 '{ ... } }': () | ||
3202 | 132..183 '{ ... }': () | ||
3203 | 142..144 '()': () | ||
3204 | 142..153 '().method()': u8 | ||
3205 | "#]], | ||
3206 | ); | ||
3207 | } | ||
3208 | |||
3209 | #[test] | ||
3178 | fn inner_use_in_block() { | 3210 | fn inner_use_in_block() { |
3179 | check_types( | 3211 | check_types( |
3180 | r#" | 3212 | r#" |