[FIR-TEST] Move analysis tests to separate module
This commit is contained in:
+19
@@ -0,0 +1,19 @@
|
||||
// FILE: A.java
|
||||
|
||||
public class A {
|
||||
Object foo(String s) {
|
||||
return null;
|
||||
};
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
class B : A() {
|
||||
override fun foo(s: String): Any? {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
fun test(b: B) {
|
||||
b.foo("")
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
FILE: main.kt
|
||||
public final class B : R|A| {
|
||||
public constructor(): R|B| {
|
||||
super<R|A|>()
|
||||
}
|
||||
|
||||
public final override fun foo(s: R|kotlin/String|): R|kotlin/Any?| {
|
||||
^foo Null(null)
|
||||
}
|
||||
|
||||
}
|
||||
public final fun test(b: R|B|): R|kotlin/Unit| {
|
||||
R|<local>/b|.R|/B.foo|(String())
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
fun foo(first: Int, second: Double = 3.14, third: Boolean = false) {}
|
||||
fun bar(first: Int, second: Double = 2.71, third: Boolean, fourth: String = "") {}
|
||||
fun baz(x: Int, vararg y: String, z: Boolean = false) {}
|
||||
|
||||
fun test() {
|
||||
foo(1)
|
||||
foo(1, 2.0)
|
||||
foo(1, 2.0, true)
|
||||
foo(1, third = true)
|
||||
|
||||
<!INAPPLICABLE_CANDIDATE!>foo<!>()
|
||||
<!INAPPLICABLE_CANDIDATE!>foo<!>(0, 0.0, false, "")
|
||||
|
||||
bar(1, third = true)
|
||||
bar(1, 2.0, true)
|
||||
bar(1, 2.0, true, "my")
|
||||
|
||||
<!INAPPLICABLE_CANDIDATE!>bar<!>(1, true)
|
||||
|
||||
baz(1)
|
||||
baz(1, "my", "yours")
|
||||
baz(1, z = true)
|
||||
|
||||
<!INAPPLICABLE_CANDIDATE!>baz<!>(0, "", false)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
FILE: default.kt
|
||||
public final fun foo(first: R|kotlin/Int|, second: R|kotlin/Double| = Double(3.14), third: R|kotlin/Boolean| = Boolean(false)): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun bar(first: R|kotlin/Int|, second: R|kotlin/Double| = Double(2.71), third: R|kotlin/Boolean|, fourth: R|kotlin/String| = String()): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun baz(x: R|kotlin/Int|, vararg y: R|kotlin/Array<out kotlin/String>|, z: R|kotlin/Boolean| = Boolean(false)): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
R|/foo|(Int(1))
|
||||
R|/foo|(Int(1), Double(2.0))
|
||||
R|/foo|(Int(1), Double(2.0), Boolean(true))
|
||||
R|/foo|(Int(1), third = Boolean(true))
|
||||
<Inapplicable(PARAMETER_MAPPING_ERROR): [/foo]>#()
|
||||
<Inapplicable(PARAMETER_MAPPING_ERROR): [/foo]>#(Int(0), Double(0.0), Boolean(false), String())
|
||||
R|/bar|(Int(1), third = Boolean(true))
|
||||
R|/bar|(Int(1), Double(2.0), Boolean(true))
|
||||
R|/bar|(Int(1), Double(2.0), Boolean(true), String(my))
|
||||
<Inapplicable(PARAMETER_MAPPING_ERROR): [/bar]>#(Int(1), Boolean(true))
|
||||
R|/baz|(Int(1))
|
||||
R|/baz|(Int(1), vararg(String(my), String(yours)))
|
||||
R|/baz|(Int(1), z = Boolean(true))
|
||||
<Inapplicable(INAPPLICABLE): [/baz]>#(Int(0), String(), Boolean(false))
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
interface I1 {
|
||||
fun foo(x: Int = 1)
|
||||
}
|
||||
|
||||
interface I2 {
|
||||
fun bar(x: String = "", y: Int)
|
||||
}
|
||||
|
||||
class A : I1, I2 {
|
||||
override fun foo(x: Int) {}
|
||||
override fun bar(x: String, y: Int) {}
|
||||
}
|
||||
|
||||
fun foo(a: A) {
|
||||
a.foo()
|
||||
a.foo(1)
|
||||
|
||||
a.<!INAPPLICABLE_CANDIDATE!>bar<!>()
|
||||
a.<!INAPPLICABLE_CANDIDATE!>bar<!>("")
|
||||
a.bar(y = 1)
|
||||
a.bar("", 2)
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
FILE: defaultFromOverrides.kt
|
||||
public abstract interface I1 : R|kotlin/Any| {
|
||||
public abstract fun foo(x: R|kotlin/Int| = Int(1)): R|kotlin/Unit|
|
||||
|
||||
}
|
||||
public abstract interface I2 : R|kotlin/Any| {
|
||||
public abstract fun bar(x: R|kotlin/String| = String(), y: R|kotlin/Int|): R|kotlin/Unit|
|
||||
|
||||
}
|
||||
public final class A : R|I1|, R|I2| {
|
||||
public constructor(): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final override fun foo(x: R|kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
public final override fun bar(x: R|kotlin/String|, y: R|kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
}
|
||||
public final fun foo(a: R|A|): R|kotlin/Unit| {
|
||||
R|<local>/a|.R|/A.foo|()
|
||||
R|<local>/a|.R|/A.foo|(Int(1))
|
||||
R|<local>/a|.<Inapplicable(PARAMETER_MAPPING_ERROR): [/A.bar]>#()
|
||||
R|<local>/a|.<Inapplicable(PARAMETER_MAPPING_ERROR): [/A.bar]>#(String())
|
||||
R|<local>/a|.R|/A.bar|(y = Int(1))
|
||||
R|<local>/a|.R|/A.bar|(String(), Int(2))
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
interface Out<out E>
|
||||
|
||||
fun <X> id(x: Out<X>): Out<X> = TODO()
|
||||
|
||||
fun <F : Any> foo(computable: Out<F?>)
|
||||
|
||||
fun <T : Any> bar(computable: Out<T?>) {
|
||||
foo(id(computable))
|
||||
}
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
FILE: definetelyNotNullForTypeParameter.kt
|
||||
public abstract interface Out<out E> : R|kotlin/Any| {
|
||||
}
|
||||
public final fun <X> id(x: R|Out<X>|): R|Out<X>| {
|
||||
^id R|kotlin/TODO|()
|
||||
}
|
||||
public final fun <F : R|kotlin/Any|> foo(computable: R|Out<F?>|): R|kotlin/Unit|
|
||||
public final fun <T : R|kotlin/Any|> bar(computable: R|Out<T?>|): R|kotlin/Unit| {
|
||||
R|/foo|<R|T?!!|>(R|/id|<R|T?|>(R|<local>/computable|))
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
fun test(
|
||||
val f: String.() -> Int = { length }
|
||||
): Int {
|
||||
return "".f()
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
FILE: extensionLambdaInDefaultArgument.kt
|
||||
public final fun test(f: R|kotlin/String.() -> kotlin/Int| = fun R|kotlin/String|.<anonymous>(): R|kotlin/Int| {
|
||||
^ this@R|special/anonymous|.R|kotlin/String.length|
|
||||
}
|
||||
): R|kotlin/Int| {
|
||||
^test R|<local>/f|.R|FakeOverride<kotlin/Function1.invoke: R|kotlin/Int|>|(String())
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
var x: Int = 1
|
||||
set(value) {
|
||||
field += value
|
||||
}
|
||||
|
||||
val y: Int = 1
|
||||
get() {
|
||||
<!VARIABLE_EXPECTED!>field<!> += 1
|
||||
return 1
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
FILE: fieldPlusAssign.kt
|
||||
public final var x: R|kotlin/Int| = Int(1)
|
||||
public get(): R|kotlin/Int|
|
||||
public set(value: R|kotlin/Int|): R|kotlin/Unit| {
|
||||
F|/x| = F|/x|.R|kotlin/Int.plus|(R|<local>/value|)
|
||||
}
|
||||
public final val y: R|kotlin/Int| = Int(1)
|
||||
public get(): R|kotlin/Int| {
|
||||
<Variable expected># = F|/y|.R|kotlin/Int.plus|(Int(1))
|
||||
^ Int(1)
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
fun foo(func: Int.(Int) -> Int) {}
|
||||
|
||||
fun test() {
|
||||
foo {
|
||||
this + it
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
FILE: incorrectFunctionalType.kt
|
||||
public final fun foo(func: R|kotlin/Int.(kotlin/Int) -> kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
R|/foo|(<L> = foo@fun R|kotlin/Int|.<anonymous>(it: R|kotlin/Int|): R|kotlin/Int| {
|
||||
^ this@R|special/anonymous|.R|kotlin/Int.plus|(R|<local>/it|)
|
||||
}
|
||||
)
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
fun takeInt(x: Int) {}
|
||||
fun takeLong(x: Long) {}
|
||||
fun takeByte(x: Byte) {}
|
||||
fun takeAny(x: Any) {}
|
||||
fun takeString(x: String) {}
|
||||
|
||||
fun test_0() {
|
||||
1l
|
||||
1
|
||||
10000000000
|
||||
}
|
||||
|
||||
fun test_1() {
|
||||
takeInt(1)
|
||||
takeByte(1)
|
||||
takeLong(1)
|
||||
}
|
||||
|
||||
fun test_2() {
|
||||
<!INAPPLICABLE_CANDIDATE!>takeInt<!>(10000000000)
|
||||
takeLong(10000000000)
|
||||
<!INAPPLICABLE_CANDIDATE!>takeByte<!>(1000)
|
||||
}
|
||||
|
||||
fun test_3() {
|
||||
takeInt(run { 1 })
|
||||
takeByte(run { 1 })
|
||||
takeLong(run { 1 })
|
||||
}
|
||||
|
||||
|
||||
fun test_4() {
|
||||
takeAny(1)
|
||||
takeAny(run { 1 })
|
||||
}
|
||||
|
||||
fun test_5() {
|
||||
<!INAPPLICABLE_CANDIDATE!>takeString<!>(1)
|
||||
<!INAPPLICABLE_CANDIDATE!>takeString<!>(run { 1 })
|
||||
}
|
||||
|
||||
annotation class Ann(val x: Byte)
|
||||
|
||||
@Ann(10)
|
||||
fun test_6() {
|
||||
@Ann(300)
|
||||
val x = ""
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
FILE: integerLiteralTypes.kt
|
||||
public final fun takeInt(x: R|kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun takeLong(x: R|kotlin/Long|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun takeByte(x: R|kotlin/Byte|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun takeAny(x: R|kotlin/Any|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun takeString(x: R|kotlin/String|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun test_0(): R|kotlin/Unit| {
|
||||
Long(1)
|
||||
Int(1)
|
||||
Long(10000000000)
|
||||
}
|
||||
public final fun test_1(): R|kotlin/Unit| {
|
||||
R|/takeInt|(Int(1))
|
||||
R|/takeByte|(Byte(1))
|
||||
R|/takeLong|(Long(1))
|
||||
}
|
||||
public final fun test_2(): R|kotlin/Unit| {
|
||||
<Inapplicable(INAPPLICABLE): [/takeInt]>#(Long(10000000000))
|
||||
R|/takeLong|(Long(10000000000))
|
||||
<Inapplicable(INAPPLICABLE): [/takeByte]>#(Int(1000))
|
||||
}
|
||||
public final fun test_3(): R|kotlin/Unit| {
|
||||
R|/takeInt|(R|kotlin/run|<R|kotlin/Int|>(<L> = run@fun <anonymous>(): R|kotlin/Int| <kind=EXACTLY_ONCE> {
|
||||
^ Int(1)
|
||||
}
|
||||
))
|
||||
R|/takeByte|(R|kotlin/run|<R|kotlin/Byte|>(<L> = run@fun <anonymous>(): R|kotlin/Byte| <kind=EXACTLY_ONCE> {
|
||||
^ Int(1)
|
||||
}
|
||||
))
|
||||
R|/takeLong|(R|kotlin/run|<R|kotlin/Long|>(<L> = run@fun <anonymous>(): R|kotlin/Long| <kind=EXACTLY_ONCE> {
|
||||
^ Int(1)
|
||||
}
|
||||
))
|
||||
}
|
||||
public final fun test_4(): R|kotlin/Unit| {
|
||||
R|/takeAny|(Int(1))
|
||||
R|/takeAny|(R|kotlin/run|<R|kotlin/Int|>(<L> = run@fun <anonymous>(): R|kotlin/Int| <kind=EXACTLY_ONCE> {
|
||||
^ Int(1)
|
||||
}
|
||||
))
|
||||
}
|
||||
public final fun test_5(): R|kotlin/Unit| {
|
||||
<Inapplicable(INAPPLICABLE): [/takeString]>#(Int(1))
|
||||
<Inapplicable(INAPPLICABLE): [/takeString]>#(R|kotlin/run|<R|kotlin/Int|>(<L> = run@fun <anonymous>(): R|kotlin/Int| <kind=EXACTLY_ONCE> {
|
||||
^ Int(1)
|
||||
}
|
||||
))
|
||||
}
|
||||
public final annotation class Ann : R|kotlin/Annotation| {
|
||||
public constructor(x: R|kotlin/Byte|): R|Ann| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val x: R|kotlin/Byte| = R|<local>/x|
|
||||
public get(): R|kotlin/Byte|
|
||||
|
||||
}
|
||||
@R|Ann|(Int(10)) public final fun test_6(): R|kotlin/Unit| {
|
||||
@R|Ann|(Int(300)) lval x: R|kotlin/String| = String()
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
class My(var x: Int) {
|
||||
operator fun invoke() = x
|
||||
|
||||
fun foo() {}
|
||||
|
||||
fun copy() = My(x)
|
||||
}
|
||||
|
||||
fun testInvoke(): Int = My(13)()
|
||||
@@ -0,0 +1,25 @@
|
||||
FILE: invoke.kt
|
||||
public final class My : R|kotlin/Any| {
|
||||
public constructor(x: R|kotlin/Int|): R|My| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final var x: R|kotlin/Int| = R|<local>/x|
|
||||
public get(): R|kotlin/Int|
|
||||
public set(value: R|kotlin/Int|): R|kotlin/Unit|
|
||||
|
||||
public final operator fun invoke(): R|kotlin/Int| {
|
||||
^invoke this@R|/My|.R|/My.x|
|
||||
}
|
||||
|
||||
public final fun foo(): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
public final fun copy(): R|My| {
|
||||
^copy R|/My.My|(this@R|/My|.R|/My.x|)
|
||||
}
|
||||
|
||||
}
|
||||
public final fun testInvoke(): R|kotlin/Int| {
|
||||
^testInvoke R|/My.My|(Int(13)).R|/My.invoke|()
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// FILE: A.java
|
||||
public class A {
|
||||
public static void take(A[] array) {}
|
||||
}
|
||||
|
||||
// FILE: B.java
|
||||
public class B extends A {}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
fun takeA(array: Array<A>) {}
|
||||
fun takeOutA(array: Array<out A>) {}
|
||||
|
||||
fun test(array: Array<B>) {
|
||||
A.take(array)
|
||||
<!INAPPLICABLE_CANDIDATE!>takeA<!>(array)
|
||||
takeOutA(array)
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
FILE: main.kt
|
||||
public final fun takeA(array: R|kotlin/Array<A>|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun takeOutA(array: R|kotlin/Array<out A>|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun test(array: R|kotlin/Array<B>|): R|kotlin/Unit| {
|
||||
Q|A|.R|/A.take|(R|<local>/array|)
|
||||
<Inapplicable(INAPPLICABLE): [/takeA]>#(R|<local>/array|)
|
||||
R|/takeOutA|(R|<local>/array|)
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
fun foo(f: () -> Unit) {}
|
||||
fun bar(x: Int, f: () -> Unit) {}
|
||||
fun baz(f: () -> Unit, other: Boolean = true) {}
|
||||
|
||||
|
||||
fun test() {
|
||||
// OK
|
||||
foo {}
|
||||
foo() {}
|
||||
foo({})
|
||||
|
||||
// Bad
|
||||
<!INAPPLICABLE_CANDIDATE!>foo<!>(1) {}
|
||||
<!INAPPLICABLE_CANDIDATE!>foo<!>(f = {}) {}
|
||||
|
||||
// OK
|
||||
bar(1) {}
|
||||
bar(x = 1) {}
|
||||
bar(1, {})
|
||||
bar(x = 1, f = {})
|
||||
|
||||
// Bad
|
||||
<!INAPPLICABLE_CANDIDATE!>bar<!> {}
|
||||
<!INAPPLICABLE_CANDIDATE!>bar<!>({})
|
||||
|
||||
// OK
|
||||
baz(other = false, f = {})
|
||||
baz({}, false)
|
||||
|
||||
// Bad
|
||||
<!INAPPLICABLE_CANDIDATE!>baz<!> {}
|
||||
<!INAPPLICABLE_CANDIDATE!>baz<!>() {}
|
||||
<!INAPPLICABLE_CANDIDATE!>baz<!>(other = false) {}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
FILE: lambda.kt
|
||||
public final fun foo(f: R|() -> kotlin/Unit|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun bar(x: R|kotlin/Int|, f: R|() -> kotlin/Unit|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun baz(f: R|() -> kotlin/Unit|, other: R|kotlin/Boolean| = Boolean(true)): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
R|/foo|(<L> = foo@fun <anonymous>(): R|kotlin/Unit| {
|
||||
Unit
|
||||
}
|
||||
)
|
||||
R|/foo|(<L> = foo@fun <anonymous>(): R|kotlin/Unit| {
|
||||
Unit
|
||||
}
|
||||
)
|
||||
R|/foo|(foo@fun <anonymous>(): R|kotlin/Unit| {
|
||||
Unit
|
||||
}
|
||||
)
|
||||
<Inapplicable(PARAMETER_MAPPING_ERROR): [/foo]>#(Int(1), <L> = foo@fun <anonymous>(): R|kotlin/Unit| {
|
||||
Unit
|
||||
}
|
||||
)
|
||||
<Inapplicable(PARAMETER_MAPPING_ERROR): [/foo]>#(f = foo@fun <anonymous>(): R|kotlin/Unit| {
|
||||
Unit
|
||||
}
|
||||
, <L> = foo@fun <anonymous>(): R|kotlin/Unit| {
|
||||
Unit
|
||||
}
|
||||
)
|
||||
R|/bar|(Int(1), <L> = bar@fun <anonymous>(): R|kotlin/Unit| {
|
||||
Unit
|
||||
}
|
||||
)
|
||||
R|/bar|(x = Int(1), <L> = bar@fun <anonymous>(): R|kotlin/Unit| {
|
||||
Unit
|
||||
}
|
||||
)
|
||||
R|/bar|(Int(1), bar@fun <anonymous>(): R|kotlin/Unit| {
|
||||
Unit
|
||||
}
|
||||
)
|
||||
R|/bar|(x = Int(1), f = bar@fun <anonymous>(): R|kotlin/Unit| {
|
||||
Unit
|
||||
}
|
||||
)
|
||||
<Inapplicable(PARAMETER_MAPPING_ERROR): [/bar]>#(<L> = bar@fun <anonymous>(): R|kotlin/Unit| {
|
||||
Unit
|
||||
}
|
||||
)
|
||||
<Inapplicable(PARAMETER_MAPPING_ERROR): [/bar]>#(bar@fun <anonymous>(): R|kotlin/Unit| {
|
||||
Unit
|
||||
}
|
||||
)
|
||||
R|/baz|(other = Boolean(false), f = baz@fun <anonymous>(): R|kotlin/Unit| {
|
||||
Unit
|
||||
}
|
||||
)
|
||||
R|/baz|(baz@fun <anonymous>(): R|kotlin/Unit| {
|
||||
Unit
|
||||
}
|
||||
, Boolean(false))
|
||||
<Inapplicable(PARAMETER_MAPPING_ERROR): [/baz]>#(<L> = baz@fun <anonymous>(): R|kotlin/Unit| {
|
||||
Unit
|
||||
}
|
||||
)
|
||||
<Inapplicable(PARAMETER_MAPPING_ERROR): [/baz]>#(<L> = baz@fun <anonymous>(): R|kotlin/Unit| {
|
||||
Unit
|
||||
}
|
||||
)
|
||||
<Inapplicable(PARAMETER_MAPPING_ERROR): [/baz]>#(other = Boolean(false), <L> = baz@fun <anonymous>(): R|kotlin/Unit| {
|
||||
Unit
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
class StringBuilder {
|
||||
fun append(s: String) {}
|
||||
}
|
||||
|
||||
fun buildString(init: StringBuilder.() -> Unit): String {}
|
||||
|
||||
interface Template<in X>
|
||||
|
||||
class KDocTemplate : Template<StringBuilder> {
|
||||
fun definition(content: StringBuilder.() -> Unit) {}
|
||||
}
|
||||
|
||||
fun <U, T : Template<U>> U.insert(template: T, build: T.() -> Unit) {}
|
||||
|
||||
fun test(ordinal: Int) {
|
||||
buildString {
|
||||
insert(KDocTemplate()) {
|
||||
definition {
|
||||
ordinal?.let {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
FILE: lambdaInLambda.kt
|
||||
public final class StringBuilder : R|kotlin/Any| {
|
||||
public constructor(): R|StringBuilder| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun append(s: R|kotlin/String|): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
}
|
||||
public final fun buildString(init: R|StringBuilder.() -> kotlin/Unit|): R|kotlin/String| {
|
||||
}
|
||||
public abstract interface Template<in X> : R|kotlin/Any| {
|
||||
}
|
||||
public final class KDocTemplate : R|Template<StringBuilder>| {
|
||||
public constructor(): R|KDocTemplate| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun definition(content: R|StringBuilder.() -> kotlin/Unit|): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
}
|
||||
public final fun <U, T : R|Template<U>|> R|U|.insert(template: R|T|, build: R|T.() -> kotlin/Unit|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun test(ordinal: R|kotlin/Int|): R|kotlin/Unit| {
|
||||
R|/buildString|(<L> = buildString@fun R|StringBuilder|.<anonymous>(): R|kotlin/Unit| {
|
||||
this@R|special/anonymous|.R|/insert|<R|StringBuilder|, R|KDocTemplate|>(R|/KDocTemplate.KDocTemplate|(), <L> = insert@fun R|KDocTemplate|.<anonymous>(): R|kotlin/Unit| {
|
||||
this@R|special/anonymous|.R|/KDocTemplate.definition|(<L> = definition@fun R|StringBuilder|.<anonymous>(): R|kotlin/Unit| {
|
||||
^ R|<local>/ordinal|?.R|kotlin/let|<R|kotlin/Int|, R|kotlin/Unit|>(<L> = let@fun <anonymous>(it: R|kotlin/Int|): R|kotlin/Unit| <kind=EXACTLY_ONCE> {
|
||||
Unit
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
|
||||
// FILE: Function.java
|
||||
|
||||
public interface Function<Param, Result> {
|
||||
Result fun(Param param);
|
||||
}
|
||||
|
||||
// FILE: AdapterProcessor.java
|
||||
|
||||
public class AdapterProcessor<T, S> {
|
||||
public AdapterProcessor(Function<? super T, ? extends S> conversion) {}
|
||||
}
|
||||
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
interface PsiMethod {
|
||||
val containingClass: PsiClass?
|
||||
}
|
||||
|
||||
interface PsiClass
|
||||
|
||||
fun test() {
|
||||
// TODO: don't forget to implement preservation flexibility of java type parameters in FIR (this is the reason of error here)
|
||||
val processor = <!INAPPLICABLE_CANDIDATE!>AdapterProcessor<!><PsiMethod, PsiClass>(
|
||||
Function { method: PsiMethod? -> method?.containingClass }
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
FILE: main.kt
|
||||
public abstract interface PsiMethod : R|kotlin/Any| {
|
||||
public abstract val containingClass: R|PsiClass?|
|
||||
public get(): R|PsiClass?|
|
||||
|
||||
}
|
||||
public abstract interface PsiClass : R|kotlin/Any| {
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
lval processor: <ERROR TYPE REF: Inapplicable(INAPPLICABLE): [/AdapterProcessor.AdapterProcessor]> = <Inapplicable(INAPPLICABLE): [/AdapterProcessor.AdapterProcessor]>#<R|PsiMethod|, R|PsiClass|>(R|/Function|<R|PsiMethod?|, R|PsiClass?|>(<L> = Function@fun <anonymous>(method: R|PsiMethod?|): R|PsiClass?| {
|
||||
^ R|<local>/method|?.R|/PsiMethod.containingClass|
|
||||
}
|
||||
))
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
fun <R> materialize(): R = null!!
|
||||
|
||||
fun test_1() {
|
||||
<!UNRESOLVED_REFERENCE!>myRun<!> {
|
||||
val x = 1
|
||||
x * 2
|
||||
}
|
||||
}
|
||||
|
||||
fun test_2() {
|
||||
<!UNRESOLVED_REFERENCE!>myRun<!> {
|
||||
materialize()
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
FILE: lambdaInUnresolvedCall.kt
|
||||
public final fun <R> materialize(): R|R| {
|
||||
^materialize Null(null)!!
|
||||
}
|
||||
public final fun test_1(): R|kotlin/Unit| {
|
||||
<Unresolved name: myRun>#(<L> = myRun@fun <anonymous>(): R|kotlin/Int| {
|
||||
lval x: R|kotlin/Int| = Int(1)
|
||||
^ R|<local>/x|.R|kotlin/Int.times|(Int(2))
|
||||
}
|
||||
)
|
||||
}
|
||||
public final fun test_2(): R|kotlin/Unit| {
|
||||
<Unresolved name: myRun>#(<L> = myRun@fun <anonymous>(): R|kotlin/Any?| {
|
||||
^ R|/materialize|<R|kotlin/Any?|>()
|
||||
}
|
||||
)
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
fun foo(x: Int) {}
|
||||
fun foo(x: Byte) {}
|
||||
|
||||
fun test_0() {
|
||||
foo(1)
|
||||
}
|
||||
|
||||
fun test_1() {
|
||||
val x1 = 1 + 1
|
||||
val x2 = 1.plus(1)
|
||||
1 + 1
|
||||
127 + 1
|
||||
val x3 = 2000000000 * 4
|
||||
}
|
||||
|
||||
fun test_2(n: Int) {
|
||||
val x = 1 + n
|
||||
val y = n + 1
|
||||
}
|
||||
|
||||
fun Int.bar(): Int {}
|
||||
|
||||
fun Int.baz(): Int
|
||||
fun Byte.baz(): Byte {}
|
||||
|
||||
fun test_3() {
|
||||
val x = 1.bar()
|
||||
val y = 1.baz()
|
||||
}
|
||||
|
||||
fun takeByte(b: Byte) {}
|
||||
|
||||
fun test_4() {
|
||||
takeByte(1 + 1)
|
||||
<!INAPPLICABLE_CANDIDATE!>takeByte<!>(1 + 127)
|
||||
takeByte(1 - 1)
|
||||
<!INAPPLICABLE_CANDIDATE!>takeByte<!>(-100 - 100)
|
||||
takeByte(10 * 10)
|
||||
<!INAPPLICABLE_CANDIDATE!>takeByte<!>(100 * 100)
|
||||
<!UNRESOLVED_REFERENCE!>taleByte<!>(10 / 10)
|
||||
takeByte(100 % 10)
|
||||
takeByte(1000 % 10)
|
||||
takeByte(1000 and 100)
|
||||
<!INAPPLICABLE_CANDIDATE!>takeByte<!>(128 and 511)
|
||||
takeByte(100 or 100)
|
||||
<!INAPPLICABLE_CANDIDATE!>takeByte<!>(1000 or 0)
|
||||
takeByte(511 xor 511)
|
||||
<!INAPPLICABLE_CANDIDATE!>takeByte<!>(512 xor 511)
|
||||
}
|
||||
|
||||
fun test_5() {
|
||||
takeByte(-1)
|
||||
takeByte(+1)
|
||||
takeByte(1.inv())
|
||||
}
|
||||
|
||||
fun test_6() {
|
||||
<!INAPPLICABLE_CANDIDATE!>takeByte<!>(run { 127 + 1 })
|
||||
<!INAPPLICABLE_CANDIDATE!>takeByte<!>(1 + run { 1 })
|
||||
takeByte(run { 1 + 1 })
|
||||
1 + 1
|
||||
run { 1 }
|
||||
1 + run { 1 }
|
||||
}
|
||||
|
||||
fun test_7(d: Double) {
|
||||
val x1 = 1 + d
|
||||
val x2 = d + 1
|
||||
}
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
FILE: operatorsOverLiterals.kt
|
||||
public final fun foo(x: R|kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun foo(x: R|kotlin/Byte|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun test_0(): R|kotlin/Unit| {
|
||||
R|/foo|(Int(1))
|
||||
}
|
||||
public final fun test_1(): R|kotlin/Unit| {
|
||||
lval x1: R|kotlin/Int| = Int(1).R|kotlin/Int.plus|(Int(1))
|
||||
lval x2: R|kotlin/Int| = Int(1).R|kotlin/Int.plus|(Int(1))
|
||||
Int(1).R|kotlin/Int.plus|(Int(1))
|
||||
Int(127).R|kotlin/Int.plus|(Int(1))
|
||||
lval x3: R|kotlin/Int| = Int(2000000000).R|kotlin/Int.times|(Int(4))
|
||||
}
|
||||
public final fun test_2(n: R|kotlin/Int|): R|kotlin/Unit| {
|
||||
lval x: R|kotlin/Int| = Int(1).R|kotlin/Int.plus|(R|<local>/n|)
|
||||
lval y: R|kotlin/Int| = R|<local>/n|.R|kotlin/Int.plus|(Int(1))
|
||||
}
|
||||
public final fun R|kotlin/Int|.bar(): R|kotlin/Int| {
|
||||
}
|
||||
public final fun R|kotlin/Int|.baz(): R|kotlin/Int|
|
||||
public final fun R|kotlin/Byte|.baz(): R|kotlin/Byte| {
|
||||
}
|
||||
public final fun test_3(): R|kotlin/Unit| {
|
||||
lval x: R|kotlin/Int| = Int(1).R|/bar|()
|
||||
lval y: R|kotlin/Int| = Int(1).R|/baz|()
|
||||
}
|
||||
public final fun takeByte(b: R|kotlin/Byte|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun test_4(): R|kotlin/Unit| {
|
||||
R|/takeByte|(Byte(1).R|kotlin/Byte.plus|(Byte(1)))
|
||||
<Inapplicable(INAPPLICABLE): [/takeByte]>#(Int(1).R|kotlin/Int.plus|(Int(127)))
|
||||
R|/takeByte|(Byte(1).R|kotlin/Byte.minus|(Byte(1)))
|
||||
<Inapplicable(INAPPLICABLE): [/takeByte]>#(Int(100).R|kotlin/Int.unaryMinus|().R|kotlin/Int.minus|(Int(100)))
|
||||
R|/takeByte|(Byte(10).R|kotlin/Byte.times|(Byte(10)))
|
||||
<Inapplicable(INAPPLICABLE): [/takeByte]>#(Int(100).R|kotlin/Int.times|(Int(100)))
|
||||
<Unresolved name: taleByte>#(Int(10).R|kotlin/Int.div|(Int(10)))
|
||||
R|/takeByte|(Byte(100).R|kotlin/Byte.rem|(Byte(10)))
|
||||
R|/takeByte|(Int(1000).R|kotlin/Int.rem|(Byte(10)))
|
||||
R|/takeByte|(Int(1000).R|<local>/and|(Byte(100)))
|
||||
<Inapplicable(INAPPLICABLE): [/takeByte]>#(Int(128).R|kotlin/Int.and|(Int(511)))
|
||||
R|/takeByte|(Byte(100).R|<local>/or|(Byte(100)))
|
||||
<Inapplicable(INAPPLICABLE): [/takeByte]>#(Int(1000).R|kotlin/Int.or|(Int(0)))
|
||||
R|/takeByte|(Int(511).R|kotlin/Int.xor|(Int(511)))
|
||||
<Inapplicable(INAPPLICABLE): [/takeByte]>#(Int(512).R|kotlin/Int.xor|(Int(511)))
|
||||
}
|
||||
public final fun test_5(): R|kotlin/Unit| {
|
||||
R|/takeByte|(Byte(1).R|kotlin/Byte.unaryMinus|())
|
||||
R|/takeByte|(Byte(1).R|kotlin/Byte.unaryPlus|())
|
||||
R|/takeByte|(Byte(1).R|<local>/inv|())
|
||||
}
|
||||
public final fun test_6(): R|kotlin/Unit| {
|
||||
<Inapplicable(INAPPLICABLE): [/takeByte]>#(R|kotlin/run|<R|kotlin/Int|>(<L> = run@fun <anonymous>(): R|kotlin/Int| <kind=EXACTLY_ONCE> {
|
||||
^ Int(127).R|kotlin/Int.plus|(Int(1))
|
||||
}
|
||||
))
|
||||
<Inapplicable(INAPPLICABLE): [/takeByte]>#(Int(1).R|<local>/plus|(R|kotlin/run|<R|kotlin/Int|>(<L> = run@fun <anonymous>(): R|kotlin/Int| <kind=EXACTLY_ONCE> {
|
||||
^ Int(1)
|
||||
}
|
||||
)))
|
||||
R|/takeByte|(R|kotlin/run|<R|kotlin/Byte|>(<L> = run@fun <anonymous>(): R|kotlin/Byte| <kind=EXACTLY_ONCE> {
|
||||
^ Int(1).R|kotlin/Int.plus|(Int(1))
|
||||
}
|
||||
))
|
||||
Int(1).R|kotlin/Int.plus|(Int(1))
|
||||
R|kotlin/run|<R|kotlin/Int|>(<L> = run@fun <anonymous>(): R|kotlin/Int| <kind=EXACTLY_ONCE> {
|
||||
^ Int(1)
|
||||
}
|
||||
)
|
||||
Int(1).R|kotlin/Int.plus|(R|kotlin/run|<R|kotlin/Int|>(<L> = run@fun <anonymous>(): R|kotlin/Int| <kind=EXACTLY_ONCE> {
|
||||
^ Int(1)
|
||||
}
|
||||
))
|
||||
}
|
||||
public final fun test_7(d: R|kotlin/Double|): R|kotlin/Unit| {
|
||||
lval x1: R|kotlin/Double| = Int(1).R|kotlin/Int.plus|(R|<local>/d|)
|
||||
lval x2: R|kotlin/Double| = R|<local>/d|.R|kotlin/Double.plus|(Int(1))
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
interface A
|
||||
|
||||
interface B : A
|
||||
|
||||
interface C
|
||||
|
||||
interface D : B, C
|
||||
|
||||
fun B.foo(): Int = 1
|
||||
fun <T> T.foo(): String where T : A, T : C = ""
|
||||
|
||||
fun takeInt(x: Int) {}
|
||||
|
||||
fun test(d: D) {
|
||||
val x = d.foo()
|
||||
takeInt(x)
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
FILE: overloadByReceiver.kt
|
||||
public abstract interface A : R|kotlin/Any| {
|
||||
}
|
||||
public abstract interface B : R|A| {
|
||||
}
|
||||
public abstract interface C : R|kotlin/Any| {
|
||||
}
|
||||
public abstract interface D : R|B|, R|C| {
|
||||
}
|
||||
public final fun R|B|.foo(): R|kotlin/Int| {
|
||||
^foo Int(1)
|
||||
}
|
||||
public final fun <T : R|A|, R|C|> R|T|.foo(): R|kotlin/String| {
|
||||
^foo String()
|
||||
}
|
||||
public final fun takeInt(x: R|kotlin/Int|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun test(d: R|D|): R|kotlin/Unit| {
|
||||
lval x: R|kotlin/Int| = R|<local>/d|.R|/foo|()
|
||||
R|/takeInt|(R|<local>/x|)
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
interface A {
|
||||
fun foo(b: Boolean = false): A
|
||||
fun foo(block: () -> Boolean): A
|
||||
}
|
||||
|
||||
fun test(a: A) {
|
||||
a.foo { true }
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
FILE: overloadWithDefault.kt
|
||||
public abstract interface A : R|kotlin/Any| {
|
||||
public abstract fun foo(b: R|kotlin/Boolean| = Boolean(false)): R|A|
|
||||
|
||||
public abstract fun foo(block: R|() -> kotlin/Boolean|): R|A|
|
||||
|
||||
}
|
||||
public final fun test(a: R|A|): R|kotlin/Unit| {
|
||||
R|<local>/a|.R|/A.foo|(<L> = foo@fun <anonymous>(): R|kotlin/Boolean| {
|
||||
^ Boolean(true)
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
fun foo(first: Int, second: Double, third: Boolean, fourth: String) {}
|
||||
|
||||
fun test() {
|
||||
foo(1, 2.0, true, "")
|
||||
foo(1, 2.0, true, fourth = "!")
|
||||
foo(1, 2.0, fourth = "???", third = false)
|
||||
foo(1, second = 3.14, third = false, fourth = "!?")
|
||||
foo(third = false, second = 2.71, fourth = "?!", first = 0)
|
||||
|
||||
<!INAPPLICABLE_CANDIDATE!>foo<!>()
|
||||
<!INAPPLICABLE_CANDIDATE!>foo<!>(0.0, false, 0, "")
|
||||
foo(1, 2.0, third = true, "")
|
||||
<!INAPPLICABLE_CANDIDATE!>foo<!>(second = 0.0, first = 0, fourth = "")
|
||||
<!INAPPLICABLE_CANDIDATE!>foo<!>(first = 0.0, second = 0, third = "", fourth = false)
|
||||
<!INAPPLICABLE_CANDIDATE!>foo<!>(first = 0, second = 0.0, third = false, fourth = "", first = 1)
|
||||
<!INAPPLICABLE_CANDIDATE!>foo<!>(0, 0.0, false, foth = "")
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
FILE: simple.kt
|
||||
public final fun foo(first: R|kotlin/Int|, second: R|kotlin/Double|, third: R|kotlin/Boolean|, fourth: R|kotlin/String|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
R|/foo|(Int(1), Double(2.0), Boolean(true), String())
|
||||
R|/foo|(Int(1), Double(2.0), Boolean(true), fourth = String(!))
|
||||
R|/foo|(Int(1), Double(2.0), fourth = String(???), third = Boolean(false))
|
||||
R|/foo|(Int(1), second = Double(3.14), third = Boolean(false), fourth = String(!?))
|
||||
R|/foo|(third = Boolean(false), second = Double(2.71), fourth = String(?!), first = Int(0))
|
||||
<Inapplicable(PARAMETER_MAPPING_ERROR): [/foo]>#()
|
||||
<Inapplicable(INAPPLICABLE): [/foo]>#(Double(0.0), Boolean(false), Int(0), String())
|
||||
R|/foo|(Int(1), Double(2.0), third = Boolean(true), String())
|
||||
<Inapplicable(PARAMETER_MAPPING_ERROR): [/foo]>#(second = Double(0.0), first = Int(0), fourth = String())
|
||||
<Inapplicable(INAPPLICABLE): [/foo]>#(first = Double(0.0), second = Int(0), third = String(), fourth = Boolean(false))
|
||||
<Inapplicable(INAPPLICABLE): [/foo]>#(first = Int(0), second = Double(0.0), third = Boolean(false), fourth = String(), first = Int(1))
|
||||
<Inapplicable(PARAMETER_MAPPING_ERROR): [/foo]>#(Int(0), Double(0.0), Boolean(false), foth = String())
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class A
|
||||
|
||||
fun foo(s: String) {}
|
||||
|
||||
fun test(a: A) {
|
||||
foo("$a")
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
FILE: stringTemplates.kt
|
||||
public final class A : R|kotlin/Any| {
|
||||
public constructor(): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final fun foo(s: R|kotlin/String|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun test(a: R|A|): R|kotlin/Unit| {
|
||||
R|/foo|(R|<local>/a|.R|kotlin/Any.toString|())
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
fun <T> myRun(block: () -> T): T = block()
|
||||
|
||||
fun foo() {}
|
||||
|
||||
fun test() {
|
||||
myRun {
|
||||
try {
|
||||
val x = 1
|
||||
} catch(e: Exception) {
|
||||
foo()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
FILE: tryInLambda.kt
|
||||
public final fun <T> myRun(block: R|() -> T|): R|T| {
|
||||
^myRun R|<local>/block|.R|FakeOverride<kotlin/Function0.invoke: R|T|>|()
|
||||
}
|
||||
public final fun foo(): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
R|/myRun|<R|kotlin/Unit|>(<L> = myRun@fun <anonymous>(): R|kotlin/Unit| {
|
||||
try {
|
||||
lval x: R|kotlin/Int| = Int(1)
|
||||
}
|
||||
catch (e: R|kotlin/Exception|) {
|
||||
R|/foo|()
|
||||
}
|
||||
|
||||
}
|
||||
)
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
interface Box<T>
|
||||
|
||||
public fun <T> foo(nextFunction: (T) -> T): Box<T> = null!!
|
||||
|
||||
fun leaves(value: String, forward: Boolean): Box<String> {
|
||||
if (forward) {
|
||||
return foo { "" }
|
||||
} else {
|
||||
return foo { "" }
|
||||
}
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
FILE: untouchedReturnInIf.kt
|
||||
public abstract interface Box<T> : R|kotlin/Any| {
|
||||
}
|
||||
public final fun <T> foo(nextFunction: R|(T) -> T|): R|Box<T>| {
|
||||
^foo Null(null)!!
|
||||
}
|
||||
public final fun leaves(value: R|kotlin/String|, forward: R|kotlin/Boolean|): R|Box<kotlin/String>| {
|
||||
when () {
|
||||
R|<local>/forward| -> {
|
||||
^leaves R|/foo|<R|kotlin/String|>(<L> = foo@fun <anonymous>(it: R|kotlin/String|): R|kotlin/String| {
|
||||
^ String()
|
||||
}
|
||||
)
|
||||
}
|
||||
else -> {
|
||||
^leaves R|/foo|<R|kotlin/String|>(<L> = foo@fun <anonymous>(it: R|kotlin/String|): R|kotlin/String| {
|
||||
^ String()
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
fun foo(x: Int, vararg y: String) {}
|
||||
fun bar(x: Int, vararg y: String, z: Boolean) {}
|
||||
|
||||
fun test() {
|
||||
foo(1)
|
||||
foo(1, "")
|
||||
foo(1, "my", "yours")
|
||||
foo(1, *arrayOf("my", "yours"))
|
||||
|
||||
<!INAPPLICABLE_CANDIDATE!>foo<!>("")
|
||||
<!INAPPLICABLE_CANDIDATE!>foo<!>(1, 2)
|
||||
|
||||
bar(1, z = true, y = *arrayOf("my", "yours"))
|
||||
|
||||
<!INAPPLICABLE_CANDIDATE!>bar<!>(0, z = false, y = "", y = "other")
|
||||
<!INAPPLICABLE_CANDIDATE!>bar<!>(0, "", true)
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
FILE: vararg.kt
|
||||
public final fun foo(x: R|kotlin/Int|, vararg y: R|kotlin/Array<out kotlin/String>|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun bar(x: R|kotlin/Int|, vararg y: R|kotlin/Array<out kotlin/String>|, z: R|kotlin/Boolean|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
R|/foo|(Int(1))
|
||||
R|/foo|(Int(1), vararg(String()))
|
||||
R|/foo|(Int(1), vararg(String(my), String(yours)))
|
||||
R|/foo|(Int(1), vararg(*R|kotlin/arrayOf|<R|kotlin/String|>(vararg(String(my), String(yours)))))
|
||||
<Inapplicable(INAPPLICABLE): [/foo]>#(String())
|
||||
<Inapplicable(INAPPLICABLE): [/foo]>#(Int(1), Int(2))
|
||||
R|/bar|(Int(1), z = Boolean(true), vararg(y = *R|kotlin/arrayOf|<R|kotlin/String|>(vararg(String(my), String(yours)))))
|
||||
<Inapplicable(INAPPLICABLE): [/bar]>#(Int(0), z = Boolean(false), y = String(), y = String(other))
|
||||
<Inapplicable(PARAMETER_MAPPING_ERROR): [/bar]>#(Int(0), String(), Boolean(true))
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
open class Base
|
||||
class Sub : Base()
|
||||
|
||||
fun foo(vararg arg: Base) {}
|
||||
|
||||
fun bar(base: Array<Base>, sub: Array<Sub>) {
|
||||
foo(*base)
|
||||
foo(*sub)
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
FILE: varargProjection.kt
|
||||
public open class Base : R|kotlin/Any| {
|
||||
public constructor(): R|Base| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final class Sub : R|Base| {
|
||||
public constructor(): R|Sub| {
|
||||
super<R|Base|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final fun foo(vararg arg: R|kotlin/Array<out Base>|): R|kotlin/Unit| {
|
||||
}
|
||||
public final fun bar(base: R|kotlin/Array<Base>|, sub: R|kotlin/Array<Sub>|): R|kotlin/Unit| {
|
||||
R|/foo|(vararg(*R|<local>/base|))
|
||||
R|/foo|(vararg(*R|<local>/sub|))
|
||||
}
|
||||
Reference in New Issue
Block a user