diff options
Diffstat (limited to 'crates/hir_ty/src/tests')
-rw-r--r-- | crates/hir_ty/src/tests/simple.rs | 19 | ||||
-rw-r--r-- | crates/hir_ty/src/tests/traits.rs | 21 |
2 files changed, 40 insertions, 0 deletions
diff --git a/crates/hir_ty/src/tests/simple.rs b/crates/hir_ty/src/tests/simple.rs index f5069eba5..bcc43ed70 100644 --- a/crates/hir_ty/src/tests/simple.rs +++ b/crates/hir_ty/src/tests/simple.rs | |||
@@ -2545,3 +2545,22 @@ fn test() { | |||
2545 | "#]], | 2545 | "#]], |
2546 | ) | 2546 | ) |
2547 | } | 2547 | } |
2548 | |||
2549 | #[test] | ||
2550 | fn cfgd_out_assoc_items() { | ||
2551 | check_types( | ||
2552 | r#" | ||
2553 | struct S; | ||
2554 | |||
2555 | impl S { | ||
2556 | #[cfg(FALSE)] | ||
2557 | const C: S = S; | ||
2558 | } | ||
2559 | |||
2560 | fn f() { | ||
2561 | S::C; | ||
2562 | //^^^^ {unknown} | ||
2563 | } | ||
2564 | "#, | ||
2565 | ) | ||
2566 | } | ||
diff --git a/crates/hir_ty/src/tests/traits.rs b/crates/hir_ty/src/tests/traits.rs index 93d3ad020..8270fa219 100644 --- a/crates/hir_ty/src/tests/traits.rs +++ b/crates/hir_ty/src/tests/traits.rs | |||
@@ -3253,3 +3253,24 @@ fn f() { | |||
3253 | "#, | 3253 | "#, |
3254 | ); | 3254 | ); |
3255 | } | 3255 | } |
3256 | |||
3257 | #[test] | ||
3258 | fn nested_inner_function_calling_self() { | ||
3259 | check_infer( | ||
3260 | r#" | ||
3261 | struct S; | ||
3262 | fn f() { | ||
3263 | fn inner() -> S { | ||
3264 | let s = inner(); | ||
3265 | } | ||
3266 | } | ||
3267 | "#, | ||
3268 | expect![[r#" | ||
3269 | 17..73 '{ ... } }': () | ||
3270 | 39..71 '{ ... }': () | ||
3271 | 53..54 's': S | ||
3272 | 57..62 'inner': fn inner() -> S | ||
3273 | 57..64 'inner()': S | ||
3274 | "#]], | ||
3275 | ) | ||
3276 | } | ||