Remove backend tests on old inference

Also remove any mentions of NewInference, and rename some tests.
This commit is contained in:
Alexander Udalov
2021-09-28 23:36:48 +02:00
parent 3626b1df44
commit 1071919706
179 changed files with 609 additions and 1953 deletions
@@ -1,5 +1,4 @@
// FIR_IDENTICAL
// !LANGUAGE: +NewInference +FunctionalInterfaceConversion +SamConversionPerArgument +SamConversionForKotlinFunctions
fun interface IRunnable {
fun run()
@@ -1,5 +1,4 @@
// FIR_IDENTICAL
// !LANGUAGE: +NewInference +FunctionalInterfaceConversion +SamConversionPerArgument +SamConversionForKotlinFunctions
fun interface Foo {
fun invoke(): String
@@ -7,4 +6,4 @@ fun interface Foo {
fun foo(f: Foo) = f.invoke()
fun test() = foo { "OK" }
fun test() = foo { "OK" }
@@ -1,5 +1,4 @@
// FIR_IDENTICAL
// !LANGUAGE: +NewInference +FunctionalInterfaceConversion +SamConversionPerArgument +SamConversionForKotlinFunctions
fun interface KRunnable {
fun invoke()
@@ -9,4 +8,3 @@ fun test(a: Any?) {
a as () -> Unit
KRunnable(a).invoke()
}
@@ -1,4 +1,3 @@
// !LANGUAGE: +NewInference +FunctionalInterfaceConversion +SamConversionPerArgument +SamConversionForKotlinFunctions
// WITH_RUNTIME
fun interface Fn<T, R> {
@@ -1,5 +1,3 @@
// !LANGUAGE: +NewInference +FunctionReferenceWithDefaultValueAsOtherType +FunctionalInterfaceConversion +SamConversionPerArgument +SamConversionForKotlinFunctions
fun interface IFoo {
fun foo(i: Int)
}
@@ -18,4 +16,4 @@ fun withVarargOfInt(vararg xs: Int) = ""
fun testAdaptedCR() {
useVararg(::withVarargOfInt)
}
}
@@ -1,4 +1,3 @@
// !LANGUAGE: +NewInference +FunctionalInterfaceConversion +SamConversionPerArgument
fun interface MyRunnable {
fun run()
}
@@ -1,4 +1,3 @@
// !LANGUAGE: +NewInference +FunctionalInterfaceConversion +SamConversionPerArgument +SamConversionForKotlinFunctions
fun interface KRunnable {
fun run()
}
@@ -22,4 +21,4 @@ fun testSamConversion() {
// TODO should use an adapter function
fun testSamConversionOnAdapted() {
use(::foo1)
}
}
@@ -114,6 +114,56 @@ FILE fqName:<root> fileName:/samConversionsWithSmartCasts.kt
r: TYPE_OP type=<root>.KRunnable origin=SAM_CONVERSION typeOperand=<root>.KRunnable
TYPE_OP type=kotlin.Function0<kotlin.Unit> origin=IMPLICIT_CAST typeOperand=kotlin.Function0<kotlin.Unit>
GET_VAR 'a: kotlin.Any declared in <root>.test6' type=kotlin.Any origin=null
FUN name:test7 visibility:public modality:FINAL <> (a:kotlin.Function1<kotlin.Int, kotlin.Int>) returnType:kotlin.Unit
VALUE_PARAMETER name:a index:0 type:kotlin.Function1<kotlin.Int, kotlin.Int>
BLOCK_BODY
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
TYPE_OP type=kotlin.Function0<kotlin.Unit> origin=CAST typeOperand=kotlin.Function0<kotlin.Unit>
GET_VAR 'a: kotlin.Function1<kotlin.Int, kotlin.Int> declared in <root>.test7' type=kotlin.Function1<kotlin.Int, kotlin.Int> origin=null
CALL 'public final fun run1 (r: <root>.KRunnable): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
r: TYPE_OP type=<root>.KRunnable origin=SAM_CONVERSION typeOperand=<root>.KRunnable
TYPE_OP type=kotlin.Function0<kotlin.Unit> origin=IMPLICIT_CAST typeOperand=kotlin.Function0<kotlin.Unit>
GET_VAR 'a: kotlin.Function1<kotlin.Int, kotlin.Int> declared in <root>.test7' type=kotlin.Function1<kotlin.Int, kotlin.Int> origin=null
FUN name:test7a visibility:public modality:FINAL <T> (a:T of <root>.test7a) returnType:kotlin.Unit
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Function1<kotlin.Int, kotlin.Int>]
VALUE_PARAMETER name:a index:0 type:T of <root>.test7a
BLOCK_BODY
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
TYPE_OP type=kotlin.Function0<kotlin.Unit> origin=CAST typeOperand=kotlin.Function0<kotlin.Unit>
GET_VAR 'a: T of <root>.test7a declared in <root>.test7a' type=T of <root>.test7a origin=null
CALL 'public final fun run1 (r: <root>.KRunnable): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
r: TYPE_OP type=<root>.KRunnable origin=SAM_CONVERSION typeOperand=<root>.KRunnable
TYPE_OP type=kotlin.Function0<kotlin.Unit> origin=IMPLICIT_CAST typeOperand=kotlin.Function0<kotlin.Unit>
GET_VAR 'a: T of <root>.test7a declared in <root>.test7a' type=T of <root>.test7a origin=null
FUN name:test7b visibility:public modality:FINAL <T> (a:T of <root>.test7b) returnType:kotlin.Unit
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Function1<kotlin.Int, kotlin.Unit>; kotlin.Function0<kotlin.Unit>]
VALUE_PARAMETER name:a index:0 type:T of <root>.test7b
BLOCK_BODY
CALL 'public final fun run1 (r: <root>.KRunnable): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
r: TYPE_OP type=<root>.KRunnable origin=SAM_CONVERSION typeOperand=<root>.KRunnable
GET_VAR 'a: T of <root>.test7b declared in <root>.test7b' type=T of <root>.test7b origin=null
CLASS INTERFACE name:Unrelated modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Unrelated
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN name:test7c visibility:public modality:FINAL <T> (a:T of <root>.test7c) returnType:kotlin.Unit
TYPE_PARAMETER name:T index:0 variance: superTypes:[<root>.Unrelated; kotlin.Function0<kotlin.Unit>]
VALUE_PARAMETER name:a index:0 type:T of <root>.test7c
BLOCK_BODY
CALL 'public final fun run1 (r: <root>.KRunnable): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
r: TYPE_OP type=<root>.KRunnable origin=SAM_CONVERSION typeOperand=<root>.KRunnable
GET_VAR 'a: T of <root>.test7c declared in <root>.test7c' type=T of <root>.test7c origin=null
FUN name:test8 visibility:public modality:FINAL <> (a:kotlin.Function0<kotlin.Unit>) returnType:kotlin.Unit
VALUE_PARAMETER name:a index:0 type:kotlin.Function0<kotlin.Unit>
BLOCK_BODY
@@ -60,6 +60,28 @@ fun test6(a: Any) {
run1(r = a /*as Function0<Unit> */ /*-> KRunnable */)
}
fun test7(a: Function1<Int, Int>) {
a as Function0<Unit> /*~> Unit */
run1(r = a /*as Function0<Unit> */ /*-> KRunnable */)
}
fun <T : Function1<Int, Int>> test7a(a: T) {
a as Function0<Unit> /*~> Unit */
run1(r = a /*as Function0<Unit> */ /*-> KRunnable */)
}
fun <T> test7b(a: T) where T : Function1<Int, Unit>, T : Function0<Unit> {
run1(r = a /*-> KRunnable */)
}
interface Unrelated {
}
fun <T> test7c(a: T) where T : Unrelated, T : Function0<Unit> {
run1(r = a /*-> KRunnable */)
}
fun test8(a: Function0<Unit>) {
run1(r = id<Function0<Unit>>(x = a) /*-> KRunnable */)
}
@@ -116,6 +116,56 @@ FILE fqName:<root> fileName:/samConversionsWithSmartCasts.kt
r: TYPE_OP type=<root>.KRunnable origin=SAM_CONVERSION typeOperand=<root>.KRunnable
TYPE_OP type=kotlin.Function0<kotlin.Unit> origin=IMPLICIT_CAST typeOperand=kotlin.Function0<kotlin.Unit>
GET_VAR 'a: kotlin.Any declared in <root>.test6' type=kotlin.Any origin=null
FUN name:test7 visibility:public modality:FINAL <> (a:kotlin.Function1<kotlin.Int, kotlin.Int>) returnType:kotlin.Unit
VALUE_PARAMETER name:a index:0 type:kotlin.Function1<kotlin.Int, kotlin.Int>
BLOCK_BODY
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
TYPE_OP type=kotlin.Function0<kotlin.Unit> origin=CAST typeOperand=kotlin.Function0<kotlin.Unit>
GET_VAR 'a: kotlin.Function1<kotlin.Int, kotlin.Int> declared in <root>.test7' type=kotlin.Function1<kotlin.Int, kotlin.Int> origin=null
CALL 'public final fun run1 (r: <root>.KRunnable): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
r: TYPE_OP type=<root>.KRunnable origin=SAM_CONVERSION typeOperand=<root>.KRunnable
TYPE_OP type=kotlin.Function0<kotlin.Unit> origin=IMPLICIT_CAST typeOperand=kotlin.Function0<kotlin.Unit>
GET_VAR 'a: kotlin.Function1<kotlin.Int, kotlin.Int> declared in <root>.test7' type=kotlin.Function1<kotlin.Int, kotlin.Int> origin=null
FUN name:test7a visibility:public modality:FINAL <T> (a:T of <root>.test7a) returnType:kotlin.Unit
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Function1<kotlin.Int, kotlin.Int>]
VALUE_PARAMETER name:a index:0 type:T of <root>.test7a
BLOCK_BODY
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
TYPE_OP type=kotlin.Function0<kotlin.Unit> origin=CAST typeOperand=kotlin.Function0<kotlin.Unit>
GET_VAR 'a: T of <root>.test7a declared in <root>.test7a' type=T of <root>.test7a origin=null
CALL 'public final fun run1 (r: <root>.KRunnable): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
r: TYPE_OP type=<root>.KRunnable origin=SAM_CONVERSION typeOperand=<root>.KRunnable
TYPE_OP type=kotlin.Function0<kotlin.Unit> origin=IMPLICIT_CAST typeOperand=kotlin.Function0<kotlin.Unit>
GET_VAR 'a: T of <root>.test7a declared in <root>.test7a' type=T of <root>.test7a origin=null
FUN name:test7b visibility:public modality:FINAL <T> (a:T of <root>.test7b) returnType:kotlin.Unit
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Function1<kotlin.Int, kotlin.Unit>; kotlin.Function0<kotlin.Unit>]
VALUE_PARAMETER name:a index:0 type:T of <root>.test7b
BLOCK_BODY
CALL 'public final fun run1 (r: <root>.KRunnable): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
r: TYPE_OP type=<root>.KRunnable origin=SAM_CONVERSION typeOperand=<root>.KRunnable
GET_VAR 'a: T of <root>.test7b declared in <root>.test7b' type=T of <root>.test7b origin=null
CLASS INTERFACE name:Unrelated modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Unrelated
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
VALUE_PARAMETER name:other index:0 type:kotlin.Any?
FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override]
overridden:
public open fun hashCode (): kotlin.Int declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override]
overridden:
public open fun toString (): kotlin.String declared in kotlin.Any
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
FUN name:test7c visibility:public modality:FINAL <T> (a:T of <root>.test7c) returnType:kotlin.Unit
TYPE_PARAMETER name:T index:0 variance: superTypes:[<root>.Unrelated; kotlin.Function0<kotlin.Unit>]
VALUE_PARAMETER name:a index:0 type:T of <root>.test7c
BLOCK_BODY
CALL 'public final fun run1 (r: <root>.KRunnable): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
r: TYPE_OP type=<root>.KRunnable origin=SAM_CONVERSION typeOperand=<root>.KRunnable
GET_VAR 'a: T of <root>.test7c declared in <root>.test7c' type=T of <root>.test7c origin=null
FUN name:test8 visibility:public modality:FINAL <> (a:kotlin.Function0<kotlin.Unit>) returnType:kotlin.Unit
VALUE_PARAMETER name:a index:0 type:kotlin.Function0<kotlin.Unit>
BLOCK_BODY
@@ -1,4 +1,3 @@
// !LANGUAGE: +NewInference +FunctionalInterfaceConversion +SamConversionPerArgument +SamConversionForKotlinFunctions
fun interface KRunnable {
fun run()
}
@@ -53,26 +52,25 @@ fun test6(a: Any) {
run1(a)
}
// TODO see KT-36013
//fun test7(a: (Int) -> Int) {
// a as () -> Unit
// run1(a)
//}
//
//fun <T : (Int) -> Int> test7a(a: T) {
// a as () -> Unit
// run1(a)
//}
//
//fun <T> test7b(a: T) where T : (Int) -> Int, T : () -> Unit {
// run1(a)
//}
//
//interface Unrelated
//
//fun <T> test7c(a: T) where T : Unrelated, T : () -> Unit {
// run1(a)
//}
fun test7(a: (Int) -> Int) {
a as () -> Unit
run1(a)
}
fun <T : (Int) -> Int> test7a(a: T) {
a as () -> Unit
run1(a)
}
fun <T> test7b(a: T) where T : (Int) -> Unit, T : () -> Unit {
run1(a)
}
interface Unrelated
fun <T> test7c(a: T) where T : Unrelated, T : () -> Unit {
run1(a)
}
fun test8(a: () -> Unit) {
run1(id(a))
@@ -68,6 +68,28 @@ fun test6(a: Any) {
run1(r = a /*as Function0<Unit> */ /*-> KRunnable */)
}
fun test7(a: Function1<Int, Int>) {
a as Function0<Unit> /*~> Unit */
run1(r = a /*as Function0<Unit> */ /*-> KRunnable */)
}
fun <T : Function1<Int, Int>> test7a(a: T) {
a as Function0<Unit> /*~> Unit */
run1(r = a /*as Function0<Unit> */ /*-> KRunnable */)
}
fun <T> test7b(a: T) where T : Function1<Int, Unit>, T : Function0<Unit> {
run1(r = a /*-> KRunnable */)
}
interface Unrelated {
}
fun <T> test7c(a: T) where T : Unrelated, T : Function0<Unit> {
run1(r = a /*-> KRunnable */)
}
fun test8(a: Function0<Unit>) {
run1(r = id<Function0<Unit>>(x = a) /*-> KRunnable */)
}