[FIR-TEST] Move analysis tests to separate module
This commit is contained in:
+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|)
|
||||
}
|
||||
Reference in New Issue
Block a user