diff options
author | Jonas Schievink <[email protected]> | 2021-03-17 21:30:09 +0000 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2021-03-17 21:30:09 +0000 |
commit | a85b32abdc7a9f742e21b1624852eeb04334d4fd (patch) | |
tree | 8b861de802f465a266b7a99d95ec581701b62670 /crates/hir_ty/src/tests | |
parent | 9d691530d556bdc40262585383a1b18d3a1de07e (diff) |
Add test for self-calling inner function
Diffstat (limited to 'crates/hir_ty/src/tests')
-rw-r--r-- | crates/hir_ty/src/tests/traits.rs | 21 |
1 files changed, 21 insertions, 0 deletions
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 | } | ||