Resolve local function parameters with function inner scope

This allows to use type parameters and value paramters in default value expressions

 #KT-7984 Fixed
 #KT-7985 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2017-04-14 16:10:52 +03:00
parent e86d52b681
commit b17b3f4c63
17 changed files with 121 additions and 4 deletions
@@ -1,4 +1,5 @@
// PARAM_TYPES: kotlin.Int
// PARAM_DESCRIPTOR: value-parameter a: kotlin.Int defined in bar.foo
fun bar(n: Int) {
fun foo(a: Int, b: Int = <selection>a + n</selection>) = a + b - n - 1
}
@@ -0,0 +1,7 @@
// PARAM_TYPES: kotlin.Int
// PARAM_DESCRIPTOR: value-parameter a: kotlin.Int defined in bar.foo
fun bar(n: Int) {
fun i(a: Int) = a + n
fun foo(a: Int, b: Int = i(a)) = a + b - n - 1
}
@@ -1 +0,0 @@
Cannot generate function with erroneous return type
@@ -1,4 +1,5 @@
// PARAM_TYPES: kotlin.Int
// PARAM_DESCRIPTOR: value-parameter a: kotlin.Int defined in bar.foo
fun bar(n: Int) {
fun foo(a: Int, b: Int = { <selection>a + n</selection> }.invoke()) = a + b - n - 1
}
@@ -0,0 +1,7 @@
// PARAM_TYPES: kotlin.Int
// PARAM_DESCRIPTOR: value-parameter a: kotlin.Int defined in bar.foo
fun bar(n: Int) {
fun i(a: Int) = a + n
fun foo(a: Int, b: Int = { i(a) }.invoke()) = a + b - n - 1
}
@@ -1 +0,0 @@
Cannot generate function with erroneous return type