aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2021-03-09 17:18:35 +0000
committerJonas Schievink <[email protected]>2021-03-09 17:27:23 +0000
commit12f6bdcfd9fe1393887b3be0d0329fcf11492e75 (patch)
tree88a83002c062b99d7a5dbbc61814c5b051b0c8b6 /crates/hir_ty/src
parent6be4f30cae93479c19dfe313ab13b8ffd3f7a27f (diff)
Check ancestor maps when computing traits in scope
Diffstat (limited to 'crates/hir_ty/src')
-rw-r--r--crates/hir_ty/src/tests/traits.rs33
1 files changed, 33 insertions, 0 deletions
diff --git a/crates/hir_ty/src/tests/traits.rs b/crates/hir_ty/src/tests/traits.rs
index 528092082..e185b1c0a 100644
--- a/crates/hir_ty/src/tests/traits.rs
+++ b/crates/hir_ty/src/tests/traits.rs
@@ -3174,6 +3174,39 @@ fn f() {
3174} 3174}
3175 3175
3176#[test] 3176#[test]
3177fn trait_in_scope_with_inner_item() {
3178 check_infer(
3179 r#"
3180mod m {
3181 pub trait Tr {
3182 fn method(&self) -> u8 { 0 }
3183 }
3184
3185 impl Tr for () {}
3186}
3187
3188use m::Tr;
3189
3190fn 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]
3177fn inner_use_in_block() { 3210fn inner_use_in_block() {
3178 check_types( 3211 check_types(
3179 r#" 3212 r#"