[FIR-TEST] Move analysis tests to separate module
This commit is contained in:
+12
@@ -0,0 +1,12 @@
|
||||
// FULL_JDK
|
||||
|
||||
fun foo() {
|
||||
val y = listOf("Alpha", "Beta")
|
||||
val x = LinkedHashSet<String>().apply {
|
||||
addAll(y)
|
||||
}
|
||||
|
||||
val z = ArrayList<String>()
|
||||
z.addAll(y)
|
||||
z.add("Omega")
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
FILE: addAllOnJavaCollection.kt
|
||||
public final fun foo(): R|kotlin/Unit| {
|
||||
lval y: R|kotlin/collections/List<kotlin/String>| = R|kotlin/collections/listOf|<R|kotlin/String|>(vararg(String(Alpha), String(Beta)))
|
||||
lval x: R|java/util/LinkedHashSet<kotlin/String>| = R|java/util/LinkedHashSet.LinkedHashSet|<R|kotlin/String|>().R|kotlin/apply|<R|java/util/LinkedHashSet<kotlin/String>|>(<L> = apply@fun R|java/util/LinkedHashSet<kotlin/String>|.<anonymous>(): R|kotlin/Unit| <kind=EXACTLY_ONCE> {
|
||||
^ this@R|special/anonymous|.R|FakeOverride<java/util/LinkedHashSet.addAll: R|kotlin/Boolean|>|(R|<local>/y|)
|
||||
}
|
||||
)
|
||||
lval z: R|java/util/ArrayList<kotlin/String>| = R|java/util/ArrayList.ArrayList|<R|kotlin/String|>()
|
||||
R|<local>/z|.R|FakeOverride<java/util/ArrayList.addAll: R|kotlin/Boolean|>|(R|<local>/y|)
|
||||
R|<local>/z|.R|FakeOverride<java/util/ArrayList.add: R|kotlin/Boolean|>|(String(Omega))
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
fun test(elements: Array<out String?>) {
|
||||
val filtered = elements.filterNotNull()
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
FILE: arrayFilterCapturedType.kt
|
||||
public final fun test(elements: R|kotlin/Array<out kotlin/String?>|): R|kotlin/Unit| {
|
||||
lval filtered: R|kotlin/collections/List<kotlin/String>| = R|<local>/elements|.R|kotlin/collections/filterNotNull|<R|kotlin/String|>()
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
interface G {
|
||||
val a: Array<out G>
|
||||
}
|
||||
|
||||
fun goo(g: G) {
|
||||
val x = g.a.firstOrNullX()
|
||||
}
|
||||
|
||||
public fun <T> Array<out T>.firstOrNullX(): T? {
|
||||
return if (isEmpty()) null else this[0]
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
FILE: arrayFirstOrNull.kt
|
||||
public abstract interface G : R|kotlin/Any| {
|
||||
public abstract val a: R|kotlin/Array<out G>|
|
||||
public get(): R|kotlin/Array<out G>|
|
||||
|
||||
}
|
||||
public final fun goo(g: R|G|): R|kotlin/Unit| {
|
||||
lval x: R|G?| = R|<local>/g|.R|/G.a|.R|/firstOrNullX|<R|G|>()
|
||||
}
|
||||
public final fun <T> R|kotlin/Array<out T>|.firstOrNullX(): R|T?| {
|
||||
^firstOrNullX when () {
|
||||
this@R|/firstOrNullX|.R|kotlin/collections/isEmpty|<R|T|>() -> {
|
||||
Null(null)
|
||||
}
|
||||
else -> {
|
||||
this@R|/firstOrNullX|.R|FakeOverride<kotlin/Array.get: R|T|>|(Int(0))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
fun foo() {
|
||||
fun convert(vararg paths: String): Array<String> = paths.toList().toTypedArray()
|
||||
|
||||
convert("1", "2", "3")
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
FILE: arrayInLocal.kt
|
||||
public final fun foo(): R|kotlin/Unit| {
|
||||
local final fun convert(vararg paths: R|kotlin/Array<out kotlin/String>|): R|kotlin/Array<kotlin/String>| {
|
||||
^convert R|<local>/paths|.R|kotlin/collections/toList|<R|kotlin/String|>().R|kotlin/collections/toTypedArray|<R|kotlin/String|>()
|
||||
}
|
||||
|
||||
R|<local>/convert|(vararg(String(1), String(2), String(3)))
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
var myProperty = listOf(1, 2, 3)
|
||||
get() {
|
||||
return field + field
|
||||
}
|
||||
set(param) {
|
||||
field = param
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
FILE: backingField.kt
|
||||
public final var myProperty: R|kotlin/collections/List<kotlin/Int>| = R|kotlin/collections/listOf|<R|kotlin/Int|>(vararg(Int(1), Int(2), Int(3)))
|
||||
public get(): R|kotlin/collections/List<kotlin/Int>| {
|
||||
^ F|/myProperty|.R|kotlin/collections/plus|<R|kotlin/Int|>(F|/myProperty|)
|
||||
}
|
||||
public set(param: R|kotlin/collections/List<kotlin/Int>|): R|kotlin/Unit| {
|
||||
F|/myProperty| = R|<local>/param|
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
fun bar(x: String): Int = 1
|
||||
fun bar(x: String): Double = 1
|
||||
|
||||
fun baz(x: String): Int = 1
|
||||
fun <T, R> foobaz(x: T): R = TODO()
|
||||
|
||||
fun foo() {
|
||||
val x: (String) -> Int = ::bar
|
||||
val y = <!UNRESOLVED_REFERENCE!>::bar<!>
|
||||
val z = ::baz
|
||||
val w: (String) -> Int = ::foobaz
|
||||
|
||||
::baz
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
FILE: beyoundCalls.kt
|
||||
public final fun bar(x: R|kotlin/String|): R|kotlin/Int| {
|
||||
^bar Int(1)
|
||||
}
|
||||
public final fun bar(x: R|kotlin/String|): R|kotlin/Double| {
|
||||
^bar Int(1)
|
||||
}
|
||||
public final fun baz(x: R|kotlin/String|): R|kotlin/Int| {
|
||||
^baz Int(1)
|
||||
}
|
||||
public final fun <T, R> foobaz(x: R|T|): R|R| {
|
||||
^foobaz R|kotlin/TODO|()
|
||||
}
|
||||
public final fun foo(): R|kotlin/Unit| {
|
||||
lval x: R|(kotlin/String) -> kotlin/Int| = ::R|/bar|
|
||||
lval y: <ERROR TYPE REF: No result type for initializer> = ::<Unresolved reference: bar>#
|
||||
lval z: R|kotlin/reflect/KFunction1<kotlin/String, kotlin/Int>| = ::R|/baz|
|
||||
lval w: R|(kotlin/String) -> kotlin/Int| = ::R|/foobaz<kotlin/String, kotlin/Int>|
|
||||
::R|/baz|
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
// FILE: JavaClass.java
|
||||
public class JavaClass {
|
||||
public static int bar(String x) { return 0; }
|
||||
public int bar(CharSequence x) { return 0; }
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
class KotlinClass : JavaClass() {
|
||||
fun baz(x: CharSequence): Int = 1
|
||||
companion object {
|
||||
fun baz(x: String): Int = 1
|
||||
}
|
||||
}
|
||||
|
||||
class KotlinClass2 : JavaClass() {
|
||||
override fun bar(x: CharSequence): Int = 1
|
||||
companion object {
|
||||
fun bar(x: String): Int = 1
|
||||
}
|
||||
}
|
||||
|
||||
fun foo1(x: (String) -> Int) {}
|
||||
|
||||
fun foo2(x: (KotlinClass, CharSequence) -> Int) {}
|
||||
|
||||
fun foo3(x: (KotlinClass, CharSequence) -> Int) {}
|
||||
fun foo3(x: (String) -> Int) {}
|
||||
|
||||
fun main() {
|
||||
foo1(KotlinClass::baz)
|
||||
foo2(KotlinClass::baz)
|
||||
// Ambiguity (companion/class)
|
||||
<!AMBIGUITY!>foo3<!>(KotlinClass::baz)
|
||||
|
||||
// Type mismatch
|
||||
<!INAPPLICABLE_CANDIDATE!>foo1<!>(KotlinClass::bar)
|
||||
foo2(KotlinClass::bar)
|
||||
foo3(KotlinClass::bar)
|
||||
|
||||
foo1(KotlinClass2::bar)
|
||||
// Type mismatch
|
||||
<!INAPPLICABLE_CANDIDATE!>foo2<!>(KotlinClass2::bar)
|
||||
foo3(KotlinClass2::bar)
|
||||
}
|
||||
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
FILE: main.kt
|
||||
public final class KotlinClass : R|JavaClass| {
|
||||
public constructor(): R|KotlinClass| {
|
||||
super<R|JavaClass|>()
|
||||
}
|
||||
|
||||
public final fun baz(x: R|kotlin/CharSequence|): R|kotlin/Int| {
|
||||
^baz Int(1)
|
||||
}
|
||||
|
||||
public final companion object Companion : R|kotlin/Any| {
|
||||
private constructor(): R|KotlinClass.Companion| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun baz(x: R|kotlin/String|): R|kotlin/Int| {
|
||||
^baz Int(1)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public final class KotlinClass2 : R|JavaClass| {
|
||||
public constructor(): R|KotlinClass2| {
|
||||
super<R|JavaClass|>()
|
||||
}
|
||||
|
||||
public final override fun bar(x: R|kotlin/CharSequence|): R|kotlin/Int| {
|
||||
^bar Int(1)
|
||||
}
|
||||
|
||||
public final companion object Companion : R|kotlin/Any| {
|
||||
private constructor(): R|KotlinClass2.Companion| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun bar(x: R|kotlin/String|): R|kotlin/Int| {
|
||||
^bar Int(1)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public final fun foo1(x: R|(kotlin/String) -> kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun foo2(x: R|(KotlinClass, kotlin/CharSequence) -> kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun foo3(x: R|(KotlinClass, kotlin/CharSequence) -> kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun foo3(x: R|(kotlin/String) -> kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
R|/foo1|(Q|KotlinClass|::R|/KotlinClass.Companion.baz|)
|
||||
R|/foo2|(Q|KotlinClass|::R|/KotlinClass.baz|)
|
||||
<Ambiguity: foo3, [/foo3, /foo3]>#(Q|KotlinClass|::R|/KotlinClass.baz|)
|
||||
<Inapplicable(INAPPLICABLE): [/foo1]>#(Q|KotlinClass|::R|/JavaClass.bar|)
|
||||
R|/foo2|(Q|KotlinClass|::R|/JavaClass.bar|)
|
||||
R|/foo3|(Q|KotlinClass|::R|/JavaClass.bar|)
|
||||
R|/foo1|(Q|KotlinClass2|::R|/KotlinClass2.Companion.bar|)
|
||||
<Inapplicable(INAPPLICABLE): [/foo2]>#(Q|KotlinClass2|::R|/KotlinClass2.bar|)
|
||||
R|/foo3|(Q|KotlinClass2|::R|/KotlinClass2.Companion.bar|)
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
class Klass {
|
||||
constructor(a: Int) {}
|
||||
constructor(a: String) {}
|
||||
}
|
||||
|
||||
fun user(f: (Int) -> Klass) {}
|
||||
|
||||
fun fn() {
|
||||
user(::Klass)
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
FILE: constructors.kt
|
||||
public final class Klass : R|kotlin/Any| {
|
||||
public constructor(a: R|kotlin/Int|): R|Klass| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public constructor(a: R|kotlin/String|): R|Klass| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final fun user(f: R|(kotlin/Int) -> Klass|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun fn(): R|kotlin/Unit| {
|
||||
R|/user|(::R|/Klass.Klass|)
|
||||
}
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
fun foo(x: () -> Int, y: Int) {}
|
||||
fun bar(x: String): Int = 1
|
||||
|
||||
fun main() {
|
||||
fun bar(): Int = 1
|
||||
fun foo(x: (String) -> Int, y: String) {}
|
||||
|
||||
foo(::bar, 1)
|
||||
foo(::bar, "")
|
||||
}
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
FILE: differentLevels.kt
|
||||
public final fun foo(x: R|() -> kotlin/Int|, y: R|kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun bar(x: R|kotlin/String|): R|kotlin/Int| {
|
||||
^bar Int(1)
|
||||
}
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
local final fun bar(): R|kotlin/Int| {
|
||||
^bar Int(1)
|
||||
}
|
||||
|
||||
local final fun foo(x: R|(kotlin/String) -> kotlin/Int|, y: R|kotlin/String|): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
R|/foo|(::R|<local>/bar|, Int(1))
|
||||
R|<local>/foo|(::R|/bar|, String())
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
class A
|
||||
val <X> X.prop: Int get() = 1
|
||||
fun <X> X.baz(): Int = 1
|
||||
|
||||
fun foo(x: (A) -> Int) {}
|
||||
|
||||
fun main() {
|
||||
foo(A::prop)
|
||||
foo(A::baz)
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
FILE: extensionReceiverInference.kt
|
||||
public final class A : R|kotlin/Any| {
|
||||
public constructor(): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final val <X> R|X|.prop: R|kotlin/Int|
|
||||
public get(): R|kotlin/Int| {
|
||||
^ Int(1)
|
||||
}
|
||||
public final fun <X> R|X|.baz(): R|kotlin/Int| {
|
||||
^baz Int(1)
|
||||
}
|
||||
public final fun foo(x: R|(A) -> kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
R|/foo|(Q|A|::R|/prop<A>|)
|
||||
R|/foo|(Q|A|::R|/baz<A>|)
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
fun foo(x: Int) {}
|
||||
fun foo(y: String) {}
|
||||
|
||||
fun <T> bar(f: (T) -> Unit) {}
|
||||
|
||||
fun test() {
|
||||
bar(<!UNRESOLVED_REFERENCE!>::foo<!>)
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
FILE: ambiguityWhenNoApplicableCallableReferenceCandidate.kt
|
||||
public final fun foo(x: R|kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun foo(y: R|kotlin/String|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun <T> bar(f: R|(T) -> kotlin/Unit|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
R|/bar|<R|kotlin/Any?|>(::<Unresolved reference: foo>#)
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
fun foo(s: String) {}
|
||||
|
||||
object Scope {
|
||||
fun foo(a: Int) {}
|
||||
fun foo(b: Boolean) {}
|
||||
|
||||
fun <T> bar(f: (T) -> Unit): T = TODO()
|
||||
|
||||
fun test() {
|
||||
val s: String = bar(::foo)
|
||||
}
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
FILE: applicableCallableReferenceFromDistantScope.kt
|
||||
public final fun foo(s: R|kotlin/String|): R|kotlin/Unit| {
|
||||
}
|
||||
public final object Scope : R|kotlin/Any| {
|
||||
private constructor(): R|Scope| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun foo(a: R|kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
public final fun foo(b: R|kotlin/Boolean|): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
public final fun <T> bar(f: R|(T) -> kotlin/Unit|): R|T| {
|
||||
^bar R|kotlin/TODO|()
|
||||
}
|
||||
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
lval s: R|kotlin/String| = this@R|/Scope|.R|/Scope.bar|<R|kotlin/String|>(::R|/foo|)
|
||||
}
|
||||
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
class A {
|
||||
fun foo(i: A) {}
|
||||
|
||||
fun baz(i: A) {}
|
||||
}
|
||||
|
||||
class B {
|
||||
fun foo(s: B) {}
|
||||
fun foo(c: Char) {}
|
||||
|
||||
fun baz(s: B) {}
|
||||
}
|
||||
|
||||
fun <T> bar(f: (T) -> Unit): T = TODO()
|
||||
|
||||
fun test() {
|
||||
myWith(A()) {
|
||||
val t1 = bar(::foo)
|
||||
|
||||
val t2 = bar(::baz)
|
||||
|
||||
myWith(B()) {
|
||||
val a: A = bar(::foo)
|
||||
val b: B = bar(::foo)
|
||||
|
||||
val t3 = bar(::baz)
|
||||
|
||||
bar(<!UNRESOLVED_REFERENCE!>::foo<!>)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline fun <T, R> myWith(receiver: T, block: T.() -> R): R = TODO()
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
FILE: chooseCallableReferenceDependingOnInferredReceiver.kt
|
||||
public final class A : R|kotlin/Any| {
|
||||
public constructor(): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun foo(i: R|A|): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
public final fun baz(i: R|A|): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
}
|
||||
public final class B : R|kotlin/Any| {
|
||||
public constructor(): R|B| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun foo(s: R|B|): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
public final fun foo(c: R|kotlin/Char|): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
public final fun baz(s: R|B|): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
}
|
||||
public final fun <T> bar(f: R|(T) -> kotlin/Unit|): R|T| {
|
||||
^bar R|kotlin/TODO|()
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
R|/myWith|<R|A|, R|kotlin/Nothing|>(R|/A.A|(), <L> = myWith@fun R|A|.<anonymous>(): R|kotlin/Nothing| <kind=UNKNOWN> {
|
||||
lval t1: R|A| = R|/bar|<R|A|>(::R|/A.foo|)
|
||||
lval t2: R|A| = R|/bar|<R|A|>(::R|/A.baz|)
|
||||
^ R|/myWith|<R|B|, R|kotlin/Nothing|>(R|/B.B|(), <L> = myWith@fun R|B|.<anonymous>(): R|kotlin/Nothing| <kind=UNKNOWN> {
|
||||
lval a: R|A| = R|/bar|<R|A|>(::R|/A.foo|)
|
||||
lval b: R|B| = R|/bar|<R|B|>(::R|/B.foo|)
|
||||
lval t3: R|B| = R|/bar|<R|B|>(::R|/B.baz|)
|
||||
^ R|/bar|<R|kotlin/Nothing|>(::<Unresolved reference: foo>#)
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
public final inline fun <T, R> myWith(receiver: R|T|, block: R|T.() -> R|): R|R| {
|
||||
^myWith R|kotlin/TODO|()
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
interface Parent
|
||||
interface Child1 : Parent
|
||||
interface Child2 : Parent
|
||||
|
||||
fun foo(): Child1 = TODO()
|
||||
fun bar(): Child2 = TODO()
|
||||
|
||||
fun <K> select(x: K, y: K): K = TODO()
|
||||
|
||||
fun test() {
|
||||
val a = select(::foo, ::bar)
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
FILE: commonSupertypeFromReturnTypesOfCallableReference.kt
|
||||
public abstract interface Parent : R|kotlin/Any| {
|
||||
}
|
||||
public abstract interface Child1 : R|Parent| {
|
||||
}
|
||||
public abstract interface Child2 : R|Parent| {
|
||||
}
|
||||
public final fun foo(): R|Child1| {
|
||||
^foo R|kotlin/TODO|()
|
||||
}
|
||||
public final fun bar(): R|Child2| {
|
||||
^bar R|kotlin/TODO|()
|
||||
}
|
||||
public final fun <K> select(x: R|K|, y: R|K|): R|K| {
|
||||
^select R|kotlin/TODO|()
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
lval a: R|kotlin/reflect/KFunction0<Parent>| = R|/select|<R|kotlin/reflect/KFunction0<Parent>|>(::R|/foo|, ::R|/bar|)
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
interface A
|
||||
interface B
|
||||
|
||||
fun multiple(a: A) {}
|
||||
fun multiple(b: B) {}
|
||||
|
||||
fun singleA(a: A) {}
|
||||
fun singleB(a: B) {}
|
||||
|
||||
fun <T> foo(f: (T) -> Unit, g: (T) -> Unit): T = TODO()
|
||||
|
||||
fun test() {
|
||||
val a1 = foo(::singleA, ::multiple)
|
||||
|
||||
val a2 = foo(::singleB, ::multiple)
|
||||
|
||||
val a3 = foo(::multiple, ::singleA)
|
||||
|
||||
val a4 = foo(::multiple, ::singleB)
|
||||
|
||||
val a5 = foo(::singleA, ::singleA)
|
||||
|
||||
val a6 = foo(::singleA, ::singleB)
|
||||
|
||||
foo(<!UNRESOLVED_REFERENCE!>::multiple<!>, <!UNRESOLVED_REFERENCE!>::multiple<!>)
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
FILE: eagerAndPostponedCallableReferences.kt
|
||||
public abstract interface A : R|kotlin/Any| {
|
||||
}
|
||||
public abstract interface B : R|kotlin/Any| {
|
||||
}
|
||||
public final fun multiple(a: R|A|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun multiple(b: R|B|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun singleA(a: R|A|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun singleB(a: R|B|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun <T> foo(f: R|(T) -> kotlin/Unit|, g: R|(T) -> kotlin/Unit|): R|T| {
|
||||
^foo R|kotlin/TODO|()
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
lval a1: R|A| = R|/foo|<R|A|>(::R|/singleA|, ::R|/multiple|)
|
||||
lval a2: R|B| = R|/foo|<R|B|>(::R|/singleB|, ::R|/multiple|)
|
||||
lval a3: R|A| = R|/foo|<R|A|>(::R|/multiple|, ::R|/singleA|)
|
||||
lval a4: R|B| = R|/foo|<R|B|>(::R|/multiple|, ::R|/singleB|)
|
||||
lval a5: R|A| = R|/foo|<R|A|>(::R|/singleA|, ::R|/singleA|)
|
||||
lval a6: R|it(A & B)| = R|/foo|<R|it(A & B)|>(::R|/singleA|, ::R|/singleB|)
|
||||
R|/foo|<R|kotlin/Nothing|>(::<Unresolved reference: multiple>#, ::<Unresolved reference: multiple>#)
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// !LANGUAGE: -NewInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
open class A
|
||||
class B : A()
|
||||
|
||||
class Or(left: A, right: A) : A()
|
||||
|
||||
class Out<out T>
|
||||
|
||||
fun test(ls: Out<B>) {
|
||||
ls.reduce(::Or)
|
||||
}
|
||||
|
||||
fun <S, T : S> Out<T>.reduce(operation: (S, T) -> S): S = TODO()
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
FILE: eagerResolveOfSingleCallableReference.kt
|
||||
public open class A : R|kotlin/Any| {
|
||||
public constructor(): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final class B : R|A| {
|
||||
public constructor(): R|B| {
|
||||
super<R|A|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final class Or : R|A| {
|
||||
public constructor(left: R|A|, right: R|A|): R|Or| {
|
||||
super<R|A|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final class Out<out T> : R|kotlin/Any| {
|
||||
public constructor<out T>(): R|Out<T>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final fun test(ls: R|Out<B>|): R|kotlin/Unit| {
|
||||
R|<local>/ls|.R|/reduce|<R|A|, R|B|>(::R|/Or.Or|)
|
||||
}
|
||||
public final fun <S, T : R|S|> R|Out<T>|.reduce(operation: R|(S, T) -> S|): R|S| {
|
||||
^reduce R|kotlin/TODO|()
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
interface IA
|
||||
interface IB : IA
|
||||
|
||||
fun IA.extFun(x: IB) {}
|
||||
fun IB.extFun(x: IA) {}
|
||||
|
||||
fun test() {
|
||||
val extFun1 = IA::extFun
|
||||
val extFun2 = IB::extFun
|
||||
}
|
||||
|
||||
fun testWithExpectedType() {
|
||||
// NB: should be resolved to kotlin/FunctionX, not kotlin/reflect/FunctionX
|
||||
val extFun_AB_A: IA.(IB) -> Unit = IA::extFun
|
||||
val extFun_AA_B: IA.(IA) -> Unit = IB::extFun
|
||||
val extFun_BB_A: IB.(IB) -> Unit = IA::extFun
|
||||
val extFun_BA_B: IB.(IA) -> Unit = IB::extFun
|
||||
val extFun_BB_B: IB.(IB) -> Unit = IB::extFun
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
FILE: moreSpecificAmbiguousExtensions.kt
|
||||
public abstract interface IA : R|kotlin/Any| {
|
||||
}
|
||||
public abstract interface IB : R|IA| {
|
||||
}
|
||||
public final fun R|IA|.extFun(x: R|IB|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun R|IB|.extFun(x: R|IA|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
lval extFun1: R|kotlin/reflect/KFunction2<IA, IB, kotlin/Unit>| = Q|IA|::R|/extFun|
|
||||
lval extFun2: R|kotlin/reflect/KFunction2<IB, IB, kotlin/Unit>| = Q|IB|::R|/extFun|
|
||||
}
|
||||
public final fun testWithExpectedType(): R|kotlin/Unit| {
|
||||
lval extFun_AB_A: R|IA.(IB) -> kotlin/Unit| = Q|IA|::R|/extFun|
|
||||
lval extFun_AA_B: R|IA.(IA) -> kotlin/Unit| = Q|IB|::R|/extFun|
|
||||
lval extFun_BB_A: R|IB.(IB) -> kotlin/Unit| = Q|IA|::R|/extFun|
|
||||
lval extFun_BA_B: R|IB.(IA) -> kotlin/Unit| = Q|IB|::R|/extFun|
|
||||
lval extFun_BB_B: R|IB.(IB) -> kotlin/Unit| = Q|IB|::R|/extFun|
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
interface Base
|
||||
class Inv<K> : Base
|
||||
|
||||
fun foo(x: Int): Inv<Int> = TODO()
|
||||
fun foo(y: String): Inv<String> = TODO()
|
||||
|
||||
fun <T, R : Number> bar(f: (T) -> Inv<R>, p: String = "") {}
|
||||
|
||||
fun <T, R : Base> bar(f: (T) -> Inv<R>, p: Int = 4) {}
|
||||
|
||||
fun test() {
|
||||
bar(::foo)
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
FILE: multipleOutersAndMultipleCallableReferences.kt
|
||||
public abstract interface Base : R|kotlin/Any| {
|
||||
}
|
||||
public final class Inv<K> : R|Base| {
|
||||
public constructor<K>(): R|Inv<K>| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final fun foo(x: R|kotlin/Int|): R|Inv<kotlin/Int>| {
|
||||
^foo R|kotlin/TODO|()
|
||||
}
|
||||
public final fun foo(y: R|kotlin/String|): R|Inv<kotlin/String>| {
|
||||
^foo R|kotlin/TODO|()
|
||||
}
|
||||
public final fun <T, R : R|kotlin/Number|> bar(f: R|(T) -> Inv<R>|, p: R|kotlin/String| = String()): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun <T, R : R|Base|> bar(f: R|(T) -> Inv<R>|, p: R|kotlin/Int| = Int(4)): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
R|/bar|<R|kotlin/Int|, R|kotlin/Int|>(::R|/foo|)
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
import kotlin.reflect.KProperty0
|
||||
import kotlin.reflect.KProperty1
|
||||
|
||||
fun <R> property(property: KProperty0<R>): Int = 1
|
||||
fun <T, R> property(property: KProperty1<T, R>): String = ""
|
||||
|
||||
val subject = ""
|
||||
|
||||
class O {
|
||||
val subject = ""
|
||||
}
|
||||
|
||||
val someProperty0 = property(::subject)
|
||||
val someProperty1 = property(O::subject)
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
FILE: noAmbiguityBetweenTopLevelAndMemberProperty.kt
|
||||
public final fun <R> property(property: R|kotlin/reflect/KProperty0<R>|): R|kotlin/Int| {
|
||||
^property Int(1)
|
||||
}
|
||||
public final fun <T, R> property(property: R|kotlin/reflect/KProperty1<T, R>|): R|kotlin/String| {
|
||||
^property String()
|
||||
}
|
||||
public final val subject: R|kotlin/String| = String()
|
||||
public get(): R|kotlin/String|
|
||||
public final class O : R|kotlin/Any| {
|
||||
public constructor(): R|O| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val subject: R|kotlin/String| = String()
|
||||
public get(): R|kotlin/String|
|
||||
|
||||
}
|
||||
public final val someProperty0: R|kotlin/Int| = R|/property|<R|kotlin/String|>(::R|/subject|)
|
||||
public get(): R|kotlin/Int|
|
||||
public final val someProperty1: R|kotlin/String| = R|/property|<R|O|, R|kotlin/String|>(Q|O|::R|/O.subject|)
|
||||
public get(): R|kotlin/String|
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
class C {
|
||||
fun xf1(){}
|
||||
fun xf1(s: String){}
|
||||
}
|
||||
|
||||
fun foo(p: (String) -> Unit){}
|
||||
|
||||
fun bar(c: C) {
|
||||
foo(c::xf1)
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
FILE: overloadsBound.kt
|
||||
public final class C : R|kotlin/Any| {
|
||||
public constructor(): R|C| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun xf1(): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
public final fun xf1(s: R|kotlin/String|): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
}
|
||||
public final fun foo(p: R|(kotlin/String) -> kotlin/Unit|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun bar(c: R|C|): R|kotlin/Unit| {
|
||||
R|/foo|(R|<local>/c|::R|/C.xf1|)
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
interface A
|
||||
interface B
|
||||
|
||||
fun foo(i: A) {}
|
||||
fun foo(b: B) {}
|
||||
|
||||
fun <T> bar1(f: (T) -> Unit): T = TODO()
|
||||
fun <T> bar2(f: (T) -> Unit, e: T) {}
|
||||
|
||||
fun test(a: A, b: B) {
|
||||
val expectedType1: A = bar1(::foo)
|
||||
val expectedType2: B = bar1(::foo)
|
||||
|
||||
bar2(::foo, a)
|
||||
bar2(::foo, b)
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
FILE: postponedResolveOfManyCallableReference.kt
|
||||
public abstract interface A : R|kotlin/Any| {
|
||||
}
|
||||
public abstract interface B : R|kotlin/Any| {
|
||||
}
|
||||
public final fun foo(i: R|A|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun foo(b: R|B|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun <T> bar1(f: R|(T) -> kotlin/Unit|): R|T| {
|
||||
^bar1 R|kotlin/TODO|()
|
||||
}
|
||||
public final fun <T> bar2(f: R|(T) -> kotlin/Unit|, e: R|T|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun test(a: R|A|, b: R|B|): R|kotlin/Unit| {
|
||||
lval expectedType1: R|A| = R|/bar1|<R|A|>(::R|/foo|)
|
||||
lval expectedType2: R|B| = R|/bar1|<R|B|>(::R|/foo|)
|
||||
R|/bar2|<R|A|>(::R|/foo|, R|<local>/a|)
|
||||
R|/bar2|<R|B|>(::R|/foo|, R|<local>/b|)
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
interface A
|
||||
interface B
|
||||
|
||||
fun fooB(b: B) {}
|
||||
|
||||
fun <T> bar(f: (T) -> Unit, e: T) {}
|
||||
fun <T> baz(e: T, f: (T) -> Unit) {}
|
||||
|
||||
fun test(a: A, b: B) {
|
||||
<!INAPPLICABLE_CANDIDATE!>baz<!>(a, ::fooB)
|
||||
<!INAPPLICABLE_CANDIDATE!>bar<!>(::fooB, a)
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
FILE: resolveCallableReferencesAfterAllSimpleArguments.kt
|
||||
public abstract interface A : R|kotlin/Any| {
|
||||
}
|
||||
public abstract interface B : R|kotlin/Any| {
|
||||
}
|
||||
public final fun fooB(b: R|B|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun <T> bar(f: R|(T) -> kotlin/Unit|, e: R|T|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun <T> baz(e: R|T|, f: R|(T) -> kotlin/Unit|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun test(a: R|A|, b: R|B|): R|kotlin/Unit| {
|
||||
<Inapplicable(INAPPLICABLE): [/baz]>#(R|<local>/a|, ::R|/fooB|)
|
||||
<Inapplicable(INAPPLICABLE): [/bar]>#(::R|/fooB|, R|<local>/a|)
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
fun <T, R> apply(x: T, f: (T) -> R): R = f(x)
|
||||
|
||||
fun foo(i: Int) {}
|
||||
fun foo(s: String) {}
|
||||
|
||||
val x1 = apply(1, ::foo)
|
||||
val x2 = apply("hello", ::foo)
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
FILE: withGenericFun.kt
|
||||
public final fun <T, R> apply(x: R|T|, f: R|(T) -> R|): R|R| {
|
||||
^apply R|<local>/f|.R|FakeOverride<kotlin/Function1.invoke: R|R|>|(R|<local>/x|)
|
||||
}
|
||||
public final fun foo(i: R|kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun foo(s: R|kotlin/String|): R|kotlin/Unit| {
|
||||
}
|
||||
public final val x1: R|kotlin/Unit| = R|/apply|<R|kotlin/Int|, R|kotlin/Unit|>(Int(1), ::R|/foo|)
|
||||
public get(): R|kotlin/Unit|
|
||||
public final val x2: R|kotlin/Unit| = R|/apply|<R|kotlin/String|, R|kotlin/Unit|>(String(hello), ::R|/foo|)
|
||||
public get(): R|kotlin/Unit|
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
private var Int.readOnlyWrapper: CharSequence? get() = null
|
||||
private var Int.mutableWrapper: CharSequence? get() = null
|
||||
|
||||
fun main(x: Int) {
|
||||
val x = if (x > 1) x::readOnlyWrapper else x::mutableWrapper
|
||||
|
||||
x.get()
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
FILE: ifWithCR.kt
|
||||
private final var R|kotlin/Int|.readOnlyWrapper: R|kotlin/CharSequence?|
|
||||
public get(): R|kotlin/CharSequence?| {
|
||||
^ Null(null)
|
||||
}
|
||||
private set(value: R|kotlin/CharSequence?|): R|kotlin/Unit|
|
||||
private final var R|kotlin/Int|.mutableWrapper: R|kotlin/CharSequence?|
|
||||
public get(): R|kotlin/CharSequence?| {
|
||||
^ Null(null)
|
||||
}
|
||||
private set(value: R|kotlin/CharSequence?|): R|kotlin/Unit|
|
||||
public final fun main(x: R|kotlin/Int|): R|kotlin/Unit| {
|
||||
lval x: R|kotlin/reflect/KMutableProperty0<kotlin/CharSequence?>| = when () {
|
||||
CMP(>, R|<local>/x|.R|kotlin/Int.compareTo|(Int(1))) -> {
|
||||
R|<local>/x|::R|/readOnlyWrapper|
|
||||
}
|
||||
else -> {
|
||||
R|<local>/x|::R|/mutableWrapper|
|
||||
}
|
||||
}
|
||||
|
||||
R|<local>/x|.R|FakeOverride<kotlin/reflect/KMutableProperty0.get: R|kotlin/CharSequence?|>|()
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
fun <T, R> use(x: (T) -> R): (T) -> R = x
|
||||
|
||||
fun foo() = use(::bar)
|
||||
fun bar(x: String) = 1
|
||||
|
||||
fun loop1() = <!INAPPLICABLE_CANDIDATE!>use<!>(::loop2)
|
||||
fun loop2() = loop1()
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
FILE: implicitTypes.kt
|
||||
public final fun <T, R> use(x: R|(T) -> R|): R|(T) -> R| {
|
||||
^use R|<local>/x|
|
||||
}
|
||||
public final fun foo(): R|(kotlin/String) -> kotlin/Int| {
|
||||
^foo R|/use|<R|kotlin/String|, R|kotlin/Int|>(::R|/bar|)
|
||||
}
|
||||
public final fun bar(x: R|kotlin/String|): R|kotlin/Int| {
|
||||
^bar Int(1)
|
||||
}
|
||||
public final fun loop1(): <ERROR TYPE REF: Inapplicable(INAPPLICABLE): [/use]> {
|
||||
^loop1 <Inapplicable(INAPPLICABLE): [/use]>#(::R|/loop2|)
|
||||
}
|
||||
public final fun loop2(): <ERROR TYPE REF: cycle> {
|
||||
^loop2 R?C|/loop1|()
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
fun <T, E> foo(x: (T) -> E) {}
|
||||
fun <T, E> foo2(x: (A, T) -> E) {}
|
||||
|
||||
class A {
|
||||
fun baz(x: String): Int = null!!
|
||||
}
|
||||
|
||||
fun bar(x: String): Int = null!!
|
||||
|
||||
fun main() {
|
||||
foo(::bar)
|
||||
foo(A()::baz)
|
||||
foo2(A::baz)
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
FILE: inferenceFromCallableReferenceType.kt
|
||||
public final fun <T, E> foo(x: R|(T) -> E|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun <T, E> foo2(x: R|(A, T) -> E|): R|kotlin/Unit| {
|
||||
}
|
||||
public final class A : R|kotlin/Any| {
|
||||
public constructor(): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun baz(x: R|kotlin/String|): R|kotlin/Int| {
|
||||
^baz Null(null)!!
|
||||
}
|
||||
|
||||
}
|
||||
public final fun bar(x: R|kotlin/String|): R|kotlin/Int| {
|
||||
^bar Null(null)!!
|
||||
}
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
R|/foo|<R|kotlin/String|, R|kotlin/Int|>(::R|/bar|)
|
||||
R|/foo|<R|kotlin/String|, R|kotlin/Int|>(R|/A.A|()::R|/A.baz|)
|
||||
R|/foo2|<R|kotlin/String|, R|kotlin/Int|>(Q|A|::R|/A.baz|)
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
fun foo(x: (String) -> Int) {}
|
||||
fun foo2(x: (A, String) -> Int) {}
|
||||
|
||||
class A {
|
||||
fun <T, E> baz(x: T): E = null!!
|
||||
}
|
||||
|
||||
fun <T, E> bar(x: T): E = null!!
|
||||
|
||||
fun main() {
|
||||
foo(::bar)
|
||||
foo(A()::baz)
|
||||
foo2(A::baz)
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
FILE: inferenceFromExpectedType.kt
|
||||
public final fun foo(x: R|(kotlin/String) -> kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun foo2(x: R|(A, kotlin/String) -> kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
public final class A : R|kotlin/Any| {
|
||||
public constructor(): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun <T, E> baz(x: R|T|): R|E| {
|
||||
^baz Null(null)!!
|
||||
}
|
||||
|
||||
}
|
||||
public final fun <T, E> bar(x: R|T|): R|E| {
|
||||
^bar Null(null)!!
|
||||
}
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
R|/foo|(::R|/bar<kotlin/String, kotlin/Int>|)
|
||||
R|/foo|(R|/A.A|()::R|/A.baz<kotlin/String, kotlin/Int>|)
|
||||
R|/foo2|(Q|A|::R|/A.baz<kotlin/String, kotlin/Int>|)
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// FILE: JavaClass.java
|
||||
public class JavaClass {
|
||||
public static int bar(String x) { return 0; }
|
||||
public int bar(CharSequence x) { return 0; }
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
fun foo1(x: (String) -> Int) {}
|
||||
|
||||
fun foo2(x: (JavaClass, CharSequence) -> Int) {}
|
||||
|
||||
fun foo3(x: (JavaClass, CharSequence) -> Int) {}
|
||||
fun foo3(x: (String) -> Int) {}
|
||||
|
||||
fun main() {
|
||||
foo1(JavaClass::bar)
|
||||
foo2(JavaClass::bar)
|
||||
<!AMBIGUITY!>foo3<!>(JavaClass::bar)
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
FILE: main.kt
|
||||
public final fun foo1(x: R|(kotlin/String) -> kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun foo2(x: R|(JavaClass, kotlin/CharSequence) -> kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun foo3(x: R|(JavaClass, kotlin/CharSequence) -> kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun foo3(x: R|(kotlin/String) -> kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
R|/foo1|(Q|JavaClass|::R|/JavaClass.bar|)
|
||||
R|/foo2|(Q|JavaClass|::R|/JavaClass.bar|)
|
||||
<Ambiguity: foo3, [/foo3, /foo3]>#(Q|JavaClass|::R|/JavaClass.bar|)
|
||||
}
|
||||
compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/manyCandidatesInference.kt
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
fun <T> foo(x: () -> T, y: Int) {}
|
||||
fun <E> bar(x: E): Int = 1
|
||||
|
||||
fun main() {
|
||||
fun bar(): Int = 1
|
||||
fun foo(x: (String) -> Int, y: String) {}
|
||||
|
||||
foo(::bar, 1)
|
||||
foo(::bar, "")
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
FILE: manyCandidatesInference.kt
|
||||
public final fun <T> foo(x: R|() -> T|, y: R|kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun <E> bar(x: R|E|): R|kotlin/Int| {
|
||||
^bar Int(1)
|
||||
}
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
local final fun bar(): R|kotlin/Int| {
|
||||
^bar Int(1)
|
||||
}
|
||||
|
||||
local final fun foo(x: R|(kotlin/String) -> kotlin/Int|, y: R|kotlin/String|): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
R|/foo|<R|kotlin/Int|>(::R|<local>/bar|, Int(1))
|
||||
R|<local>/foo|(::R|/bar<kotlin/String>|, String())
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
fun foo(x: (String) -> Int) {}
|
||||
|
||||
|
||||
fun bar(y: Any): Int = 1
|
||||
fun bar(x: String): Int = 1
|
||||
|
||||
fun main() {
|
||||
foo(::bar)
|
||||
}
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
FILE: manyInnerCandidates.kt
|
||||
public final fun foo(x: R|(kotlin/String) -> kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun bar(y: R|kotlin/Any|): R|kotlin/Int| {
|
||||
^bar Int(1)
|
||||
}
|
||||
public final fun bar(x: R|kotlin/String|): R|kotlin/Int| {
|
||||
^bar Int(1)
|
||||
}
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
R|/foo|(::R|/bar|)
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
fun foo(x: (String) -> Int) {}
|
||||
fun foo(x: () -> Int) {}
|
||||
|
||||
|
||||
fun bar(): Int = 1
|
||||
fun bar(x: Double): Int = 1
|
||||
|
||||
fun main() {
|
||||
foo(::bar)
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
FILE: manyInnerManyOuterCandidates.kt
|
||||
public final fun foo(x: R|(kotlin/String) -> kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun foo(x: R|() -> kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun bar(): R|kotlin/Int| {
|
||||
^bar Int(1)
|
||||
}
|
||||
public final fun bar(x: R|kotlin/Double|): R|kotlin/Int| {
|
||||
^bar Int(1)
|
||||
}
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
R|/foo|(::R|/bar|)
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
fun foo(x: (String) -> Int) {}
|
||||
fun foo(x: () -> Int) {}
|
||||
|
||||
|
||||
fun bar(): Int = 1
|
||||
fun bar(x: String): Int = 1
|
||||
|
||||
fun main() {
|
||||
<!AMBIGUITY!>foo<!>(<!UNRESOLVED_REFERENCE!>::bar<!>)
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
FILE: manyInnermanyOuterCandidatesAmbiguity.kt
|
||||
public final fun foo(x: R|(kotlin/String) -> kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun foo(x: R|() -> kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun bar(): R|kotlin/Int| {
|
||||
^bar Int(1)
|
||||
}
|
||||
public final fun bar(x: R|kotlin/String|): R|kotlin/Int| {
|
||||
^bar Int(1)
|
||||
}
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
<Ambiguity: foo, [/foo, /foo]>#(::<Unresolved reference: bar>#)
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
fun foo(x: (String) -> Int) {}
|
||||
fun foo(x: () -> Int) {}
|
||||
|
||||
|
||||
fun bar(): Int = 1
|
||||
|
||||
fun main() {
|
||||
foo(::bar)
|
||||
}
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
FILE: manyOuterCandidates.kt
|
||||
public final fun foo(x: R|(kotlin/String) -> kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun foo(x: R|() -> kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun bar(): R|kotlin/Int| {
|
||||
^bar Int(1)
|
||||
}
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
R|/foo|(::R|/bar|)
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
class A {
|
||||
val bar: Int = 1
|
||||
}
|
||||
|
||||
val bar = 1
|
||||
|
||||
val A.baz: Int get() = 1
|
||||
|
||||
fun foo1(x: () -> Int) {}
|
||||
fun foo2(x: (A) -> Int) {}
|
||||
|
||||
fun <R> foo3(x: () -> R) {}
|
||||
fun <T, R> foo4(x: (T) -> R) {}
|
||||
|
||||
fun main() {
|
||||
foo1(::bar)
|
||||
foo2(A::bar)
|
||||
foo2(A::baz)
|
||||
|
||||
foo3(::bar)
|
||||
foo4(A::bar)
|
||||
foo4(A::baz)
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
FILE: properties.kt
|
||||
public final class A : R|kotlin/Any| {
|
||||
public constructor(): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val bar: R|kotlin/Int| = Int(1)
|
||||
public get(): R|kotlin/Int|
|
||||
|
||||
}
|
||||
public final val bar: R|kotlin/Int| = Int(1)
|
||||
public get(): R|kotlin/Int|
|
||||
public final val R|A|.baz: R|kotlin/Int|
|
||||
public get(): R|kotlin/Int| {
|
||||
^ Int(1)
|
||||
}
|
||||
public final fun foo1(x: R|() -> kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun foo2(x: R|(A) -> kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun <R> foo3(x: R|() -> R|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun <T, R> foo4(x: R|(T) -> R|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
R|/foo1|(::R|/bar|)
|
||||
R|/foo2|(Q|A|::R|/A.bar|)
|
||||
R|/foo2|(Q|A|::R|/baz|)
|
||||
R|/foo3|<R|kotlin/Int|>(::R|/bar|)
|
||||
R|/foo4|<R|A|, R|kotlin/Int|>(Q|A|::R|/A.bar|)
|
||||
R|/foo4|<R|A|, R|kotlin/Int|>(Q|A|::R|/baz|)
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
interface MySam {
|
||||
fun run(x: String): Int
|
||||
}
|
||||
|
||||
class A {
|
||||
fun bar(x: String): Int {}
|
||||
}
|
||||
|
||||
fun foo(x: MySam) {}
|
||||
|
||||
fun main() {
|
||||
val a = A()
|
||||
foo(a::bar)
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
FILE: sam.kt
|
||||
public abstract interface MySam : R|kotlin/Any| {
|
||||
public abstract fun run(x: R|kotlin/String|): R|kotlin/Int|
|
||||
|
||||
}
|
||||
public final class A : R|kotlin/Any| {
|
||||
public constructor(): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun bar(x: R|kotlin/String|): R|kotlin/Int| {
|
||||
}
|
||||
|
||||
}
|
||||
public final fun foo(x: R|MySam|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
lval a: R|A| = R|/A.A|()
|
||||
R|/foo|(R|<local>/a|::R|/A.bar|)
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
class A {
|
||||
fun bar(x: String): Int {}
|
||||
}
|
||||
|
||||
fun foo(x: (A, String) -> Int) {}
|
||||
|
||||
fun main() {
|
||||
foo(A::bar)
|
||||
}
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
FILE: simpleClassReceiver.kt
|
||||
public final class A : R|kotlin/Any| {
|
||||
public constructor(): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun bar(x: R|kotlin/String|): R|kotlin/Int| {
|
||||
}
|
||||
|
||||
}
|
||||
public final fun foo(x: R|(A, kotlin/String) -> kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
R|/foo|(Q|A|::R|/A.bar|)
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
class A {
|
||||
fun bar(x: String): Int {}
|
||||
}
|
||||
|
||||
fun foo(x: (String) -> Int) {}
|
||||
|
||||
fun main() {
|
||||
val a = A()
|
||||
foo(a::bar)
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
FILE: simpleExpressionReceiver.kt
|
||||
public final class A : R|kotlin/Any| {
|
||||
public constructor(): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun bar(x: R|kotlin/String|): R|kotlin/Int| {
|
||||
}
|
||||
|
||||
}
|
||||
public final fun foo(x: R|(kotlin/String) -> kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
lval a: R|A| = R|/A.A|()
|
||||
R|/foo|(R|<local>/a|::R|/A.bar|)
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
fun foo(x: (String) -> Int) {}
|
||||
|
||||
fun bar(x: String): Int {}
|
||||
|
||||
fun main() {
|
||||
foo(::bar)
|
||||
}
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
FILE: simpleNoReceiver.kt
|
||||
public final fun foo(x: R|(kotlin/String) -> kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun bar(x: R|kotlin/String|): R|kotlin/Int| {
|
||||
}
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
R|/foo|(::R|/bar|)
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
import kotlin.reflect.KMutableProperty0
|
||||
import kotlin.reflect.KMutableProperty1
|
||||
|
||||
class A {
|
||||
var bar: Int = 1
|
||||
}
|
||||
|
||||
var bar = 1
|
||||
|
||||
fun foo1(x: KMutableProperty0<Int>) {}
|
||||
fun foo2(x: KMutableProperty1<A, Int>) {}
|
||||
|
||||
fun main() {
|
||||
foo1(::bar)
|
||||
foo2(A::bar)
|
||||
}
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
FILE: varProperties.kt
|
||||
public final class A : R|kotlin/Any| {
|
||||
public constructor(): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final var bar: R|kotlin/Int| = Int(1)
|
||||
public get(): R|kotlin/Int|
|
||||
public set(value: R|kotlin/Int|): R|kotlin/Unit|
|
||||
|
||||
}
|
||||
public final var bar: R|kotlin/Int| = Int(1)
|
||||
public get(): R|kotlin/Int|
|
||||
public set(value: R|kotlin/Int|): R|kotlin/Unit|
|
||||
public final fun foo1(x: R|kotlin/reflect/KMutableProperty0<kotlin/Int>|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun foo2(x: R|kotlin/reflect/KMutableProperty1<A, kotlin/Int>|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
R|/foo1|(::R|/bar|)
|
||||
R|/foo2|(Q|A|::R|/A.bar|)
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
inline fun <reified T : Any> foo(t: T): T {
|
||||
val klass = T::class.java
|
||||
return t
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
FILE: classLiteralForParameter.kt
|
||||
public final inline fun <reified T : R|kotlin/Any|> foo(t: R|T|): R|T| {
|
||||
lval klass: R|java/lang/Class<T>| = <getClass>(R|T|).R|kotlin/jvm/java|<R|T|>
|
||||
^foo R|<local>/t|
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fun test_1(array: Array<String>) {
|
||||
array.clone()
|
||||
}
|
||||
|
||||
fun test_2(array: IntArray) {
|
||||
array.clone()
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
FILE: cloneArray.kt
|
||||
public final fun test_1(array: R|kotlin/Array<kotlin/String>|): R|kotlin/Unit| {
|
||||
R|<local>/array|.R|FakeOverride<kotlin/Array.clone: R|kotlin/Array<kotlin/String>|>|()
|
||||
}
|
||||
public final fun test_2(array: R|kotlin/IntArray|): R|kotlin/Unit| {
|
||||
R|<local>/array|.R|kotlin/IntArray.clone|()
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fun main() {
|
||||
val y = Int.MAX_VALUE
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
FILE: companionLoad.kt
|
||||
public final fun main(): R|kotlin/Unit| {
|
||||
lval y: R|kotlin/Int| = Q|kotlin/Int|.R|kotlin/Int.Companion.MAX_VALUE|
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
data class D(val x: Int, val y: String)
|
||||
|
||||
fun foo(list: List<D>) {
|
||||
for ((x, y) in list) {
|
||||
}
|
||||
val (x, y) = list.first()
|
||||
list.forEach { (x, y) ->
|
||||
println(x)
|
||||
println(y)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
FILE: components.kt
|
||||
public final data class D : R|kotlin/Any| {
|
||||
public constructor(x: R|kotlin/Int|, y: R|kotlin/String|): R|D| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val x: R|kotlin/Int| = R|<local>/x|
|
||||
public get(): R|kotlin/Int|
|
||||
|
||||
public final val y: R|kotlin/String| = R|<local>/y|
|
||||
public get(): R|kotlin/String|
|
||||
|
||||
public final fun component1(): R|kotlin/Int| {
|
||||
^component1 this@R|/D|.R|/D.x|
|
||||
}
|
||||
|
||||
public final fun component2(): R|kotlin/String| {
|
||||
^component2 this@R|/D|.R|/D.y|
|
||||
}
|
||||
|
||||
public final fun copy(x: R|kotlin/Int| = this@R|/D|.R|/D.x|, y: R|kotlin/String| = this@R|/D|.R|/D.y|): R|D| {
|
||||
}
|
||||
|
||||
}
|
||||
public final fun foo(list: R|kotlin/collections/List<D>|): R|kotlin/Unit| {
|
||||
lval <iterator>: R|kotlin/collections/Iterator<D>| = R|<local>/list|.R|FakeOverride<kotlin/collections/List.iterator: R|kotlin/collections/Iterator<D>|>|()
|
||||
while(R|<local>/<iterator>|.R|kotlin/collections/Iterator.hasNext|()) {
|
||||
lval <destruct>: R|D| = R|<local>/<iterator>|.R|FakeOverride<kotlin/collections/Iterator.next: R|D|>|()
|
||||
lval x: R|kotlin/Int| = R|<local>/<destruct>|.R|/D.component1|()
|
||||
lval y: R|kotlin/String| = R|<local>/<destruct>|.R|/D.component2|()
|
||||
}
|
||||
|
||||
lval <destruct>: R|D| = R|<local>/list|.R|kotlin/collections/first|<R|D|>()
|
||||
lval x: R|kotlin/Int| = R|<local>/<destruct>|.R|/D.component1|()
|
||||
lval y: R|kotlin/String| = R|<local>/<destruct>|.R|/D.component2|()
|
||||
R|<local>/list|.R|kotlin/collections/forEach|<R|D|>(<L> = forEach@fun <anonymous>(<destruct>: R|D|): R|kotlin/Unit| <kind=UNKNOWN> {
|
||||
lval x: R|kotlin/Int| = R|<local>/<destruct>|.R|/D.component1|()
|
||||
lval y: R|kotlin/String| = R|<local>/<destruct>|.R|/D.component2|()
|
||||
R|kotlin/io/println|(R|<local>/x|)
|
||||
R|kotlin/io/println|(R|<local>/y|)
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
@Volatile
|
||||
var xx: Int = 2
|
||||
|
||||
@Synchronized
|
||||
fun foo() {}
|
||||
@@ -0,0 +1,6 @@
|
||||
FILE: concurrent.kt
|
||||
@R|kotlin/jvm/Volatile|() public final var xx: R|kotlin/Int| = Int(2)
|
||||
public get(): R|kotlin/Int|
|
||||
public set(value: R|kotlin/Int|): R|kotlin/Unit|
|
||||
@R|kotlin/jvm/Synchronized|() public final fun foo(): R|kotlin/Unit| {
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// FULL_JDK
|
||||
private typealias MyAlias = CharSequence
|
||||
|
||||
class A {
|
||||
private val foo = java.util.concurrent.ConcurrentHashMap<String, MyAlias>()
|
||||
|
||||
private fun bar() {
|
||||
foo["dd"]?.baz()
|
||||
}
|
||||
|
||||
private fun MyAlias.baz() {}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
FILE: concurrentMapOfAliases.kt
|
||||
private final typealias MyAlias = R|kotlin/CharSequence|
|
||||
public final class A : R|kotlin/Any| {
|
||||
public constructor(): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
private final val foo: R|java/util/concurrent/ConcurrentHashMap<kotlin/String, kotlin/CharSequence>| = Q|java/util/concurrent|.R|java/util/concurrent/ConcurrentHashMap.ConcurrentHashMap|<R|kotlin/String|, R|kotlin/CharSequence|>()
|
||||
private get(): R|java/util/concurrent/ConcurrentHashMap<kotlin/String, kotlin/CharSequence>|
|
||||
|
||||
private final fun bar(): R|kotlin/Unit| {
|
||||
(this@R|/A|, this@R|/A|.R|/A.foo|.R|FakeOverride<java/util/concurrent/ConcurrentHashMap.get: R|kotlin/CharSequence?|>|(String(dd)))?.R|/A.baz|()
|
||||
}
|
||||
|
||||
private final fun R|MyAlias|.baz(): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
}
|
||||
+295
@@ -0,0 +1,295 @@
|
||||
digraph callsInPlace_kt {
|
||||
graph [nodesep=3]
|
||||
node [shape=box penwidth=2]
|
||||
edge [penwidth=2]
|
||||
|
||||
subgraph cluster_0 {
|
||||
color=red
|
||||
0 [label="Enter function test" style="filled" fillcolor=red];
|
||||
1 [label="Variable declaration: lval x: R|kotlin/Int|"];
|
||||
2 [label="Postponed enter to lambda"];
|
||||
subgraph cluster_1 {
|
||||
color=blue
|
||||
3 [label="Enter function anonymousFunction"];
|
||||
4 [label="Const: Int(1)"];
|
||||
5 [label="Assignmenet: R|<local>/x|"];
|
||||
6 [label="Exit function anonymousFunction"];
|
||||
}
|
||||
7 [label="Call arguments union" style="filled" fillcolor=yellow];
|
||||
8 [label="Postponed exit from lambda"];
|
||||
9 [label="Function call: R|kotlin/run|<R|kotlin/Unit|>(...)"];
|
||||
10 [label="Access variable R|<local>/x|"];
|
||||
11 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()"];
|
||||
12 [label="Exit function test" style="filled" fillcolor=red];
|
||||
}
|
||||
|
||||
0 -> {1};
|
||||
1 -> {2};
|
||||
2 -> {3};
|
||||
2 -> {8} [color=red];
|
||||
3 -> {4};
|
||||
4 -> {5};
|
||||
5 -> {6};
|
||||
6 -> {8} [color=green];
|
||||
6 -> {7} [color=red];
|
||||
7 -> {9} [color=red];
|
||||
8 -> {9} [color=green];
|
||||
9 -> {10};
|
||||
10 -> {11};
|
||||
11 -> {12};
|
||||
|
||||
subgraph cluster_2 {
|
||||
color=red
|
||||
13 [label="Enter function test_2" style="filled" fillcolor=red];
|
||||
14 [label="Const: Int(10)"];
|
||||
15 [label="Postponed enter to lambda"];
|
||||
subgraph cluster_3 {
|
||||
color=blue
|
||||
16 [label="Enter function anonymousFunction"];
|
||||
17 [label="Const: String(test_2)"];
|
||||
18 [label="Exit function anonymousFunction"];
|
||||
}
|
||||
19 [label="Postponed exit from lambda"];
|
||||
20 [label="Function call: R|kotlin/repeat|(...)"];
|
||||
21 [label="Exit function test_2" style="filled" fillcolor=red];
|
||||
}
|
||||
|
||||
13 -> {14};
|
||||
14 -> {15};
|
||||
15 -> {16};
|
||||
15 -> {19} [color=red];
|
||||
16 -> {18 17};
|
||||
17 -> {18};
|
||||
18 -> {16};
|
||||
18 -> {19} [color=green];
|
||||
19 -> {20};
|
||||
20 -> {21};
|
||||
|
||||
subgraph cluster_4 {
|
||||
color=red
|
||||
22 [label="Enter function test_3" style="filled" fillcolor=red];
|
||||
23 [label="Postponed enter to lambda"];
|
||||
subgraph cluster_5 {
|
||||
color=blue
|
||||
24 [label="Enter function anonymousFunction"];
|
||||
25 [label="Const: String(test_3)"];
|
||||
26 [label="Exit function anonymousFunction"];
|
||||
}
|
||||
27 [label="Postponed exit from lambda"];
|
||||
28 [label="Const: Int(10)"];
|
||||
29 [label="Function call: R|kotlin/repeat|(...)"];
|
||||
30 [label="Exit function test_3" style="filled" fillcolor=red];
|
||||
}
|
||||
|
||||
22 -> {23};
|
||||
23 -> {24};
|
||||
23 -> {27} [color=red];
|
||||
24 -> {26 25};
|
||||
25 -> {26};
|
||||
26 -> {24};
|
||||
26 -> {27} [color=green];
|
||||
27 -> {28};
|
||||
28 -> {29};
|
||||
29 -> {30};
|
||||
|
||||
subgraph cluster_6 {
|
||||
color=red
|
||||
31 [label="Enter function test_4" style="filled" fillcolor=red];
|
||||
32 [label="Const: Int(1)"];
|
||||
33 [label="Postponed enter to lambda"];
|
||||
subgraph cluster_7 {
|
||||
color=blue
|
||||
34 [label="Enter function anonymousFunction"];
|
||||
35 [label="Const: String(test_4)"];
|
||||
36 [label="Access variable R|<local>/it|"];
|
||||
37 [label="Const: Int(0)"];
|
||||
38 [label="Function call: R|<local>/it|.R|kotlin/Int.compareTo|(...)"];
|
||||
39 [label="Comparison >"];
|
||||
40 [label="Exit function anonymousFunction"];
|
||||
}
|
||||
41 [label="Call arguments union" style="filled" fillcolor=yellow];
|
||||
42 [label="Postponed exit from lambda"];
|
||||
43 [label="Function call: Int(1).R|kotlin/takeUnless|<R|kotlin/Int|>(...)"];
|
||||
44 [label="Exit function test_4" style="filled" fillcolor=red];
|
||||
}
|
||||
|
||||
31 -> {32};
|
||||
32 -> {33};
|
||||
33 -> {34};
|
||||
33 -> {42} [color=red];
|
||||
34 -> {35};
|
||||
35 -> {36};
|
||||
36 -> {37};
|
||||
37 -> {38};
|
||||
38 -> {39};
|
||||
39 -> {40};
|
||||
40 -> {42} [color=green];
|
||||
40 -> {41} [color=red];
|
||||
41 -> {43} [color=red];
|
||||
42 -> {43} [color=green];
|
||||
43 -> {44};
|
||||
|
||||
subgraph cluster_8 {
|
||||
color=red
|
||||
45 [label="Enter function test_5" style="filled" fillcolor=red];
|
||||
46 [label="Const: Int(1)"];
|
||||
47 [label="Postponed enter to lambda"];
|
||||
subgraph cluster_9 {
|
||||
color=blue
|
||||
48 [label="Enter function anonymousFunction"];
|
||||
49 [label="Const: String(test_5)"];
|
||||
50 [label="Access variable R|<local>/it|"];
|
||||
51 [label="Const: Int(0)"];
|
||||
52 [label="Function call: R|<local>/it|.R|kotlin/Int.compareTo|(...)"];
|
||||
53 [label="Comparison >"];
|
||||
54 [label="Exit function anonymousFunction"];
|
||||
}
|
||||
55 [label="Call arguments union" style="filled" fillcolor=yellow];
|
||||
56 [label="Postponed exit from lambda"];
|
||||
57 [label="Function call: Int(1).R|kotlin/takeUnless|<R|kotlin/Int|>(...)"];
|
||||
58 [label="Exit function test_5" style="filled" fillcolor=red];
|
||||
}
|
||||
|
||||
45 -> {46};
|
||||
46 -> {47};
|
||||
47 -> {48};
|
||||
47 -> {56} [color=red];
|
||||
48 -> {49};
|
||||
49 -> {50};
|
||||
50 -> {51};
|
||||
51 -> {52};
|
||||
52 -> {53};
|
||||
53 -> {54};
|
||||
54 -> {56} [color=green];
|
||||
54 -> {55} [color=red];
|
||||
55 -> {57} [color=red];
|
||||
56 -> {57} [color=green];
|
||||
57 -> {58};
|
||||
|
||||
subgraph cluster_10 {
|
||||
color=red
|
||||
59 [label="Enter function myRun" style="filled" fillcolor=red];
|
||||
60 [label="Function call: R|<local>/block1|.R|FakeOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()"];
|
||||
61 [label="Function call: R|<local>/block2|.R|FakeOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()"];
|
||||
62 [label="Exit function myRun" style="filled" fillcolor=red];
|
||||
}
|
||||
|
||||
59 -> {60};
|
||||
60 -> {61};
|
||||
61 -> {62};
|
||||
|
||||
subgraph cluster_11 {
|
||||
color=red
|
||||
63 [label="Enter function test_6" style="filled" fillcolor=red];
|
||||
64 [label="Postponed enter to lambda"];
|
||||
subgraph cluster_12 {
|
||||
color=blue
|
||||
65 [label="Enter function anonymousFunction"];
|
||||
66 [label="Const: String(test_6_1)"];
|
||||
67 [label="Exit function anonymousFunction"];
|
||||
}
|
||||
68 [label="Postponed exit from lambda"];
|
||||
69 [label="Postponed enter to lambda"];
|
||||
subgraph cluster_13 {
|
||||
color=blue
|
||||
70 [label="Enter function anonymousFunction"];
|
||||
71 [label="Const: String(test_6_2)"];
|
||||
72 [label="Exit function anonymousFunction"];
|
||||
}
|
||||
73 [label="Postponed exit from lambda"];
|
||||
74 [label="Function call: R|/myRun|(...)"];
|
||||
75 [label="Exit function test_6" style="filled" fillcolor=red];
|
||||
}
|
||||
|
||||
63 -> {64};
|
||||
64 -> {65};
|
||||
64 -> {68} [color=red];
|
||||
65 -> {67 66};
|
||||
66 -> {67};
|
||||
67 -> {65};
|
||||
67 -> {68} [color=green];
|
||||
68 -> {69};
|
||||
69 -> {70};
|
||||
69 -> {73} [color=red];
|
||||
70 -> {72 71};
|
||||
71 -> {72};
|
||||
72 -> {70};
|
||||
72 -> {73} [color=green];
|
||||
73 -> {74};
|
||||
74 -> {75};
|
||||
|
||||
subgraph cluster_14 {
|
||||
color=red
|
||||
76 [label="Enter function test_7" style="filled" fillcolor=red];
|
||||
77 [label="Postponed enter to lambda"];
|
||||
subgraph cluster_15 {
|
||||
color=blue
|
||||
78 [label="Enter function anonymousFunction"];
|
||||
79 [label="Const: String(test_7_2)"];
|
||||
80 [label="Exit function anonymousFunction"];
|
||||
}
|
||||
81 [label="Postponed exit from lambda"];
|
||||
82 [label="Postponed enter to lambda"];
|
||||
subgraph cluster_16 {
|
||||
color=blue
|
||||
83 [label="Enter function anonymousFunction"];
|
||||
84 [label="Const: String(test_7_1)"];
|
||||
85 [label="Exit function anonymousFunction"];
|
||||
}
|
||||
86 [label="Postponed exit from lambda"];
|
||||
87 [label="Function call: R|/myRun|(...)"];
|
||||
88 [label="Exit function test_7" style="filled" fillcolor=red];
|
||||
}
|
||||
|
||||
76 -> {77};
|
||||
77 -> {78};
|
||||
77 -> {81} [color=red];
|
||||
78 -> {80 79};
|
||||
79 -> {80};
|
||||
80 -> {78};
|
||||
80 -> {81} [color=green];
|
||||
81 -> {82};
|
||||
82 -> {83};
|
||||
82 -> {86} [color=red];
|
||||
83 -> {85 84};
|
||||
84 -> {85};
|
||||
85 -> {83};
|
||||
85 -> {86} [color=green];
|
||||
86 -> {87};
|
||||
87 -> {88};
|
||||
|
||||
subgraph cluster_17 {
|
||||
color=red
|
||||
89 [label="Enter function myDummyRun" style="filled" fillcolor=red];
|
||||
90 [label="Function call: R|<local>/block|.R|FakeOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()"];
|
||||
91 [label="Exit function myDummyRun" style="filled" fillcolor=red];
|
||||
}
|
||||
|
||||
89 -> {90};
|
||||
90 -> {91};
|
||||
|
||||
subgraph cluster_18 {
|
||||
color=red
|
||||
92 [label="Enter function test_8" style="filled" fillcolor=red];
|
||||
93 [label="Postponed enter to lambda"];
|
||||
94 [label="Postponed exit from lambda"];
|
||||
95 [label="Function call: R|/myDummyRun|(...)"];
|
||||
96 [label="Exit function test_8" style="filled" fillcolor=red];
|
||||
}
|
||||
|
||||
92 -> {93};
|
||||
93 -> {94 94} [color=green];
|
||||
94 -> {95};
|
||||
95 -> {96};
|
||||
|
||||
subgraph cluster_19 {
|
||||
color=red
|
||||
97 [label="Enter function anonymousFunction" style="filled" fillcolor=red];
|
||||
98 [label="Const: String(test_8)"];
|
||||
99 [label="Exit function anonymousFunction" style="filled" fillcolor=red];
|
||||
}
|
||||
|
||||
97 -> {98};
|
||||
98 -> {99};
|
||||
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
// !DUMP_CFG
|
||||
fun test() {
|
||||
val x: Int
|
||||
run {
|
||||
x = 1
|
||||
}
|
||||
x.inc()
|
||||
}
|
||||
|
||||
fun test_2() {
|
||||
repeat(10) {
|
||||
"test_2"
|
||||
}
|
||||
}
|
||||
|
||||
fun test_3() {
|
||||
repeat(action = { "test_3" }, times = 10)
|
||||
}
|
||||
|
||||
fun test_4() {
|
||||
1.takeUnless {
|
||||
"test_4"
|
||||
it > 0
|
||||
}
|
||||
}
|
||||
|
||||
fun test_5() {
|
||||
1.takeUnless(predicate = {
|
||||
"test_5"
|
||||
it > 0
|
||||
})
|
||||
}
|
||||
|
||||
inline fun myRun(block1: () -> Unit, block2: () -> Unit) {
|
||||
block1()
|
||||
block2()
|
||||
}
|
||||
|
||||
fun test_6() {
|
||||
myRun({ "test_6_1" }) { "test_6_2" }
|
||||
}
|
||||
|
||||
fun test_7() {
|
||||
myRun(block2 = { "test_7_2" }, block1 = { "test_7_1" })
|
||||
}
|
||||
|
||||
fun myDummyRun(block: () -> Unit) {
|
||||
block()
|
||||
}
|
||||
|
||||
fun test_8() {
|
||||
myDummyRun { "test_8" }
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
FILE: callsInPlace.kt
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
lval x: R|kotlin/Int|
|
||||
R|kotlin/run|<R|kotlin/Unit|>(<L> = run@fun <anonymous>(): R|kotlin/Unit| <kind=EXACTLY_ONCE> {
|
||||
R|<local>/x| = Int(1)
|
||||
}
|
||||
)
|
||||
R|<local>/x|.R|kotlin/Int.inc|()
|
||||
}
|
||||
public final fun test_2(): R|kotlin/Unit| {
|
||||
R|kotlin/repeat|(Int(10), <L> = repeat@fun <anonymous>(it: R|kotlin/Int|): R|kotlin/Unit| <kind=UNKNOWN> {
|
||||
^ String(test_2)
|
||||
}
|
||||
)
|
||||
}
|
||||
public final fun test_3(): R|kotlin/Unit| {
|
||||
R|kotlin/repeat|(action = repeat@fun <anonymous>(it: R|kotlin/Int|): R|kotlin/Unit| <kind=UNKNOWN> {
|
||||
^ String(test_3)
|
||||
}
|
||||
, times = Int(10))
|
||||
}
|
||||
public final fun test_4(): R|kotlin/Unit| {
|
||||
Int(1).R|kotlin/takeUnless|<R|kotlin/Int|>(<L> = takeUnless@fun <anonymous>(it: R|kotlin/Int|): R|kotlin/Boolean| <kind=EXACTLY_ONCE> {
|
||||
String(test_4)
|
||||
^ CMP(>, R|<local>/it|.R|kotlin/Int.compareTo|(Int(0)))
|
||||
}
|
||||
)
|
||||
}
|
||||
public final fun test_5(): R|kotlin/Unit| {
|
||||
Int(1).R|kotlin/takeUnless|<R|kotlin/Int|>(predicate = takeUnless@fun <anonymous>(it: R|kotlin/Int|): R|kotlin/Boolean| <kind=EXACTLY_ONCE> {
|
||||
String(test_5)
|
||||
^ CMP(>, R|<local>/it|.R|kotlin/Int.compareTo|(Int(0)))
|
||||
}
|
||||
)
|
||||
}
|
||||
public final inline fun myRun(block1: R|() -> kotlin/Unit|, block2: R|() -> kotlin/Unit|): R|kotlin/Unit| {
|
||||
R|<local>/block1|.R|FakeOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()
|
||||
R|<local>/block2|.R|FakeOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()
|
||||
}
|
||||
public final fun test_6(): R|kotlin/Unit| {
|
||||
R|/myRun|(myRun@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> {
|
||||
^ String(test_6_1)
|
||||
}
|
||||
, <L> = myRun@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> {
|
||||
^ String(test_6_2)
|
||||
}
|
||||
)
|
||||
}
|
||||
public final fun test_7(): R|kotlin/Unit| {
|
||||
R|/myRun|(block2 = myRun@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> {
|
||||
^ String(test_7_2)
|
||||
}
|
||||
, block1 = myRun@fun <anonymous>(): R|kotlin/Unit| <kind=UNKNOWN> {
|
||||
^ String(test_7_1)
|
||||
}
|
||||
)
|
||||
}
|
||||
public final fun myDummyRun(block: R|() -> kotlin/Unit|): R|kotlin/Unit| {
|
||||
R|<local>/block|.R|FakeOverride<kotlin/Function0.invoke: R|kotlin/Unit|>|()
|
||||
}
|
||||
public final fun test_8(): R|kotlin/Unit| {
|
||||
R|/myDummyRun|(<L> = myDummyRun@fun <anonymous>(): R|kotlin/Unit| {
|
||||
^ String(test_8)
|
||||
}
|
||||
)
|
||||
}
|
||||
+345
@@ -0,0 +1,345 @@
|
||||
digraph conditionalEffects_kt {
|
||||
graph [nodesep=3]
|
||||
node [shape=box penwidth=2]
|
||||
edge [penwidth=2]
|
||||
|
||||
subgraph cluster_0 {
|
||||
color=red
|
||||
0 [label="Enter function test_1" style="filled" fillcolor=red];
|
||||
1 [label="Access variable R|<local>/x|"];
|
||||
2 [label="Type operator: (R|<local>/x| is R|kotlin/Int|)"];
|
||||
3 [label="Function call: R|kotlin/require|(...)"];
|
||||
subgraph cluster_1 {
|
||||
color=blue
|
||||
4 [label="Enter contract"];
|
||||
5 [label="Access variable R|<local>/x|"];
|
||||
6 [label="Type operator: (R|<local>/x| is R|kotlin/Int|)"];
|
||||
7 [label="Exit contract"];
|
||||
}
|
||||
8 [label="Access variable R|<local>/x|"];
|
||||
9 [label="Function call: R|<local>/x|.R|kotlin/Int.inc|()"];
|
||||
10 [label="Exit function test_1" style="filled" fillcolor=red];
|
||||
}
|
||||
|
||||
0 -> {1};
|
||||
1 -> {2};
|
||||
2 -> {3};
|
||||
3 -> {4};
|
||||
4 -> {5};
|
||||
5 -> {6};
|
||||
6 -> {7};
|
||||
7 -> {8};
|
||||
8 -> {9};
|
||||
9 -> {10};
|
||||
|
||||
subgraph cluster_2 {
|
||||
color=red
|
||||
11 [label="Enter function test_2" style="filled" fillcolor=red];
|
||||
12 [label="Access variable R|<local>/x|"];
|
||||
13 [label="Function call: R|kotlin/requireNotNull|<R|kotlin/String|>(...)"];
|
||||
subgraph cluster_3 {
|
||||
color=blue
|
||||
14 [label="Enter contract"];
|
||||
15 [label="Access variable R|<local>/x|"];
|
||||
16 [label="Const: Null(null)"];
|
||||
17 [label="Operator !="];
|
||||
18 [label="Exit contract"];
|
||||
}
|
||||
19 [label="Access variable R|<local>/x|"];
|
||||
20 [label="Access variable R|kotlin/String.length|"];
|
||||
21 [label="Exit function test_2" style="filled" fillcolor=red];
|
||||
}
|
||||
|
||||
11 -> {12};
|
||||
12 -> {13};
|
||||
13 -> {14};
|
||||
14 -> {15};
|
||||
15 -> {16};
|
||||
16 -> {17};
|
||||
17 -> {18};
|
||||
18 -> {19};
|
||||
19 -> {20};
|
||||
20 -> {21};
|
||||
|
||||
subgraph cluster_4 {
|
||||
color=red
|
||||
22 [label="Enter function test_3" style="filled" fillcolor=red];
|
||||
23 [label="Access variable R|<local>/x|"];
|
||||
24 [label="Const: Null(null)"];
|
||||
25 [label="Operator !="];
|
||||
26 [label="Function call: R|kotlin/require|(...)"];
|
||||
subgraph cluster_5 {
|
||||
color=blue
|
||||
27 [label="Enter contract"];
|
||||
28 [label="Access variable R|<local>/x|"];
|
||||
29 [label="Const: Null(null)"];
|
||||
30 [label="Operator !="];
|
||||
31 [label="Exit contract"];
|
||||
}
|
||||
32 [label="Access variable R|<local>/x|"];
|
||||
33 [label="Access variable R|kotlin/String.length|"];
|
||||
34 [label="Exit function test_3" style="filled" fillcolor=red];
|
||||
}
|
||||
|
||||
22 -> {23};
|
||||
23 -> {24};
|
||||
24 -> {25};
|
||||
25 -> {26};
|
||||
26 -> {27};
|
||||
27 -> {28};
|
||||
28 -> {29};
|
||||
29 -> {30};
|
||||
30 -> {31};
|
||||
31 -> {32};
|
||||
32 -> {33};
|
||||
33 -> {34};
|
||||
|
||||
subgraph cluster_6 {
|
||||
color=red
|
||||
35 [label="Enter function test_4" style="filled" fillcolor=red];
|
||||
subgraph cluster_7 {
|
||||
color=blue
|
||||
36 [label="Enter &&"];
|
||||
37 [label="Access variable R|<local>/x|"];
|
||||
38 [label="Type operator: (R|<local>/x| is R|kotlin/String|)"];
|
||||
39 [label="Exit left part of &&"];
|
||||
40 [label="Enter right part of &&"];
|
||||
41 [label="Access variable R|<local>/y|"];
|
||||
42 [label="Const: Null(null)"];
|
||||
43 [label="Operator !="];
|
||||
44 [label="Exit &&"];
|
||||
}
|
||||
45 [label="Function call: R|kotlin/require|(...)"];
|
||||
subgraph cluster_8 {
|
||||
color=blue
|
||||
46 [label="Enter contract"];
|
||||
subgraph cluster_9 {
|
||||
color=blue
|
||||
47 [label="Enter &&"];
|
||||
48 [label="Access variable R|<local>/x|"];
|
||||
49 [label="Type operator: (R|<local>/x| is R|kotlin/String|)"];
|
||||
50 [label="Exit left part of &&"];
|
||||
51 [label="Enter right part of &&"];
|
||||
52 [label="Access variable R|<local>/y|"];
|
||||
53 [label="Const: Null(null)"];
|
||||
54 [label="Operator !="];
|
||||
55 [label="Exit &&"];
|
||||
}
|
||||
56 [label="Exit contract"];
|
||||
}
|
||||
57 [label="Access variable R|<local>/x|"];
|
||||
58 [label="Access variable R|kotlin/String.length|"];
|
||||
59 [label="Access variable R|<local>/y|"];
|
||||
60 [label="Access variable R|kotlin/String.length|"];
|
||||
61 [label="Exit function test_4" style="filled" fillcolor=red];
|
||||
}
|
||||
|
||||
35 -> {36};
|
||||
36 -> {37};
|
||||
37 -> {38};
|
||||
38 -> {39};
|
||||
39 -> {44 40};
|
||||
40 -> {41};
|
||||
41 -> {42};
|
||||
42 -> {43};
|
||||
43 -> {44};
|
||||
44 -> {45};
|
||||
45 -> {46};
|
||||
46 -> {47};
|
||||
47 -> {48};
|
||||
48 -> {49};
|
||||
49 -> {50};
|
||||
50 -> {55 51};
|
||||
51 -> {52};
|
||||
52 -> {53};
|
||||
53 -> {54};
|
||||
54 -> {55};
|
||||
55 -> {56};
|
||||
56 -> {57};
|
||||
57 -> {58};
|
||||
58 -> {59};
|
||||
59 -> {60};
|
||||
60 -> {61};
|
||||
|
||||
subgraph cluster_10 {
|
||||
color=red
|
||||
62 [label="Enter function test_5" style="filled" fillcolor=red];
|
||||
subgraph cluster_11 {
|
||||
color=blue
|
||||
63 [label="Enter when"];
|
||||
subgraph cluster_12 {
|
||||
color=blue
|
||||
64 [label="Enter when branch condition "];
|
||||
65 [label="Access variable R|<local>/b|"];
|
||||
66 [label="Exit when branch condition"];
|
||||
}
|
||||
subgraph cluster_13 {
|
||||
color=blue
|
||||
67 [label="Enter when branch condition else"];
|
||||
68 [label="Exit when branch condition"];
|
||||
}
|
||||
69 [label="Enter when branch result"];
|
||||
subgraph cluster_14 {
|
||||
color=blue
|
||||
70 [label="Enter block"];
|
||||
71 [label="Access variable R|<local>/x|"];
|
||||
72 [label="Access variable <Unresolved name: length>#"];
|
||||
73 [label="Exit block"];
|
||||
}
|
||||
74 [label="Exit when branch result"];
|
||||
75 [label="Enter when branch result"];
|
||||
subgraph cluster_15 {
|
||||
color=blue
|
||||
76 [label="Enter block"];
|
||||
77 [label="Access variable R|<local>/x|"];
|
||||
78 [label="Type operator: (R|<local>/x| is R|kotlin/String|)"];
|
||||
79 [label="Function call: R|kotlin/require|(...)"];
|
||||
subgraph cluster_16 {
|
||||
color=blue
|
||||
80 [label="Enter contract"];
|
||||
81 [label="Access variable R|<local>/x|"];
|
||||
82 [label="Type operator: (R|<local>/x| is R|kotlin/String|)"];
|
||||
83 [label="Exit contract"];
|
||||
}
|
||||
84 [label="Access variable R|<local>/x|"];
|
||||
85 [label="Access variable R|kotlin/String.length|"];
|
||||
86 [label="Exit block"];
|
||||
}
|
||||
87 [label="Exit when branch result"];
|
||||
88 [label="Exit when"];
|
||||
}
|
||||
89 [label="Access variable R|<local>/x|"];
|
||||
90 [label="Access variable <Unresolved name: length>#"];
|
||||
91 [label="Exit function test_5" style="filled" fillcolor=red];
|
||||
}
|
||||
|
||||
62 -> {63};
|
||||
63 -> {64};
|
||||
64 -> {65};
|
||||
65 -> {66};
|
||||
66 -> {75 67};
|
||||
67 -> {68};
|
||||
68 -> {69};
|
||||
69 -> {70};
|
||||
70 -> {71};
|
||||
71 -> {72};
|
||||
72 -> {73};
|
||||
73 -> {74};
|
||||
74 -> {88};
|
||||
75 -> {76};
|
||||
76 -> {77};
|
||||
77 -> {78};
|
||||
78 -> {79};
|
||||
79 -> {80};
|
||||
80 -> {81};
|
||||
81 -> {82};
|
||||
82 -> {83};
|
||||
83 -> {84};
|
||||
84 -> {85};
|
||||
85 -> {86};
|
||||
86 -> {87};
|
||||
87 -> {88};
|
||||
88 -> {89};
|
||||
89 -> {90};
|
||||
90 -> {91};
|
||||
|
||||
subgraph cluster_17 {
|
||||
color=red
|
||||
92 [label="Enter function test_6" style="filled" fillcolor=red];
|
||||
subgraph cluster_18 {
|
||||
color=blue
|
||||
93 [label="Enter when"];
|
||||
subgraph cluster_19 {
|
||||
color=blue
|
||||
94 [label="Enter when branch condition "];
|
||||
95 [label="Access variable R|<local>/b|"];
|
||||
96 [label="Exit when branch condition"];
|
||||
}
|
||||
subgraph cluster_20 {
|
||||
color=blue
|
||||
97 [label="Enter when branch condition else"];
|
||||
98 [label="Exit when branch condition"];
|
||||
}
|
||||
99 [label="Enter when branch result"];
|
||||
subgraph cluster_21 {
|
||||
color=blue
|
||||
100 [label="Enter block"];
|
||||
101 [label="Access variable R|<local>/x|"];
|
||||
102 [label="Type operator: (R|<local>/x| is R|kotlin/String|)"];
|
||||
103 [label="Function call: R|kotlin/require|(...)"];
|
||||
subgraph cluster_22 {
|
||||
color=blue
|
||||
104 [label="Enter contract"];
|
||||
105 [label="Access variable R|<local>/x|"];
|
||||
106 [label="Type operator: (R|<local>/x| is R|kotlin/String|)"];
|
||||
107 [label="Exit contract"];
|
||||
}
|
||||
108 [label="Access variable R|<local>/x|"];
|
||||
109 [label="Access variable R|kotlin/String.length|"];
|
||||
110 [label="Exit block"];
|
||||
}
|
||||
111 [label="Exit when branch result"];
|
||||
112 [label="Enter when branch result"];
|
||||
subgraph cluster_23 {
|
||||
color=blue
|
||||
113 [label="Enter block"];
|
||||
114 [label="Access variable R|<local>/x|"];
|
||||
115 [label="Type operator: (R|<local>/x| is R|kotlin/String|)"];
|
||||
116 [label="Function call: R|kotlin/require|(...)"];
|
||||
subgraph cluster_24 {
|
||||
color=blue
|
||||
117 [label="Enter contract"];
|
||||
118 [label="Access variable R|<local>/x|"];
|
||||
119 [label="Type operator: (R|<local>/x| is R|kotlin/String|)"];
|
||||
120 [label="Exit contract"];
|
||||
}
|
||||
121 [label="Access variable R|<local>/x|"];
|
||||
122 [label="Access variable R|kotlin/String.length|"];
|
||||
123 [label="Exit block"];
|
||||
}
|
||||
124 [label="Exit when branch result"];
|
||||
125 [label="Exit when"];
|
||||
}
|
||||
126 [label="Access variable R|<local>/x|"];
|
||||
127 [label="Access variable R|kotlin/String.length|"];
|
||||
128 [label="Exit function test_6" style="filled" fillcolor=red];
|
||||
}
|
||||
|
||||
92 -> {93};
|
||||
93 -> {94};
|
||||
94 -> {95};
|
||||
95 -> {96};
|
||||
96 -> {112 97};
|
||||
97 -> {98};
|
||||
98 -> {99};
|
||||
99 -> {100};
|
||||
100 -> {101};
|
||||
101 -> {102};
|
||||
102 -> {103};
|
||||
103 -> {104};
|
||||
104 -> {105};
|
||||
105 -> {106};
|
||||
106 -> {107};
|
||||
107 -> {108};
|
||||
108 -> {109};
|
||||
109 -> {110};
|
||||
110 -> {111};
|
||||
111 -> {125};
|
||||
112 -> {113};
|
||||
113 -> {114};
|
||||
114 -> {115};
|
||||
115 -> {116};
|
||||
116 -> {117};
|
||||
117 -> {118};
|
||||
118 -> {119};
|
||||
119 -> {120};
|
||||
120 -> {121};
|
||||
121 -> {122};
|
||||
122 -> {123};
|
||||
123 -> {124};
|
||||
124 -> {125};
|
||||
125 -> {126};
|
||||
126 -> {127};
|
||||
127 -> {128};
|
||||
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
// !DUMP_CFG
|
||||
fun test_1(x: Any) {
|
||||
require(x is Int)
|
||||
x.inc()
|
||||
}
|
||||
|
||||
fun test_2(x: String?) {
|
||||
requireNotNull(x)
|
||||
x.length
|
||||
}
|
||||
|
||||
fun test_3(x: String?) {
|
||||
require(x != null)
|
||||
x.length
|
||||
}
|
||||
|
||||
fun test_4(x: Any, y: String?) {
|
||||
require(x is String && y != null)
|
||||
x.length
|
||||
y.length
|
||||
}
|
||||
|
||||
fun test_5(x: Any, b: Boolean) {
|
||||
if (b) {
|
||||
require(x is String)
|
||||
x.length
|
||||
} else {
|
||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||
}
|
||||
x.<!UNRESOLVED_REFERENCE!>length<!>
|
||||
}
|
||||
|
||||
fun test_6(x: Any, b: Boolean) {
|
||||
if (b) {
|
||||
require(x is String)
|
||||
x.length
|
||||
} else {
|
||||
require(x is String)
|
||||
x.length
|
||||
}
|
||||
x.length
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
FILE: conditionalEffects.kt
|
||||
public final fun test_1(x: R|kotlin/Any|): R|kotlin/Unit| {
|
||||
R|kotlin/require|((R|<local>/x| is R|kotlin/Int|))
|
||||
R|<local>/x|.R|kotlin/Int.inc|()
|
||||
}
|
||||
public final fun test_2(x: R|kotlin/String?|): R|kotlin/Unit| {
|
||||
R|kotlin/requireNotNull|<R|kotlin/String|>(R|<local>/x|)
|
||||
R|<local>/x|.R|kotlin/String.length|
|
||||
}
|
||||
public final fun test_3(x: R|kotlin/String?|): R|kotlin/Unit| {
|
||||
R|kotlin/require|(!=(R|<local>/x|, Null(null)))
|
||||
R|<local>/x|.R|kotlin/String.length|
|
||||
}
|
||||
public final fun test_4(x: R|kotlin/Any|, y: R|kotlin/String?|): R|kotlin/Unit| {
|
||||
R|kotlin/require|((R|<local>/x| is R|kotlin/String|) && !=(R|<local>/y|, Null(null)))
|
||||
R|<local>/x|.R|kotlin/String.length|
|
||||
R|<local>/y|.R|kotlin/String.length|
|
||||
}
|
||||
public final fun test_5(x: R|kotlin/Any|, b: R|kotlin/Boolean|): R|kotlin/Unit| {
|
||||
when () {
|
||||
R|<local>/b| -> {
|
||||
R|kotlin/require|((R|<local>/x| is R|kotlin/String|))
|
||||
R|<local>/x|.R|kotlin/String.length|
|
||||
}
|
||||
else -> {
|
||||
R|<local>/x|.<Unresolved name: length>#
|
||||
}
|
||||
}
|
||||
|
||||
R|<local>/x|.<Unresolved name: length>#
|
||||
}
|
||||
public final fun test_6(x: R|kotlin/Any|, b: R|kotlin/Boolean|): R|kotlin/Unit| {
|
||||
when () {
|
||||
R|<local>/b| -> {
|
||||
R|kotlin/require|((R|<local>/x| is R|kotlin/String|))
|
||||
R|<local>/x|.R|kotlin/String.length|
|
||||
}
|
||||
else -> {
|
||||
R|kotlin/require|((R|<local>/x| is R|kotlin/String|))
|
||||
R|<local>/x|.R|kotlin/String.length|
|
||||
}
|
||||
}
|
||||
|
||||
R|<local>/x|.R|kotlin/String.length|
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
fun test_1(s: String?) {
|
||||
when {
|
||||
!s.isNullOrEmpty() -> s.length // Should be OK
|
||||
}
|
||||
}
|
||||
|
||||
fun test_2(s: String?) {
|
||||
// contracts related
|
||||
if (s.isNullOrEmpty()) {
|
||||
s.<!INAPPLICABLE_CANDIDATE!>length<!> // Should be bad
|
||||
} else {
|
||||
s.length // Should be OK
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
FILE: notIsNullOrEmpty.kt
|
||||
public final fun test_1(s: R|kotlin/String?|): R|kotlin/Unit| {
|
||||
when () {
|
||||
R|<local>/s|.R|kotlin/text/isNullOrEmpty|().R|kotlin/Boolean.not|() -> {
|
||||
R|<local>/s|.R|kotlin/String.length|
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public final fun test_2(s: R|kotlin/String?|): R|kotlin/Unit| {
|
||||
when () {
|
||||
R|<local>/s|.R|kotlin/text/isNullOrEmpty|() -> {
|
||||
R|<local>/s|.<Inapplicable(WRONG_RECEIVER): [kotlin/String.length]>#
|
||||
}
|
||||
else -> {
|
||||
R|<local>/s|.R|kotlin/String.length|
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
interface Foo {
|
||||
fun bar(): Int
|
||||
}
|
||||
|
||||
val x by lazy {
|
||||
val foo = object : Foo {
|
||||
override fun bar(): Int = 42
|
||||
}
|
||||
foo.bar()
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
FILE: anonymousInDelegate.kt
|
||||
public abstract interface Foo : R|kotlin/Any| {
|
||||
public abstract fun bar(): R|kotlin/Int|
|
||||
|
||||
}
|
||||
public final val x: R|kotlin/Int|by R|kotlin/lazy|<R|kotlin/Int|>(<L> = lazy@fun <anonymous>(): R|kotlin/Int| {
|
||||
lval foo: R|anonymous| = object : R|Foo| {
|
||||
private constructor(): R|anonymous| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final override fun bar(): R|kotlin/Int| {
|
||||
^bar Int(42)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
^ R|<local>/foo|.R|/anonymous.bar|()
|
||||
}
|
||||
)
|
||||
public get(): R|kotlin/Int| {
|
||||
^ D|/x|.R|kotlin/getValue|<R|kotlin/Int|>(Null(null), ::R|/x|)
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user