aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/tests
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2021-03-17 21:30:09 +0000
committerJonas Schievink <[email protected]>2021-03-17 21:30:09 +0000
commita85b32abdc7a9f742e21b1624852eeb04334d4fd (patch)
tree8b861de802f465a266b7a99d95ec581701b62670 /crates/hir_ty/src/tests
parent9d691530d556bdc40262585383a1b18d3a1de07e (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.rs21
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]
3258fn nested_inner_function_calling_self() {
3259 check_infer(
3260 r#"
3261struct S;
3262fn 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}