[kotlin] Provide CFG facade for the extract function refactoring
This is the first implementation of a control flow graph facade for the extract function IDE refactoring. The exact contents of 'KtDataFlowExitPointSnapshot' will be refined later. ^KT-65762 Fixed
This commit is contained in:
@@ -92,7 +92,8 @@ public abstract class KtAnalysisSession(final override val token: KtLifetimeToke
|
||||
KtResolveExtensionInfoProviderMixIn,
|
||||
KtCompilerFacilityMixIn,
|
||||
KtMetadataCalculatorMixIn,
|
||||
KtSubstitutorProviderMixIn {
|
||||
KtSubstitutorProviderMixIn,
|
||||
KtDataFlowInfoProviderMixin {
|
||||
|
||||
public abstract val useSiteModule: KtModule
|
||||
|
||||
@@ -213,6 +214,11 @@ public abstract class KtAnalysisSession(final override val token: KtLifetimeToke
|
||||
|
||||
internal val substitutorProvider: KtSubstitutorProvider get() = substitutorProviderImpl
|
||||
protected abstract val substitutorProviderImpl: KtSubstitutorProvider
|
||||
|
||||
@KtAnalysisNonPublicApi
|
||||
internal val dataFlowInfoProvider: KtDataFlowInfoProvider get() = dataFlowInfoProviderImpl
|
||||
@KtAnalysisNonPublicApi
|
||||
protected abstract val dataFlowInfoProviderImpl: KtDataFlowInfoProvider
|
||||
}
|
||||
|
||||
public fun KtAnalysisSession.getModule(element: PsiElement): KtModule {
|
||||
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.analysis.api.components
|
||||
|
||||
import org.jetbrains.kotlin.analysis.api.KtAnalysisNonPublicApi
|
||||
import org.jetbrains.kotlin.analysis.api.lifetime.withValidityAssertion
|
||||
import org.jetbrains.kotlin.analysis.api.symbols.KtVariableLikeSymbol
|
||||
import org.jetbrains.kotlin.analysis.api.types.KtType
|
||||
import org.jetbrains.kotlin.psi.KtExpression
|
||||
import org.jetbrains.kotlin.psi.KtReturnExpression
|
||||
|
||||
@KtAnalysisNonPublicApi
|
||||
public abstract class KtDataFlowInfoProvider : KtAnalysisSessionComponent() {
|
||||
public abstract fun getExitPointSnapshot(statements: List<KtExpression>): KtDataFlowExitPointSnapshot
|
||||
}
|
||||
|
||||
@KtAnalysisNonPublicApi
|
||||
public interface KtDataFlowInfoProviderMixin : KtAnalysisSessionMixIn {
|
||||
public fun getExitPointSnapshot(statements: List<KtExpression>): KtDataFlowExitPointSnapshot = withValidityAssertion {
|
||||
return analysisSession.dataFlowInfoProvider.getExitPointSnapshot(statements)
|
||||
}
|
||||
}
|
||||
|
||||
@KtAnalysisNonPublicApi
|
||||
public class KtDataFlowExitPointSnapshot(
|
||||
/**
|
||||
* A default expression, if any.
|
||||
* @see [DefaultExpressionInfo] for more information.
|
||||
*/
|
||||
public val defaultExpressionInfo: DefaultExpressionInfo?,
|
||||
|
||||
/**
|
||||
* A list of [KtReturnExpression]s that return a value.
|
||||
*/
|
||||
public val valuedReturnExpressions: List<KtReturnExpression>,
|
||||
|
||||
/**
|
||||
* A common supertype of values returned in [valuedReturnExpressions].
|
||||
*/
|
||||
public val returnValueType: KtType?,
|
||||
|
||||
/**
|
||||
* `break` and `continue` jump expressions.
|
||||
* @see [hasJumps] for the definition of jumps.
|
||||
*/
|
||||
public val loopJumpExpressions: List<KtExpression>,
|
||||
|
||||
/**
|
||||
* `true` if there are any control-flow statements that jump outside given statements.
|
||||
* Jumps include both loop jumps (`break` and `continue`) and `return`s.
|
||||
* Conditional blocks (`if`) and `throw`s are not considered as jumps.
|
||||
*/
|
||||
public val hasJumps: Boolean,
|
||||
|
||||
/**
|
||||
* `true` if next-executed instructions for the potential default expression and jump expressions are different.
|
||||
*/
|
||||
public val hasEscapingJumps: Boolean,
|
||||
|
||||
/**
|
||||
* `true` if there are jumps of different kinds (e.g., there is both a `break` and a `return`).
|
||||
*/
|
||||
public val hasMultipleJumpKinds: Boolean,
|
||||
|
||||
/**
|
||||
* `true` if two or more jumps have different next-executed instructions. Such as, there are both inner and outer loop `break`s.
|
||||
*/
|
||||
public val hasMultipleJumpTargets: Boolean,
|
||||
|
||||
/**
|
||||
* local variable reassignments found in given statements.
|
||||
*/
|
||||
public val variableReassignments: List<VariableReassignment>
|
||||
) {
|
||||
/**
|
||||
* Represents a default expression (generally, a last given statement if it has a meaningful result type).
|
||||
* Expressions that always return [Nothing], such as `return`, `break`, `continue` or `throw`, cannot be default expressions.
|
||||
*/
|
||||
public class DefaultExpressionInfo(
|
||||
/** The default expression. */
|
||||
public val expression: KtExpression,
|
||||
|
||||
/** The default expression type. */
|
||||
public val type: KtType
|
||||
)
|
||||
|
||||
/**
|
||||
* Represents a local variable reassignment.
|
||||
*/
|
||||
public class VariableReassignment(
|
||||
/** The reassignment expression. */
|
||||
public val expression: KtExpression,
|
||||
|
||||
/** Reassigned variable symbol. */
|
||||
public val variable: KtVariableLikeSymbol,
|
||||
|
||||
/** `true` if the variable is both read and set (as in `x += y` or `x++`). */
|
||||
public val isAugmented: Boolean
|
||||
)
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
fun test() {
|
||||
while (cond()) {
|
||||
<expr>if (foo() == 5) {
|
||||
break
|
||||
} else if (foo() == 6) {
|
||||
continue
|
||||
}</expr>
|
||||
consume("foo")
|
||||
}
|
||||
}
|
||||
|
||||
fun cond(): Boolean = true
|
||||
|
||||
fun foo(): Int = 0
|
||||
|
||||
fun consume(text: String?) = {}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = if (foo() == 5) {
|
||||
break
|
||||
} else if (foo() == 6) {
|
||||
continue
|
||||
}
|
||||
type = kotlin.Unit
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = true
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = [
|
||||
break,
|
||||
continue
|
||||
]
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
fun test() {
|
||||
while (cond()) {
|
||||
<expr>if (foo() == 5) {
|
||||
break
|
||||
} else if (foo() == 6) {
|
||||
return
|
||||
}</expr>
|
||||
consume("foo")
|
||||
}
|
||||
}
|
||||
|
||||
fun cond(): Boolean = true
|
||||
|
||||
fun foo(): Int = 0
|
||||
|
||||
fun consume(text: String?) = {}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = if (foo() == 5) {
|
||||
break
|
||||
} else if (foo() == 6) {
|
||||
return
|
||||
}
|
||||
type = kotlin.Unit
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = true
|
||||
hasMultipleJumpTargets = true
|
||||
loopJumpExpressions = [
|
||||
break
|
||||
]
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
fun test(): Int {
|
||||
while (cond()) {
|
||||
<expr>if (foo() == 5) {
|
||||
return 1
|
||||
} else if (foo() == 6) {
|
||||
break
|
||||
}</expr>
|
||||
consume("foo")
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
fun cond(): Boolean = true
|
||||
|
||||
fun foo(): Int = 0
|
||||
|
||||
fun consume(text: String?) = {}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = if (foo() == 5) {
|
||||
return 1
|
||||
} else if (foo() == 6) {
|
||||
break
|
||||
}
|
||||
type = kotlin.Unit
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = true
|
||||
hasMultipleJumpTargets = true
|
||||
loopJumpExpressions = [
|
||||
break
|
||||
]
|
||||
returnValueType = kotlin.Int
|
||||
valuedReturnExpressions = [
|
||||
return 1
|
||||
]
|
||||
variableReassignments = []
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// WITH_STDLIB
|
||||
|
||||
fun test(a: Int): Int {
|
||||
val b: Int = a + 10
|
||||
for (n in 1..b) {
|
||||
<expr>if (n > 5) throw Exception("")
|
||||
if (a + n > b) break
|
||||
println(b - n)</expr>
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = println(b - n)
|
||||
type = kotlin.Unit
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = [
|
||||
break
|
||||
]
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fun foo(a: Int): Int {
|
||||
val b: Int = 1
|
||||
for (n in 1..a) {
|
||||
<expr>if (a + b > 0) break
|
||||
consume(a - b)
|
||||
if (a - b > 0) break
|
||||
consume(a + b)</expr>
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
fun consume(obj: Any?) {}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = consume(a + b)
|
||||
type = kotlin.Unit
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = [
|
||||
break,
|
||||
break
|
||||
]
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
fun foo(a: Int): Int {
|
||||
val b: Int = 1
|
||||
for (n in 1..a) {
|
||||
<expr>if (a + b > 0) break
|
||||
val c: Int
|
||||
consume(a - b)
|
||||
if (a - b > 0) break
|
||||
consume(a + b)</expr>
|
||||
c = 1
|
||||
consume(c)
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
fun consume(obj: Any?) {}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = consume(a + b)
|
||||
type = kotlin.Unit
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = [
|
||||
break,
|
||||
break
|
||||
]
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
fun foo(a: Int): Int {
|
||||
val b: Int = 1
|
||||
for (n in 1..a) {
|
||||
<expr>if (a + b > 0) break
|
||||
else {
|
||||
consume(a - b)
|
||||
if (a - b > 0) break else consume(a + b)
|
||||
}
|
||||
</expr>
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
fun consume(obj: Any?) {}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = if (a + b > 0) break
|
||||
else {
|
||||
consume(a - b)
|
||||
if (a - b > 0) break else consume(a + b)
|
||||
}
|
||||
type = kotlin.Unit
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = [
|
||||
break,
|
||||
break
|
||||
]
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
fun foo(a: Int): Int {
|
||||
val b: Int = 1
|
||||
for (n in 1..a) {
|
||||
<expr>when {
|
||||
a + b > 0 -> break
|
||||
a - b > 0 -> break
|
||||
else -> consume(0)
|
||||
}</expr>
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
fun consume(obj: Any?) {}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = when {
|
||||
a + b > 0 -> break
|
||||
a - b > 0 -> break
|
||||
else -> consume(0)
|
||||
}
|
||||
type = kotlin.Unit
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = [
|
||||
break,
|
||||
break
|
||||
]
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fun foo(a: Int): Int {
|
||||
val b: Int = 1
|
||||
<expr>if (a + b > 0) return 0
|
||||
consume(a - b)</expr>
|
||||
return 1
|
||||
}
|
||||
|
||||
fun consume(obj: Any?) {}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = consume(a - b)
|
||||
type = kotlin.Unit
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = []
|
||||
returnValueType = kotlin.Int
|
||||
valuedReturnExpressions = [
|
||||
return 0
|
||||
]
|
||||
variableReassignments = []
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fun foo(a: Int): Int {
|
||||
val b: Int = 1
|
||||
<expr>when (a + b) {
|
||||
0 -> return 0
|
||||
1 -> consume(1)
|
||||
else -> consume(2)
|
||||
}
|
||||
</expr>
|
||||
return 1
|
||||
}
|
||||
|
||||
fun consume(obj: Any?) {}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = when (a + b) {
|
||||
0 -> return 0
|
||||
1 -> consume(1)
|
||||
else -> consume(2)
|
||||
}
|
||||
type = kotlin.Unit
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = []
|
||||
returnValueType = kotlin.Int
|
||||
valuedReturnExpressions = [
|
||||
return 0
|
||||
]
|
||||
variableReassignments = []
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fun foo(a: Int): Int {
|
||||
val b: Int = 1
|
||||
<expr>if (a + b > 0) return 0
|
||||
else if (a - b < 0) consume(a - b)
|
||||
else consume(0)</expr>
|
||||
return 1
|
||||
}
|
||||
|
||||
fun consume(obj: Any?) {}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = if (a + b > 0) return 0
|
||||
else if (a - b < 0) consume(a - b)
|
||||
else consume(0)
|
||||
type = kotlin.Unit
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = []
|
||||
returnValueType = kotlin.Int
|
||||
valuedReturnExpressions = [
|
||||
return 0
|
||||
]
|
||||
variableReassignments = []
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
fun test() {
|
||||
while (cond()) {
|
||||
<expr>if (foo() == 5) {
|
||||
continue
|
||||
} else if (foo() == 6) {
|
||||
return
|
||||
}</expr>
|
||||
consume("foo")
|
||||
}
|
||||
}
|
||||
|
||||
fun cond(): Boolean = true
|
||||
|
||||
fun foo(): Int = 0
|
||||
|
||||
fun consume(text: String?) = {}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = if (foo() == 5) {
|
||||
continue
|
||||
} else if (foo() == 6) {
|
||||
return
|
||||
}
|
||||
type = kotlin.Unit
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = true
|
||||
hasMultipleJumpTargets = true
|
||||
loopJumpExpressions = [
|
||||
continue
|
||||
]
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
fun test(): Int {
|
||||
while (cond()) {
|
||||
<expr>if (foo() == 5) {
|
||||
return 1
|
||||
} else if (foo() == 6) {
|
||||
continue
|
||||
}</expr>
|
||||
consume("foo")
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
fun cond(): Boolean = true
|
||||
|
||||
fun foo(): Int = 0
|
||||
|
||||
fun consume(text: String?) = {}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = if (foo() == 5) {
|
||||
return 1
|
||||
} else if (foo() == 6) {
|
||||
continue
|
||||
}
|
||||
type = kotlin.Unit
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = true
|
||||
hasMultipleJumpTargets = true
|
||||
loopJumpExpressions = [
|
||||
continue
|
||||
]
|
||||
returnValueType = kotlin.Int
|
||||
valuedReturnExpressions = [
|
||||
return 1
|
||||
]
|
||||
variableReassignments = []
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// WITH_STDLIB
|
||||
|
||||
fun test() {
|
||||
consume(1)
|
||||
<expr>try {
|
||||
dangerous()
|
||||
} catch (e: FooException) {
|
||||
consume(e.message?.length ?: 0)
|
||||
"error"
|
||||
}</expr>
|
||||
}
|
||||
|
||||
fun consume(n: Int) {}
|
||||
|
||||
@Throws(FooException::class)
|
||||
fun dangerous(): String {
|
||||
return "foo"
|
||||
}
|
||||
|
||||
class FooException : Exception()
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = try {
|
||||
dangerous()
|
||||
} catch (e: FooException) {
|
||||
consume(e.message?.length ?: 0)
|
||||
"error"
|
||||
}
|
||||
type = kotlin.String
|
||||
hasEscapingJumps = false
|
||||
hasJumps = false
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = []
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// WITH_STDLIB
|
||||
|
||||
fun test() {
|
||||
consume(1)
|
||||
<expr>try {
|
||||
dangerous()
|
||||
} catch (e: FooException) {
|
||||
consume(e.message?.length ?: 0)
|
||||
throw e
|
||||
}</expr>
|
||||
}
|
||||
|
||||
fun consume(n: Int) {}
|
||||
|
||||
@Throws(FooException::class)
|
||||
fun dangerous(): String {
|
||||
return "foo"
|
||||
}
|
||||
|
||||
class FooException : Exception()
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = try {
|
||||
dangerous()
|
||||
} catch (e: FooException) {
|
||||
consume(e.message?.length ?: 0)
|
||||
throw e
|
||||
}
|
||||
type = kotlin.String
|
||||
hasEscapingJumps = false
|
||||
hasJumps = false
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = []
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
fun foo(a: Int): Int {
|
||||
val b: Int = 1
|
||||
<expr>if (a + b > 0) return 1
|
||||
else if (a - b < 0) return 2
|
||||
else return b</expr>
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = null
|
||||
hasEscapingJumps = false
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = []
|
||||
returnValueType = kotlin.Int
|
||||
valuedReturnExpressions = [
|
||||
return 1,
|
||||
return 2,
|
||||
return b
|
||||
]
|
||||
variableReassignments = []
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fun foo(a: Int): Int {
|
||||
val b: Int = 1
|
||||
<expr>when (a + b) {
|
||||
0 -> return b
|
||||
1 -> return -b
|
||||
else -> return a - b
|
||||
}</expr>
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = null
|
||||
hasEscapingJumps = false
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = []
|
||||
returnValueType = kotlin.Int
|
||||
valuedReturnExpressions = [
|
||||
return b,
|
||||
return -b,
|
||||
return a - b
|
||||
]
|
||||
variableReassignments = []
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
fun foo(a: Int): Int {
|
||||
a.let {
|
||||
<expr>if (it > 0) return it else return@foo -it</expr>
|
||||
}
|
||||
return 0
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = null
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = []
|
||||
returnValueType = kotlin.Int
|
||||
valuedReturnExpressions = [
|
||||
return it,
|
||||
return@foo -it
|
||||
]
|
||||
variableReassignments = []
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
fun foo(a: Int): Int {
|
||||
a.let {
|
||||
<expr>if (it > 0) return@foo it else return -it</expr>
|
||||
}
|
||||
return 0
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = null
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = []
|
||||
returnValueType = kotlin.Int
|
||||
valuedReturnExpressions = [
|
||||
return@foo it,
|
||||
return -it
|
||||
]
|
||||
variableReassignments = []
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
fun test() {
|
||||
outer@ while (cond()) {
|
||||
consume(1)
|
||||
while (cond()) {
|
||||
consume(2)
|
||||
<expr>if (cond()) {
|
||||
break
|
||||
} else if (cond()) {
|
||||
break@outer
|
||||
}</expr>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun consume(obj: Any?) {}
|
||||
|
||||
fun cond(): Boolean = true
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = if (cond()) {
|
||||
break
|
||||
} else if (cond()) {
|
||||
break@outer
|
||||
}
|
||||
type = kotlin.Unit
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = true
|
||||
loopJumpExpressions = [
|
||||
break,
|
||||
break@outer
|
||||
]
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
fun test(flag: Boolean): Int {
|
||||
block {
|
||||
<expr>if (flag) {
|
||||
return 1
|
||||
}
|
||||
|
||||
consume("foo")
|
||||
return@block</expr>
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
inline fun block(block: () -> Unit) {}
|
||||
|
||||
fun consume(obj: Any?) {}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = null
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = true
|
||||
loopJumpExpressions = []
|
||||
returnValueType = kotlin.Int
|
||||
valuedReturnExpressions = [
|
||||
return 1
|
||||
]
|
||||
variableReassignments = []
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fun foo(a: Int) {
|
||||
val b: Int = 1
|
||||
for (n in 1..b) {
|
||||
<expr>if (a > 0) throw Exception("")
|
||||
if (a + b > 0) break
|
||||
consume(a - b)
|
||||
return</expr>
|
||||
}
|
||||
}
|
||||
|
||||
fun consume(obj: Any?) {}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = null
|
||||
hasEscapingJumps = false
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = true
|
||||
hasMultipleJumpTargets = true
|
||||
loopJumpExpressions = [
|
||||
break
|
||||
]
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
fun foo(a: Int) {
|
||||
val b: Int = 1
|
||||
loop1@ for (p in 1..b) {
|
||||
loop2@ for (n in 1..b) {
|
||||
<expr>if (a > 0) throw Exception("")
|
||||
if (a + b > 0) break@loop2
|
||||
if (a - b > 0) continue@loop1</expr>
|
||||
}
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = if (a - b > 0) continue@loop1
|
||||
type = kotlin.Unit
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = true
|
||||
hasMultipleJumpTargets = true
|
||||
loopJumpExpressions = [
|
||||
break@loop2,
|
||||
continue@loop1
|
||||
]
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fun foo(a: Int) {
|
||||
val b: Int = 1
|
||||
for (n in 1..b) {
|
||||
<expr>if (a > 0) throw Exception("")
|
||||
if (a + b > 0) continue
|
||||
consume(a - b)
|
||||
return</expr>
|
||||
}
|
||||
}
|
||||
|
||||
fun consume(obj: Any?) {}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = null
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = true
|
||||
hasMultipleJumpTargets = true
|
||||
loopJumpExpressions = [
|
||||
continue
|
||||
]
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
fun foo(a: Int) {
|
||||
val b: Int = 1
|
||||
for (n in 1..b) {
|
||||
<expr>if (a > 0) throw Exception("")
|
||||
if (a + b > 0) break
|
||||
consume(a - b)</expr>
|
||||
}
|
||||
}
|
||||
|
||||
fun consume(obj: Any?) {}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = consume(a - b)
|
||||
type = kotlin.Unit
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = [
|
||||
break
|
||||
]
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
fun foo(a: Int) {
|
||||
val b: Int = 1
|
||||
for (n in 1..b) {
|
||||
<expr>if (a > 0) throw Exception("")
|
||||
if (a + b > 0) continue
|
||||
consume(a - b)</expr>
|
||||
}
|
||||
}
|
||||
|
||||
fun consume(obj: Any?) {}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = consume(a - b)
|
||||
type = kotlin.Unit
|
||||
hasEscapingJumps = false
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = [
|
||||
continue
|
||||
]
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fun foo(a: Int) {
|
||||
val b: Int = 1
|
||||
|
||||
<expr>if (a > 0) throw Exception("")
|
||||
if (b + a > 0) return
|
||||
consume(a - b)</expr>
|
||||
}
|
||||
|
||||
fun consume(obj: Any?) {}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = consume(a - b)
|
||||
type = kotlin.Unit
|
||||
hasEscapingJumps = false
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = []
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
fun example(i: Int) {
|
||||
when (i) {
|
||||
1 -> {
|
||||
<expr>if (i > 5) {
|
||||
consume("true")
|
||||
}
|
||||
else {
|
||||
consume("false")
|
||||
return
|
||||
}
|
||||
consume("!!")</expr>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun consume(obj: Any?) {}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = consume("!!")
|
||||
type = kotlin.Unit
|
||||
hasEscapingJumps = false
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = []
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
fun example(i: Int) {
|
||||
when (i) {
|
||||
1 -> {
|
||||
<expr>if (i > 5) {
|
||||
consume("true")
|
||||
}
|
||||
else {
|
||||
consume("false")
|
||||
return
|
||||
}
|
||||
consume("!!")</expr>
|
||||
}
|
||||
2 -> {
|
||||
consume("another")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun consume(obj: Any?) {}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = consume("!!")
|
||||
type = kotlin.Unit
|
||||
hasEscapingJumps = false
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = []
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
fun foo(a: Int) {
|
||||
val b: Int = 1
|
||||
loop1@ for (p in 1..b) {
|
||||
loop2@ for (n in 1..b) {
|
||||
<expr>if (a > 0) throw Exception("")
|
||||
if (a + b > 0) break@loop1
|
||||
consume(a - b)
|
||||
break@loop2</expr>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun consume(obj: Any?) {}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = null
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = true
|
||||
loopJumpExpressions = [
|
||||
break@loop1,
|
||||
break@loop2
|
||||
]
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
fun test() {
|
||||
x@ while (cond()) {
|
||||
<expr>consume(5)
|
||||
break@x</expr>
|
||||
}
|
||||
}
|
||||
|
||||
fun cond(): Boolean = true
|
||||
|
||||
fun consume(n: Int) {}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = null
|
||||
hasEscapingJumps = false
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = [
|
||||
break@x
|
||||
]
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fun foo(a: Int): Int {
|
||||
val b: Int = 1
|
||||
for (n in 1..a) {
|
||||
<expr>if (a + b > 0) break
|
||||
consume(a - b)
|
||||
break</expr>
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
fun consume(obj: Any?) {}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = null
|
||||
hasEscapingJumps = false
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = [
|
||||
break,
|
||||
break
|
||||
]
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
fun foo(a: Int): Int {
|
||||
val b: Int = 1
|
||||
for (n in 1..a) {
|
||||
<expr>if (a + b > 0) break
|
||||
else {
|
||||
consume(a - b)
|
||||
break
|
||||
}</expr>
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
fun consume(obj: Any?) {}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = null
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = [
|
||||
break,
|
||||
break
|
||||
]
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
fun foo(a: Int): Int {
|
||||
val b: Int = 1
|
||||
for (n in 1..a) {
|
||||
<expr>when {
|
||||
a + b > 0 -> break
|
||||
a - b > 0 -> break
|
||||
else -> {
|
||||
consume(0)
|
||||
break
|
||||
}
|
||||
}</expr>
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
fun consume(obj: Any?) {}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = null
|
||||
hasEscapingJumps = true
|
||||
hasJumps = true
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = [
|
||||
break,
|
||||
break,
|
||||
break
|
||||
]
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
fun test() {
|
||||
<expr>fun(n: Int): Int {
|
||||
return n + 1
|
||||
}</expr>
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = fun(n: Int): Int {
|
||||
return n + 1
|
||||
}
|
||||
type = kotlin.Function1<kotlin.Int, kotlin.Int>
|
||||
hasEscapingJumps = false
|
||||
hasJumps = false
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = []
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
fun test() {
|
||||
<expr>object {
|
||||
fun foo() {}
|
||||
}</expr>
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = object {
|
||||
fun foo() {}
|
||||
}
|
||||
type = <anonymous>
|
||||
hasEscapingJumps = false
|
||||
hasJumps = false
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = []
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
fun test() {
|
||||
buildFoo {
|
||||
<expr>value</expr> = produceString()
|
||||
}
|
||||
}
|
||||
|
||||
fun buildFoo(builder: Foo.() -> Unit): Foo {
|
||||
val foo = Foo()
|
||||
foo.builder()
|
||||
return foo
|
||||
}
|
||||
|
||||
fun Foo {
|
||||
var value: String? = null
|
||||
}
|
||||
|
||||
fun produceString(): String = ""
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = null
|
||||
hasEscapingJumps = false
|
||||
hasJumps = false
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = []
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
fun test() {
|
||||
buildFoo {
|
||||
value = <expr>produceString()</expr>
|
||||
}
|
||||
}
|
||||
|
||||
fun buildFoo(builder: Foo.() -> Unit): Foo {
|
||||
val foo = Foo()
|
||||
foo.builder()
|
||||
return foo
|
||||
}
|
||||
|
||||
fun Foo {
|
||||
var value: String? = null
|
||||
}
|
||||
|
||||
fun produceString(): String = ""
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = produceString()
|
||||
type = kotlin.String
|
||||
hasEscapingJumps = false
|
||||
hasJumps = false
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = []
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
fun test(foo: Foo) {
|
||||
foo.<expr>bar()</expr>
|
||||
}
|
||||
|
||||
class Foo {
|
||||
fun bar(): String {}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = bar()
|
||||
type = kotlin.String
|
||||
hasEscapingJumps = false
|
||||
hasJumps = false
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = []
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
fun test() {
|
||||
<expr>call()</expr>
|
||||
}
|
||||
|
||||
fun call(): Foo? {
|
||||
return null
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = call()
|
||||
type = ERROR CLASS: Symbol not found for Foo?
|
||||
hasEscapingJumps = false
|
||||
hasJumps = false
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = []
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
fun test(flag: Boolean) {
|
||||
if (flag) <expr>{
|
||||
consume(1)
|
||||
}</expr> else {
|
||||
consume(2)
|
||||
}
|
||||
}
|
||||
|
||||
fun consume(n: Int) {}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = null
|
||||
hasEscapingJumps = false
|
||||
hasJumps = false
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = []
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// FILE: JavaClass.java
|
||||
class FooJava {
|
||||
String call() {}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
fun text(foo: FooJava) {
|
||||
<expr>foo.call()</expr>
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = foo.call()
|
||||
type = kotlin.String!
|
||||
hasEscapingJumps = false
|
||||
hasJumps = false
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = []
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
fun test(n: Int) <expr>{
|
||||
consume(1)
|
||||
consume(n)
|
||||
}</expr>
|
||||
|
||||
fun consume(n: Int) {}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = null
|
||||
hasEscapingJumps = false
|
||||
hasJumps = false
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = []
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
fun test() {
|
||||
<expr>call(1, "foo")</expr>
|
||||
}
|
||||
|
||||
fun call(n: Int, text: String): Int = n
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = call(1, "foo")
|
||||
type = kotlin.Int
|
||||
hasEscapingJumps = false
|
||||
hasJumps = false
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = []
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
fun test(bar: String) {
|
||||
consume("foo" <expr>join</expr> bar)
|
||||
}
|
||||
|
||||
infix fun String.join(other: String): String = this + other
|
||||
|
||||
fun consume(text: String) {}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = null
|
||||
hasEscapingJumps = false
|
||||
hasJumps = false
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = []
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
fun test() {
|
||||
<expr>{ n: Int -> n + 1 }</expr>
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = { n: Int -> n + 1 }
|
||||
type = kotlin.Function1<kotlin.Int, kotlin.Int>
|
||||
hasEscapingJumps = false
|
||||
hasJumps = false
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = []
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
fun test() {
|
||||
<expr>call()</expr>
|
||||
}
|
||||
|
||||
fun call(): String? {
|
||||
return null
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = call()
|
||||
type = kotlin.String?
|
||||
hasEscapingJumps = false
|
||||
hasJumps = false
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = []
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// WITH_STDLIB
|
||||
|
||||
fun test(): Pair<String, Int> {
|
||||
return <expr>kotlin</expr>.Pair("foo", 1)
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = null
|
||||
hasEscapingJumps = false
|
||||
hasJumps = false
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = []
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
fun <T> test(t: T) {
|
||||
val a = <expr>foo<T>(t)</expr>
|
||||
}
|
||||
|
||||
fun <T> foo(obj: T): Int = 0
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
KtDataFlowExitPointSnapshot:
|
||||
defaultExpressionInfo = DefaultExpressionInfo:
|
||||
expression = foo<T>(t)
|
||||
type = kotlin.Int
|
||||
hasEscapingJumps = false
|
||||
hasJumps = false
|
||||
hasMultipleJumpKinds = false
|
||||
hasMultipleJumpTargets = false
|
||||
loopJumpExpressions = []
|
||||
returnValueType = null
|
||||
valuedReturnExpressions = []
|
||||
variableReassignments = []
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user