Analyze Data Flow: Support callable references
#KT-11994 In Progress
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
// FLOW: IN
|
||||
|
||||
fun foo(f: (Int) -> Int): Int {
|
||||
return f(1)
|
||||
}
|
||||
|
||||
fun test() {
|
||||
fun bar(n: Int) = n
|
||||
val <caret>x = foo(::bar)
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
9 val <bold>x = foo(::bar)</bold>
|
||||
9 val x = <bold>foo(::bar)</bold>
|
||||
3 fun <bold>foo(f: (Int) -> Int): Int {</bold>
|
||||
4 return <bold>f(1)</bold>
|
||||
4 [LAMBDA] return <bold>f</bold>(1)
|
||||
3 [LAMBDA] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
9 [LAMBDA] val x = foo(<bold>::bar</bold>)
|
||||
8 fun <bold>bar(n: Int) = n</bold>
|
||||
8 fun bar(n: Int) = <bold>n</bold>
|
||||
8 fun bar(<bold>n: Int</bold>) = n
|
||||
@@ -0,0 +1,11 @@
|
||||
// FLOW: IN
|
||||
|
||||
fun foo(f: (Int) -> Int): Int {
|
||||
return f(1)
|
||||
}
|
||||
|
||||
fun test() {
|
||||
fun bar(n: Int) = n
|
||||
val f = ::bar
|
||||
val <caret>x = foo(f)
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
10 val <bold>x = foo(f)</bold>
|
||||
10 val x = <bold>foo(f)</bold>
|
||||
3 fun <bold>foo(f: (Int) -> Int): Int {</bold>
|
||||
4 return <bold>f(1)</bold>
|
||||
4 [LAMBDA] return <bold>f</bold>(1)
|
||||
3 [LAMBDA] fun foo(<bold>f: (Int) -> Int</bold>): Int {
|
||||
10 [LAMBDA] val x = foo(<bold>f</bold>)
|
||||
9 [LAMBDA] val <bold>f = ::bar</bold>
|
||||
9 [LAMBDA] val f = <bold>::bar</bold>
|
||||
8 fun <bold>bar(n: Int) = n</bold>
|
||||
8 fun bar(n: Int) = <bold>n</bold>
|
||||
8 fun bar(<bold>n: Int</bold>) = n
|
||||
@@ -0,0 +1,6 @@
|
||||
// FLOW: IN
|
||||
|
||||
fun test() {
|
||||
fun bar(n: Int) = n
|
||||
val <caret>x = (::bar)(1)
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
5 val <bold>x = (::bar)(1)</bold>
|
||||
5 val x = <bold>(::bar)(1)</bold>
|
||||
5 [LAMBDA] val x = <bold>(::bar)</bold>(1)
|
||||
4 fun <bold>bar(n: Int) = n</bold>
|
||||
4 fun bar(n: Int) = <bold>n</bold>
|
||||
4 fun bar(<bold>n: Int</bold>) = n
|
||||
Reference in New Issue
Block a user