Remove backend tests on old inference
Also remove any mentions of NewInference, and rename some tests.
This commit is contained in:
+1
-3
@@ -1,5 +1,3 @@
|
||||
// !LANGUAGE: +NewInference +FunctionReferenceWithDefaultValueAsOtherType
|
||||
|
||||
fun use(f: C.(Int) -> Unit) {}
|
||||
|
||||
class C
|
||||
@@ -20,4 +18,4 @@ fun testExtensionDefault() {
|
||||
|
||||
fun testExtensionBoth() {
|
||||
use(C::extensionBoth)
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -1,5 +1,4 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// !LANGUAGE: +NewInference +FunctionReferenceWithDefaultValueAsOtherType +FunctionalInterfaceConversion +SamConversionPerArgument +SamConversionForKotlinFunctions
|
||||
|
||||
fun interface IFoo {
|
||||
fun foo(i: Int)
|
||||
@@ -45,4 +44,4 @@ fun test6(a: Any) {
|
||||
a as (Int) -> Unit
|
||||
a as IFoo
|
||||
A[a] += 1
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-3
@@ -1,5 +1,3 @@
|
||||
// !LANGUAGE: +NewInference, +FunctionReferenceWithDefaultValueAsOtherType
|
||||
|
||||
fun use(fn: (Int) -> Any) = fn(42)
|
||||
|
||||
class C(vararg xs: Int)
|
||||
@@ -12,4 +10,4 @@ fun testConstructor() = use(::C)
|
||||
|
||||
fun testInnerClassConstructor(outer: Outer) = use(outer::Inner)
|
||||
|
||||
fun testInnerClassConstructorCapturingOuter() = use(Outer()::Inner)
|
||||
fun testInnerClassConstructorCapturingOuter() = use(Outer()::Inner)
|
||||
|
||||
-2
@@ -1,5 +1,3 @@
|
||||
// !LANGUAGE: +NewInference, +FunctionReferenceWithDefaultValueAsOtherType
|
||||
|
||||
fun use1(fn: (A, Int) -> Unit) {}
|
||||
|
||||
fun use2(fn: (Int) -> Unit) {}
|
||||
|
||||
-3
@@ -1,5 +1,3 @@
|
||||
// !LANGUAGE: +NewInference +FunctionReferenceWithDefaultValueAsOtherType +FunctionalInterfaceConversion +SamConversionPerArgument +SamConversionForKotlinFunctions
|
||||
|
||||
fun interface IFoo {
|
||||
fun foo(i: Int)
|
||||
}
|
||||
@@ -11,4 +9,3 @@ fun withVararg(vararg xs: Int) = 42
|
||||
fun test() {
|
||||
useFoo(::withVararg)
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: +NewInference, +FunctionReferenceWithDefaultValueAsOtherType
|
||||
import Host.importedObjectMemberWithVarargs
|
||||
|
||||
fun use(fn: (Int) -> String) = fn(1)
|
||||
@@ -27,4 +26,4 @@ fun testImportedObjectMember() = use(::importedObjectMemberWithVarargs)
|
||||
|
||||
fun testDefault0() = use0(::fnWithDefaults)
|
||||
|
||||
fun testVararg0() = use0(::fnWithVarargs)
|
||||
fun testVararg0() = use0(::fnWithVarargs)
|
||||
|
||||
Vendored
+1
-3
@@ -1,5 +1,3 @@
|
||||
// !LANGUAGE: +NewInference, +FunctionReferenceWithDefaultValueAsOtherType
|
||||
|
||||
fun use(fn: (Int) -> Unit) { fn(1) }
|
||||
|
||||
class Host {
|
||||
@@ -26,4 +24,4 @@ class Host {
|
||||
fun testBoundReceiverExpression() {
|
||||
use(Host()::withVararg)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-2
@@ -1,5 +1,3 @@
|
||||
// !LANGUAGE: +NewInference, +FunctionReferenceWithDefaultValueAsOtherType
|
||||
|
||||
fun sum(vararg args: Int): Int {
|
||||
var result = 0
|
||||
for (arg in args)
|
||||
|
||||
-1
@@ -1,5 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +NewInference +FunctionalInterfaceConversion +SamConversionPerArgument +SamConversionForKotlinFunctions
|
||||
|
||||
fun interface IRunnable {
|
||||
fun run()
|
||||
|
||||
+1
-2
@@ -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
-3
@@ -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
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: +NewInference +FunctionalInterfaceConversion +SamConversionPerArgument
|
||||
fun interface MyRunnable {
|
||||
fun run()
|
||||
}
|
||||
|
||||
+1
-2
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+50
@@ -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
|
||||
|
||||
Vendored
+22
@@ -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 */)
|
||||
}
|
||||
|
||||
+50
@@ -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
|
||||
|
||||
+19
-21
@@ -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))
|
||||
|
||||
+22
@@ -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 */)
|
||||
}
|
||||
|
||||
-2
@@ -1,6 +1,4 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// !LANGUAGE: +NewInference
|
||||
// (old inference fails in the frontend)
|
||||
// FILE: JFieldOwner.java
|
||||
|
||||
public class JFieldOwner {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
// !LANGUAGE: +NewInference +SamConversionPerArgument +SamConversionForKotlinFunctions -ProhibitVarargAsArrayAfterSamArgument
|
||||
// !LANGUAGE: -ProhibitVarargAsArrayAfterSamArgument
|
||||
// WITH_JDK
|
||||
|
||||
// FILE: arrayAsVarargAfterSamArgument.kt
|
||||
|
||||
+36
-13
@@ -1,18 +1,11 @@
|
||||
FILE fqName:<root> fileName:/genericSamProjectedOut.kt
|
||||
FUN name:test visibility:public modality:FINAL <> (a:example.SomeJavaClass<out kotlin.String>) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:a index:0 type:example.SomeJavaClass<out kotlin.String>
|
||||
FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
VAR name:a type:example.SomeJavaClass<out kotlin.String> [var]
|
||||
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in example.SomeJavaClass' type=example.SomeJavaClass<kotlin.String> origin=null
|
||||
<class: A>: kotlin.String
|
||||
CALL 'public open fun someFunction (hello: @[FlexibleNullability] example.Hello<@[FlexibleNullability] A of example.SomeJavaClass?>?): kotlin.Unit declared in example.SomeJavaClass' type=kotlin.Unit origin=null
|
||||
$this: GET_VAR 'a: example.SomeJavaClass<out kotlin.String> declared in <root>.test' type=example.SomeJavaClass<out kotlin.String> origin=null
|
||||
hello: TYPE_OP type=@[FlexibleNullability] example.Hello<@[FlexibleNullability] kotlin.String?>? origin=SAM_CONVERSION typeOperand=@[FlexibleNullability] example.Hello<@[FlexibleNullability] kotlin.String?>?
|
||||
FUN_EXPR type=kotlin.Function1<@[FlexibleNullability] kotlin.String?, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:@[FlexibleNullability] kotlin.String?) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:it index:0 type:@[FlexibleNullability] kotlin.String?
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: @[FlexibleNullability] kotlin.String?): kotlin.Unit declared in <root>.test'
|
||||
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
|
||||
CALL 'public open fun plus (hello: @[FlexibleNullability] example.Hello<@[FlexibleNullability] A of example.SomeJavaClass?>?): kotlin.Unit [operator] declared in example.SomeJavaClass' type=kotlin.Unit origin=PLUS
|
||||
$this: GET_VAR 'a: example.SomeJavaClass<out kotlin.String> declared in <root>.test' type=example.SomeJavaClass<out kotlin.String> origin=null
|
||||
$this: GET_VAR 'var a: example.SomeJavaClass<out kotlin.String> [var] declared in <root>.test' type=example.SomeJavaClass<out kotlin.String> origin=null
|
||||
hello: TYPE_OP type=@[FlexibleNullability] example.Hello<@[FlexibleNullability] kotlin.String?>? origin=SAM_CONVERSION typeOperand=@[FlexibleNullability] example.Hello<@[FlexibleNullability] kotlin.String?>?
|
||||
FUN_EXPR type=kotlin.Function1<@[FlexibleNullability] kotlin.String?, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:@[FlexibleNullability] kotlin.String?) returnType:kotlin.Unit
|
||||
@@ -20,8 +13,38 @@ FILE fqName:<root> fileName:/genericSamProjectedOut.kt
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: @[FlexibleNullability] kotlin.String?): kotlin.Unit declared in <root>.test'
|
||||
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
|
||||
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||
CALL 'public open fun plus (hello: @[FlexibleNullability] example.Hello<@[FlexibleNullability] A of example.SomeJavaClass?>?): @[FlexibleNullability] example.SomeJavaClass<@[FlexibleNullability] A of example.SomeJavaClass?>? [operator] declared in example.SomeJavaClass' type=@[FlexibleNullability] example.SomeJavaClass<out @[FlexibleNullability] kotlin.String?>? origin=PLUS
|
||||
$this: GET_VAR 'var a: example.SomeJavaClass<out kotlin.String> [var] declared in <root>.test' type=example.SomeJavaClass<out kotlin.String> origin=null
|
||||
hello: TYPE_OP type=@[FlexibleNullability] example.Hello<@[FlexibleNullability] kotlin.String?>? origin=SAM_CONVERSION typeOperand=@[FlexibleNullability] example.Hello<@[FlexibleNullability] kotlin.String?>?
|
||||
FUN_EXPR type=kotlin.Function1<@[FlexibleNullability] kotlin.String?, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:@[FlexibleNullability] kotlin.String?) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:it index:0 type:@[FlexibleNullability] kotlin.String?
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: @[FlexibleNullability] kotlin.String?): kotlin.Unit declared in <root>.test'
|
||||
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
|
||||
CALL 'public open fun get (hello: @[FlexibleNullability] example.Hello<@[FlexibleNullability] A of example.SomeJavaClass?>?): kotlin.Unit [operator] declared in example.SomeJavaClass' type=kotlin.Unit origin=null
|
||||
$this: GET_VAR 'a: example.SomeJavaClass<out kotlin.String> declared in <root>.test' type=example.SomeJavaClass<out kotlin.String> origin=null
|
||||
$this: GET_VAR 'var a: example.SomeJavaClass<out kotlin.String> [var] declared in <root>.test' type=example.SomeJavaClass<out kotlin.String> origin=null
|
||||
hello: TYPE_OP type=@[FlexibleNullability] example.Hello<@[FlexibleNullability] kotlin.String?>? origin=SAM_CONVERSION typeOperand=@[FlexibleNullability] example.Hello<@[FlexibleNullability] kotlin.String?>?
|
||||
FUN_EXPR type=kotlin.Function1<@[FlexibleNullability] kotlin.String?, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:@[FlexibleNullability] kotlin.String?) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:it index:0 type:@[FlexibleNullability] kotlin.String?
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: @[FlexibleNullability] kotlin.String?): kotlin.Unit declared in <root>.test'
|
||||
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
|
||||
SET_VAR 'var a: example.SomeJavaClass<out kotlin.String> [var] declared in <root>.test' type=kotlin.Unit origin=EQ
|
||||
CALL 'public open fun plus (hello: @[FlexibleNullability] example.Hello<@[FlexibleNullability] A of example.SomeJavaClass?>?): @[FlexibleNullability] example.SomeJavaClass<@[FlexibleNullability] A of example.SomeJavaClass?>? [operator] declared in example.SomeJavaClass' type=@[FlexibleNullability] example.SomeJavaClass<out @[FlexibleNullability] kotlin.String?>? origin=null
|
||||
$this: GET_VAR 'var a: example.SomeJavaClass<out kotlin.String> [var] declared in <root>.test' type=example.SomeJavaClass<out kotlin.String> origin=null
|
||||
hello: TYPE_OP type=@[FlexibleNullability] example.Hello<@[FlexibleNullability] kotlin.String?>? origin=SAM_CONVERSION typeOperand=@[FlexibleNullability] example.Hello<@[FlexibleNullability] kotlin.String?>?
|
||||
FUN_EXPR type=kotlin.Function1<@[FlexibleNullability] kotlin.String?, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:@[FlexibleNullability] kotlin.String?) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:it index:0 type:@[FlexibleNullability] kotlin.String?
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: @[FlexibleNullability] kotlin.String?): kotlin.Unit declared in <root>.test'
|
||||
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
|
||||
CALL 'public open fun set (i: kotlin.Int, hello: @[FlexibleNullability] example.Hello<@[FlexibleNullability] A of example.SomeJavaClass?>?): kotlin.Unit [operator] declared in example.SomeJavaClass' type=kotlin.Unit origin=null
|
||||
$this: GET_VAR 'var a: example.SomeJavaClass<out kotlin.String> [var] declared in <root>.test' type=example.SomeJavaClass<out kotlin.String> origin=null
|
||||
i: CONST Int type=kotlin.Int value=0
|
||||
hello: TYPE_OP type=@[FlexibleNullability] example.Hello<@[FlexibleNullability] kotlin.String?>? origin=SAM_CONVERSION typeOperand=@[FlexibleNullability] example.Hello<@[FlexibleNullability] kotlin.String?>?
|
||||
FUN_EXPR type=kotlin.Function1<@[FlexibleNullability] kotlin.String?, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:@[FlexibleNullability] kotlin.String?) returnType:kotlin.Unit
|
||||
|
||||
+11
-2
@@ -1,4 +1,5 @@
|
||||
fun test(a: SomeJavaClass<out String>) {
|
||||
fun test() {
|
||||
var a: SomeJavaClass<out String> = SomeJavaClass<String>()
|
||||
a.someFunction(hello = local fun <anonymous>(it: @FlexibleNullability String?) {
|
||||
return Unit
|
||||
}
|
||||
@@ -6,9 +7,17 @@ fun test(a: SomeJavaClass<out String>) {
|
||||
a.plus(hello = local fun <anonymous>(it: @FlexibleNullability String?) {
|
||||
return Unit
|
||||
}
|
||||
/*-> @FlexibleNullability Hello<@FlexibleNullability String?>? */)
|
||||
/*-> @FlexibleNullability Hello<@FlexibleNullability String?>? */) /*~> Unit */
|
||||
a.get(hello = local fun <anonymous>(it: @FlexibleNullability String?) {
|
||||
return Unit
|
||||
}
|
||||
/*-> @FlexibleNullability Hello<@FlexibleNullability String?>? */)
|
||||
a = a.plus(hello = local fun <anonymous>(it: @FlexibleNullability String?) {
|
||||
return Unit
|
||||
}
|
||||
/*-> @FlexibleNullability Hello<@FlexibleNullability String?>? */)
|
||||
a.set(i = 0, hello = local fun <anonymous>(it: @FlexibleNullability String?) {
|
||||
return Unit
|
||||
}
|
||||
/*-> @FlexibleNullability Hello<@FlexibleNullability String?>? */)
|
||||
}
|
||||
|
||||
+37
-13
@@ -1,18 +1,11 @@
|
||||
FILE fqName:<root> fileName:/genericSamProjectedOut.kt
|
||||
FUN name:test visibility:public modality:FINAL <> (a:example.SomeJavaClass<out kotlin.String>) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:a index:0 type:example.SomeJavaClass<out kotlin.String>
|
||||
FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
VAR name:a type:example.SomeJavaClass<out kotlin.String> [var]
|
||||
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in example.SomeJavaClass' type=example.SomeJavaClass<kotlin.String> origin=null
|
||||
<class: A>: kotlin.String
|
||||
CALL 'public open fun someFunction (hello: @[FlexibleNullability] example.Hello<@[FlexibleNullability] A of example.SomeJavaClass?>?): kotlin.Unit declared in example.SomeJavaClass' type=kotlin.Unit origin=null
|
||||
$this: GET_VAR 'a: example.SomeJavaClass<out kotlin.String> declared in <root>.test' type=example.SomeJavaClass<out kotlin.String> origin=null
|
||||
hello: TYPE_OP type=@[FlexibleNullability] example.Hello<kotlin.Nothing>? origin=SAM_CONVERSION typeOperand=@[FlexibleNullability] example.Hello<kotlin.Nothing>?
|
||||
FUN_EXPR type=kotlin.Function1<@[FlexibleNullability] kotlin.String?, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:@[FlexibleNullability] kotlin.String?) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:it index:0 type:@[FlexibleNullability] kotlin.String?
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: @[FlexibleNullability] kotlin.String?): kotlin.Unit declared in <root>.test'
|
||||
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
|
||||
CALL 'public open fun plus (hello: @[FlexibleNullability] example.Hello<@[FlexibleNullability] A of example.SomeJavaClass?>?): kotlin.Unit [operator] declared in example.SomeJavaClass' type=kotlin.Unit origin=PLUS
|
||||
$this: GET_VAR 'a: example.SomeJavaClass<out kotlin.String> declared in <root>.test' type=example.SomeJavaClass<out kotlin.String> origin=null
|
||||
$this: GET_VAR 'var a: example.SomeJavaClass<out kotlin.String> [var] declared in <root>.test' type=example.SomeJavaClass<out kotlin.String> origin=null
|
||||
hello: TYPE_OP type=@[FlexibleNullability] example.Hello<kotlin.Nothing>? origin=SAM_CONVERSION typeOperand=@[FlexibleNullability] example.Hello<kotlin.Nothing>?
|
||||
FUN_EXPR type=kotlin.Function1<@[FlexibleNullability] kotlin.String?, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:@[FlexibleNullability] kotlin.String?) returnType:kotlin.Unit
|
||||
@@ -20,8 +13,39 @@ FILE fqName:<root> fileName:/genericSamProjectedOut.kt
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: @[FlexibleNullability] kotlin.String?): kotlin.Unit declared in <root>.test'
|
||||
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
|
||||
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||
CALL 'public open fun plus (hello: @[FlexibleNullability] example.Hello<@[FlexibleNullability] A of example.SomeJavaClass?>?): @[FlexibleNullability] example.SomeJavaClass<@[FlexibleNullability] A of example.SomeJavaClass?>? [operator] declared in example.SomeJavaClass' type=@[FlexibleNullability] example.SomeJavaClass<out @[FlexibleNullability] kotlin.String?>? origin=PLUS
|
||||
$this: GET_VAR 'var a: example.SomeJavaClass<out kotlin.String> [var] declared in <root>.test' type=example.SomeJavaClass<out kotlin.String> origin=null
|
||||
hello: TYPE_OP type=@[FlexibleNullability] example.Hello<kotlin.Nothing>? origin=SAM_CONVERSION typeOperand=@[FlexibleNullability] example.Hello<kotlin.Nothing>?
|
||||
FUN_EXPR type=kotlin.Function1<@[FlexibleNullability] kotlin.String?, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:@[FlexibleNullability] kotlin.String?) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:it index:0 type:@[FlexibleNullability] kotlin.String?
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: @[FlexibleNullability] kotlin.String?): kotlin.Unit declared in <root>.test'
|
||||
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
|
||||
CALL 'public open fun get (hello: @[FlexibleNullability] example.Hello<@[FlexibleNullability] A of example.SomeJavaClass?>?): kotlin.Unit [operator] declared in example.SomeJavaClass' type=kotlin.Unit origin=GET_ARRAY_ELEMENT
|
||||
$this: GET_VAR 'a: example.SomeJavaClass<out kotlin.String> declared in <root>.test' type=example.SomeJavaClass<out kotlin.String> origin=null
|
||||
$this: GET_VAR 'var a: example.SomeJavaClass<out kotlin.String> [var] declared in <root>.test' type=example.SomeJavaClass<out kotlin.String> origin=null
|
||||
hello: TYPE_OP type=@[FlexibleNullability] example.Hello<kotlin.Nothing>? origin=SAM_CONVERSION typeOperand=@[FlexibleNullability] example.Hello<kotlin.Nothing>?
|
||||
FUN_EXPR type=kotlin.Function1<@[FlexibleNullability] kotlin.String?, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:@[FlexibleNullability] kotlin.String?) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:it index:0 type:@[FlexibleNullability] kotlin.String?
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: @[FlexibleNullability] kotlin.String?): kotlin.Unit declared in <root>.test'
|
||||
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
|
||||
SET_VAR 'var a: example.SomeJavaClass<out kotlin.String> [var] declared in <root>.test' type=kotlin.Unit origin=PLUSEQ
|
||||
TYPE_OP type=example.SomeJavaClass<out @[FlexibleNullability] kotlin.String?> origin=IMPLICIT_NOTNULL typeOperand=example.SomeJavaClass<out @[FlexibleNullability] kotlin.String?>
|
||||
CALL 'public open fun plus (hello: @[FlexibleNullability] example.Hello<@[FlexibleNullability] A of example.SomeJavaClass?>?): @[FlexibleNullability] example.SomeJavaClass<@[FlexibleNullability] A of example.SomeJavaClass?>? [operator] declared in example.SomeJavaClass' type=@[FlexibleNullability] example.SomeJavaClass<out @[FlexibleNullability] kotlin.String?>? origin=PLUSEQ
|
||||
$this: GET_VAR 'var a: example.SomeJavaClass<out kotlin.String> [var] declared in <root>.test' type=example.SomeJavaClass<out kotlin.String> origin=PLUSEQ
|
||||
hello: TYPE_OP type=@[FlexibleNullability] example.Hello<kotlin.Nothing>? origin=SAM_CONVERSION typeOperand=@[FlexibleNullability] example.Hello<kotlin.Nothing>?
|
||||
FUN_EXPR type=kotlin.Function1<@[FlexibleNullability] kotlin.String?, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:@[FlexibleNullability] kotlin.String?) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:it index:0 type:@[FlexibleNullability] kotlin.String?
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: @[FlexibleNullability] kotlin.String?): kotlin.Unit declared in <root>.test'
|
||||
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
|
||||
CALL 'public open fun set (i: kotlin.Int, hello: @[FlexibleNullability] example.Hello<@[FlexibleNullability] A of example.SomeJavaClass?>?): kotlin.Unit [operator] declared in example.SomeJavaClass' type=kotlin.Unit origin=EQ
|
||||
$this: GET_VAR 'var a: example.SomeJavaClass<out kotlin.String> [var] declared in <root>.test' type=example.SomeJavaClass<out kotlin.String> origin=null
|
||||
i: CONST Int type=kotlin.Int value=0
|
||||
hello: TYPE_OP type=@[FlexibleNullability] example.Hello<kotlin.Nothing>? origin=SAM_CONVERSION typeOperand=@[FlexibleNullability] example.Hello<kotlin.Nothing>?
|
||||
FUN_EXPR type=kotlin.Function1<@[FlexibleNullability] kotlin.String?, kotlin.Unit> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:@[FlexibleNullability] kotlin.String?) returnType:kotlin.Unit
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// !LANGUAGE: -NewInference
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
// FILE: genericSamProjectedOut.kt
|
||||
import example.SomeJavaClass
|
||||
|
||||
fun test(a: SomeJavaClass<out String>) {
|
||||
fun test() {
|
||||
var a: SomeJavaClass<out String> = SomeJavaClass()
|
||||
// a::someFunction parameter has type of Nothing
|
||||
// while it's completely safe to pass a lambda for a SAM
|
||||
// since Hello is effectively contravariant by its parameter
|
||||
@@ -12,6 +12,8 @@ fun test(a: SomeJavaClass<out String>) {
|
||||
a.someFunction {}
|
||||
a + {}
|
||||
a[{}]
|
||||
a += {}
|
||||
a[0] = {}
|
||||
}
|
||||
|
||||
// FILE: example/Hello.java
|
||||
@@ -30,11 +32,16 @@ public class SomeJavaClass<A> {
|
||||
((Hello)hello).invoke("OK");
|
||||
}
|
||||
|
||||
public void plus(Hello<A> hello) {
|
||||
public SomeJavaClass<A> plus(Hello<A> hello) {
|
||||
((Hello)hello).invoke("OK");
|
||||
return this;
|
||||
}
|
||||
|
||||
public void get(Hello<A> hello) {
|
||||
((Hello)hello).invoke("OK");
|
||||
}
|
||||
|
||||
public void set(int i, Hello<A> hello) {
|
||||
((Hello)hello).invoke("OK");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
fun test(a: SomeJavaClass<out String>) {
|
||||
fun test() {
|
||||
var a: SomeJavaClass<out String> = SomeJavaClass<String>()
|
||||
a.someFunction(hello = local fun <anonymous>(it: @FlexibleNullability String?) {
|
||||
return Unit
|
||||
}
|
||||
@@ -6,9 +7,17 @@ fun test(a: SomeJavaClass<out String>) {
|
||||
a.plus(hello = local fun <anonymous>(it: @FlexibleNullability String?) {
|
||||
return Unit
|
||||
}
|
||||
/*-> @FlexibleNullability Hello<Nothing>? */)
|
||||
/*-> @FlexibleNullability Hello<Nothing>? */) /*~> Unit */
|
||||
a.get(hello = local fun <anonymous>(it: @FlexibleNullability String?) {
|
||||
return Unit
|
||||
}
|
||||
/*-> @FlexibleNullability Hello<Nothing>? */)
|
||||
a = a.plus(hello = local fun <anonymous>(it: @FlexibleNullability String?) {
|
||||
return Unit
|
||||
}
|
||||
/*-> @FlexibleNullability Hello<Nothing>? */) /*!! SomeJavaClass<out @FlexibleNullability String?> */
|
||||
a.set(i = 0, hello = local fun <anonymous>(it: @FlexibleNullability String?) {
|
||||
return Unit
|
||||
}
|
||||
/*-> @FlexibleNullability Hello<Nothing>? */)
|
||||
}
|
||||
|
||||
+108
-15
@@ -1,21 +1,114 @@
|
||||
FILE fqName:<root> fileName:/samConversionInGenericConstructorCall.kt
|
||||
FUN name:test1 visibility:public modality:FINAL <> (f:kotlin.Function1<kotlin.String, kotlin.String>) returnType:<root>.C<@[FlexibleNullability] kotlin.String?>
|
||||
VALUE_PARAMETER name:f index:0 type:kotlin.Function1<kotlin.String, kotlin.String>
|
||||
FUN name:test3 visibility:public modality:FINAL <> (f1:kotlin.Function1<kotlin.String, kotlin.String>, f2:kotlin.Function1<kotlin.Int, kotlin.String>) returnType:<root>.C.D<@[FlexibleNullability] kotlin.Int?, @[FlexibleNullability] kotlin.String?>
|
||||
VALUE_PARAMETER name:f1 index:0 type:kotlin.Function1<kotlin.String, kotlin.String>
|
||||
VALUE_PARAMETER name:f2 index:1 type:kotlin.Function1<kotlin.Int, kotlin.String>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test1 (f: kotlin.Function1<kotlin.String, kotlin.String>): <root>.C<@[FlexibleNullability] kotlin.String?> declared in <root>'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> (jxx: @[FlexibleNullability] <root>.J<@[FlexibleNullability] X of <root>.C?, @[FlexibleNullability] X of <root>.C?>?) declared in <root>.C' type=<root>.C<@[FlexibleNullability] kotlin.String?> origin=null
|
||||
<class: X>: @[FlexibleNullability] kotlin.String?
|
||||
jxx: TYPE_OP type=@[FlexibleNullability] <root>.J<@[FlexibleNullability] kotlin.String?, @[FlexibleNullability] kotlin.String?>? origin=SAM_CONVERSION typeOperand=@[FlexibleNullability] <root>.J<@[FlexibleNullability] kotlin.String?, @[FlexibleNullability] kotlin.String?>?
|
||||
GET_VAR 'f: kotlin.Function1<kotlin.String, kotlin.String> declared in <root>.test1' type=kotlin.Function1<kotlin.String, kotlin.String> origin=null
|
||||
FUN name:test2 visibility:public modality:FINAL <> (x:kotlin.Any) returnType:kotlin.Unit
|
||||
RETURN type=kotlin.Nothing from='public final fun test3 (f1: kotlin.Function1<kotlin.String, kotlin.String>, f2: kotlin.Function1<kotlin.Int, kotlin.String>): <root>.C.D<@[FlexibleNullability] kotlin.Int?, @[FlexibleNullability] kotlin.String?> declared in <root>'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> (jxy: @[FlexibleNullability] <root>.J<@[FlexibleNullability] X of <root>.C?, @[FlexibleNullability] Y of <root>.C.D?>?) declared in <root>.C.D' type=<root>.C.D<@[FlexibleNullability] kotlin.Int?, @[FlexibleNullability] kotlin.String?> origin=null
|
||||
<class: Y>: @[FlexibleNullability] kotlin.Int?
|
||||
$outer: CONSTRUCTOR_CALL 'public constructor <init> (jxx: @[FlexibleNullability] <root>.J<@[FlexibleNullability] X of <root>.C?, @[FlexibleNullability] X of <root>.C?>?) declared in <root>.C' type=<root>.C<@[FlexibleNullability] kotlin.String?> origin=null
|
||||
<class: X>: @[FlexibleNullability] kotlin.String?
|
||||
jxx: TYPE_OP type=@[FlexibleNullability] <root>.J<@[FlexibleNullability] kotlin.String?, @[FlexibleNullability] kotlin.String?>? origin=SAM_CONVERSION typeOperand=@[FlexibleNullability] <root>.J<@[FlexibleNullability] kotlin.String?, @[FlexibleNullability] kotlin.String?>?
|
||||
GET_VAR 'f1: kotlin.Function1<kotlin.String, kotlin.String> declared in <root>.test3' type=kotlin.Function1<kotlin.String, kotlin.String> origin=null
|
||||
jxy: TYPE_OP type=@[FlexibleNullability] <root>.J<@[FlexibleNullability] kotlin.String?, @[FlexibleNullability] kotlin.Int?>? origin=SAM_CONVERSION typeOperand=@[FlexibleNullability] <root>.J<@[FlexibleNullability] kotlin.String?, @[FlexibleNullability] kotlin.Int?>?
|
||||
GET_VAR 'f2: kotlin.Function1<kotlin.Int, kotlin.String> declared in <root>.test3' type=kotlin.Function1<kotlin.Int, kotlin.String> origin=null
|
||||
CLASS CLASS name:Outer modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Outer<T1 of <root>.Outer>
|
||||
TYPE_PARAMETER name:T1 index:0 variance: superTypes:[kotlin.Any?]
|
||||
CONSTRUCTOR visibility:public <> (j11:<root>.J<T1 of <root>.Outer, T1 of <root>.Outer>) returnType:<root>.Outer<T1 of <root>.Outer> [primary]
|
||||
VALUE_PARAMETER name:j11 index:0 type:<root>.J<T1 of <root>.Outer, T1 of <root>.Outer>
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Outer modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
PROPERTY name:j11 visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:j11 type:<root>.J<T1 of <root>.Outer, T1 of <root>.Outer> visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
GET_VAR 'j11: <root>.J<T1 of <root>.Outer, T1 of <root>.Outer> declared in <root>.Outer.<init>' type=<root>.J<T1 of <root>.Outer, T1 of <root>.Outer> origin=INITIALIZE_PROPERTY_FROM_PARAMETER
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-j11> visibility:public modality:FINAL <> ($this:<root>.Outer<T1 of <root>.Outer>) returnType:<root>.J<T1 of <root>.Outer, T1 of <root>.Outer>
|
||||
correspondingProperty: PROPERTY name:j11 visibility:public modality:FINAL [val]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Outer<T1 of <root>.Outer>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-j11> (): <root>.J<T1 of <root>.Outer, T1 of <root>.Outer> declared in <root>.Outer'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:j11 type:<root>.J<T1 of <root>.Outer, T1 of <root>.Outer> visibility:private [final]' type=<root>.J<T1 of <root>.Outer, T1 of <root>.Outer> origin=null
|
||||
receiver: GET_VAR '<this>: <root>.Outer<T1 of <root>.Outer> declared in <root>.Outer.<get-j11>' type=<root>.Outer<T1 of <root>.Outer> origin=null
|
||||
CLASS CLASS name:Inner modality:FINAL visibility:public [inner] superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Outer.Inner<T2 of <root>.Outer.Inner, T1 of <root>.Outer>
|
||||
TYPE_PARAMETER name:T2 index:0 variance: superTypes:[kotlin.Any?]
|
||||
CONSTRUCTOR visibility:public <> ($this:<root>.Outer<T1 of <root>.Outer>, j12:<root>.J<T1 of <root>.Outer, T2 of <root>.Outer.Inner>) returnType:<root>.Outer.Inner<T2 of <root>.Outer.Inner, T1 of <root>.Outer> [primary]
|
||||
$outer: VALUE_PARAMETER name:<this> type:<root>.Outer<T1 of <root>.Outer>
|
||||
VALUE_PARAMETER name:j12 index:0 type:<root>.J<T1 of <root>.Outer, T2 of <root>.Outer.Inner>
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Inner modality:FINAL visibility:public [inner] superTypes:[kotlin.Any]'
|
||||
PROPERTY name:j12 visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:j12 type:<root>.J<T1 of <root>.Outer, T2 of <root>.Outer.Inner> visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
GET_VAR 'j12: <root>.J<T1 of <root>.Outer, T2 of <root>.Outer.Inner> declared in <root>.Outer.Inner.<init>' type=<root>.J<T1 of <root>.Outer, T2 of <root>.Outer.Inner> origin=INITIALIZE_PROPERTY_FROM_PARAMETER
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-j12> visibility:public modality:FINAL <> ($this:<root>.Outer.Inner<T2 of <root>.Outer.Inner, T1 of <root>.Outer>) returnType:<root>.J<T1 of <root>.Outer, T2 of <root>.Outer.Inner>
|
||||
correspondingProperty: PROPERTY name:j12 visibility:public modality:FINAL [val]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Outer.Inner<T2 of <root>.Outer.Inner, T1 of <root>.Outer>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-j12> (): <root>.J<T1 of <root>.Outer, T2 of <root>.Outer.Inner> declared in <root>.Outer.Inner'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:j12 type:<root>.J<T1 of <root>.Outer, T2 of <root>.Outer.Inner> visibility:private [final]' type=<root>.J<T1 of <root>.Outer, T2 of <root>.Outer.Inner> origin=null
|
||||
receiver: GET_VAR '<this>: <root>.Outer.Inner<T2 of <root>.Outer.Inner, T1 of <root>.Outer> declared in <root>.Outer.Inner.<get-j12>' type=<root>.Outer.Inner<T2 of <root>.Outer.Inner, T1 of <root>.Outer> origin=null
|
||||
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 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:test4 visibility:public modality:FINAL <> (f:kotlin.Function1<kotlin.String, kotlin.String>, g:kotlin.Function1<kotlin.Any, kotlin.String>) returnType:<root>.Outer.Inner<@[FlexibleNullability] kotlin.Any?, @[FlexibleNullability] kotlin.String?>
|
||||
VALUE_PARAMETER name:f index:0 type:kotlin.Function1<kotlin.String, kotlin.String>
|
||||
VALUE_PARAMETER name:g index:1 type:kotlin.Function1<kotlin.Any, kotlin.String>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test4 (f: kotlin.Function1<kotlin.String, kotlin.String>, g: kotlin.Function1<kotlin.Any, kotlin.String>): <root>.Outer.Inner<@[FlexibleNullability] kotlin.Any?, @[FlexibleNullability] kotlin.String?> declared in <root>'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> (j12: <root>.J<T1 of <root>.Outer, T2 of <root>.Outer.Inner>) [primary] declared in <root>.Outer.Inner' type=<root>.Outer.Inner<@[FlexibleNullability] kotlin.Any?, @[FlexibleNullability] kotlin.String?> origin=null
|
||||
<class: T2>: @[FlexibleNullability] kotlin.Any?
|
||||
$outer: CONSTRUCTOR_CALL 'public constructor <init> (j11: <root>.J<T1 of <root>.Outer, T1 of <root>.Outer>) [primary] declared in <root>.Outer' type=<root>.Outer<@[FlexibleNullability] kotlin.String?> origin=null
|
||||
<class: T1>: @[FlexibleNullability] kotlin.String?
|
||||
j11: TYPE_OP type=<root>.J<@[FlexibleNullability] kotlin.String?, @[FlexibleNullability] kotlin.String?> origin=SAM_CONVERSION typeOperand=<root>.J<@[FlexibleNullability] kotlin.String?, @[FlexibleNullability] kotlin.String?>
|
||||
GET_VAR 'f: kotlin.Function1<kotlin.String, kotlin.String> declared in <root>.test4' type=kotlin.Function1<kotlin.String, kotlin.String> origin=null
|
||||
j12: TYPE_OP type=<root>.J<@[FlexibleNullability] kotlin.String?, @[FlexibleNullability] kotlin.Any?> origin=SAM_CONVERSION typeOperand=<root>.J<@[FlexibleNullability] kotlin.String?, @[FlexibleNullability] kotlin.Any?>
|
||||
GET_VAR 'g: kotlin.Function1<kotlin.Any, kotlin.String> declared in <root>.test4' type=kotlin.Function1<kotlin.Any, kotlin.String> origin=null
|
||||
FUN name:testGenericJavaCtor1 visibility:public modality:FINAL <> (f:kotlin.Function1<kotlin.String, kotlin.Int>) returnType:<root>.G<@[FlexibleNullability] kotlin.String?>
|
||||
VALUE_PARAMETER name:f index:0 type:kotlin.Function1<kotlin.String, kotlin.Int>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun testGenericJavaCtor1 (f: kotlin.Function1<kotlin.String, kotlin.Int>): <root>.G<@[FlexibleNullability] kotlin.String?> declared in <root>'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> <TCtor> (x: @[FlexibleNullability] <root>.J<@[FlexibleNullability] TCtor of <root>.G.<init>?, @[FlexibleNullability] TClass of <root>.G?>?) declared in <root>.G' type=<root>.G<@[FlexibleNullability] kotlin.String?> origin=null
|
||||
<class: TClass>: @[FlexibleNullability] kotlin.String?
|
||||
<TCtor>: @[FlexibleNullability] kotlin.Int?
|
||||
x: TYPE_OP type=@[FlexibleNullability] <root>.J<@[FlexibleNullability] kotlin.Int?, @[FlexibleNullability] kotlin.String?>? origin=SAM_CONVERSION typeOperand=@[FlexibleNullability] <root>.J<@[FlexibleNullability] kotlin.Int?, @[FlexibleNullability] kotlin.String?>?
|
||||
GET_VAR 'f: kotlin.Function1<kotlin.String, kotlin.Int> declared in <root>.testGenericJavaCtor1' type=kotlin.Function1<kotlin.String, kotlin.Int> origin=null
|
||||
FUN name:testGenericJavaCtor2 visibility:public modality:FINAL <> (x:kotlin.Any) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:x index:0 type:kotlin.Any
|
||||
BLOCK_BODY
|
||||
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||
TYPE_OP type=kotlin.Function1<kotlin.String, kotlin.String> origin=CAST typeOperand=kotlin.Function1<kotlin.String, kotlin.String>
|
||||
GET_VAR 'x: kotlin.Any declared in <root>.test2' type=kotlin.Any origin=null
|
||||
TYPE_OP type=kotlin.Function1<kotlin.String, kotlin.Int> origin=CAST typeOperand=kotlin.Function1<kotlin.String, kotlin.Int>
|
||||
GET_VAR 'x: kotlin.Any declared in <root>.testGenericJavaCtor2' type=kotlin.Any origin=null
|
||||
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||
CONSTRUCTOR_CALL 'public constructor <init> (jxx: @[FlexibleNullability] <root>.J<@[FlexibleNullability] X of <root>.C?, @[FlexibleNullability] X of <root>.C?>?) declared in <root>.C' type=<root>.C<@[FlexibleNullability] kotlin.String?> origin=null
|
||||
<class: X>: @[FlexibleNullability] kotlin.String?
|
||||
jxx: TYPE_OP type=@[FlexibleNullability] <root>.J<@[FlexibleNullability] kotlin.String?, @[FlexibleNullability] kotlin.String?>? origin=SAM_CONVERSION typeOperand=@[FlexibleNullability] <root>.J<@[FlexibleNullability] kotlin.String?, @[FlexibleNullability] kotlin.String?>?
|
||||
TYPE_OP type=kotlin.Function1<kotlin.String, kotlin.String> origin=IMPLICIT_CAST typeOperand=kotlin.Function1<kotlin.String, kotlin.String>
|
||||
GET_VAR 'x: kotlin.Any declared in <root>.test2' type=kotlin.Any origin=null
|
||||
CONSTRUCTOR_CALL 'public constructor <init> <TCtor> (x: @[FlexibleNullability] <root>.J<@[FlexibleNullability] TCtor of <root>.G.<init>?, @[FlexibleNullability] TClass of <root>.G?>?) declared in <root>.G' type=<root>.G<@[FlexibleNullability] kotlin.String?> origin=null
|
||||
<class: TClass>: @[FlexibleNullability] kotlin.String?
|
||||
<TCtor>: @[FlexibleNullability] kotlin.Int?
|
||||
x: TYPE_OP type=@[FlexibleNullability] <root>.J<@[FlexibleNullability] kotlin.Int?, @[FlexibleNullability] kotlin.String?>? origin=SAM_CONVERSION typeOperand=@[FlexibleNullability] <root>.J<@[FlexibleNullability] kotlin.Int?, @[FlexibleNullability] kotlin.String?>?
|
||||
TYPE_OP type=kotlin.Function1<kotlin.String, kotlin.Int> origin=IMPLICIT_CAST typeOperand=kotlin.Function1<kotlin.String, kotlin.Int>
|
||||
GET_VAR 'x: kotlin.Any declared in <root>.testGenericJavaCtor2' type=kotlin.Any origin=null
|
||||
|
||||
+24
-5
@@ -1,12 +1,23 @@
|
||||
// FIR_IDENTICAL
|
||||
// TARGET_BACKEND: JVM
|
||||
// !LANGUAGE: +NewInference +SamConversionPerArgument +ProhibitVarargAsArrayAfterSamArgument
|
||||
// FILE: samConversionInGenericConstructorCall.kt
|
||||
fun test1(f: (String) -> String) = C(f)
|
||||
fun test3(
|
||||
f1: (String) -> String,
|
||||
f2: (Int) -> String
|
||||
) =
|
||||
C(f1).D(f2)
|
||||
|
||||
fun test2(x: Any) {
|
||||
x as (String) -> String
|
||||
C(x)
|
||||
class Outer<T1>(val j11: J<T1, T1>) {
|
||||
inner class Inner<T2>(val j12: J<T1, T2>)
|
||||
}
|
||||
|
||||
fun test4(f: (String) -> String, g: (Any) -> String) = Outer(f).Inner(g)
|
||||
|
||||
fun testGenericJavaCtor1(f: (String) -> Int) = G(f)
|
||||
|
||||
fun testGenericJavaCtor2(x: Any) {
|
||||
x as (String) -> Int
|
||||
G(x)
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
@@ -17,5 +28,13 @@ public interface J<T1, T2> {
|
||||
// FILE: C.java
|
||||
public class C<X> {
|
||||
public C(J<X, X> jxx) {}
|
||||
|
||||
public class D<Y> {
|
||||
public D(J<X, Y> jxy) {}
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: G.java
|
||||
public class G<TClass> {
|
||||
public <TCtor> G(J<TCtor, TClass> x) {}
|
||||
}
|
||||
|
||||
+39
-5
@@ -1,8 +1,42 @@
|
||||
fun test1(f: Function1<String, String>): C<@FlexibleNullability String?> {
|
||||
return C<@FlexibleNullability String?>(jxx = f /*-> @FlexibleNullability J<@FlexibleNullability String?, @FlexibleNullability String?>? */)
|
||||
fun test3(f1: Function1<String, String>, f2: Function1<Int, String>): D<@FlexibleNullability Int?, @FlexibleNullability String?> {
|
||||
return C<@FlexibleNullability String?>(jxx = f1 /*-> @FlexibleNullability J<@FlexibleNullability String?, @FlexibleNullability String?>? */).D<@FlexibleNullability Int?>(jxy = f2 /*-> @FlexibleNullability J<@FlexibleNullability String?, @FlexibleNullability Int?>? */)
|
||||
}
|
||||
|
||||
fun test2(x: Any) {
|
||||
x as Function1<String, String> /*~> Unit */
|
||||
C<@FlexibleNullability String?>(jxx = x /*as Function1<String, String> */ /*-> @FlexibleNullability J<@FlexibleNullability String?, @FlexibleNullability String?>? */) /*~> Unit */
|
||||
class Outer<T1 : Any?> {
|
||||
constructor(j11: J<T1, T1>) /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
val j11: J<T1, T1>
|
||||
field = j11
|
||||
get
|
||||
|
||||
inner class Inner<T2 : Any?> {
|
||||
constructor(j12: J<T1, T2>) /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
val j12: J<T1, T2>
|
||||
field = j12
|
||||
get
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun test4(f: Function1<String, String>, g: Function1<Any, String>): Inner<@FlexibleNullability Any?, @FlexibleNullability String?> {
|
||||
return Outer<@FlexibleNullability String?>(j11 = f /*-> J<@FlexibleNullability String?, @FlexibleNullability String?> */).Inner<@FlexibleNullability Any?>(j12 = g /*-> J<@FlexibleNullability String?, @FlexibleNullability Any?> */)
|
||||
}
|
||||
|
||||
fun testGenericJavaCtor1(f: Function1<String, Int>): G<@FlexibleNullability String?> {
|
||||
return G<@FlexibleNullability String?, @FlexibleNullability Int?>(x = f /*-> @FlexibleNullability J<@FlexibleNullability Int?, @FlexibleNullability String?>? */)
|
||||
}
|
||||
|
||||
fun testGenericJavaCtor2(x: Any) {
|
||||
x as Function1<String, Int> /*~> Unit */
|
||||
G<@FlexibleNullability String?, @FlexibleNullability Int?>(x = x /*as Function1<String, Int> */ /*-> @FlexibleNullability J<@FlexibleNullability Int?, @FlexibleNullability String?>? */) /*~> Unit */
|
||||
}
|
||||
|
||||
Vendored
-114
@@ -1,114 +0,0 @@
|
||||
FILE fqName:<root> fileName:/samConversionInGenericConstructorCall_NI.kt
|
||||
FUN name:test3 visibility:public modality:FINAL <> (f1:kotlin.Function1<kotlin.String, kotlin.String>, f2:kotlin.Function1<kotlin.Int, kotlin.String>) returnType:<root>.C.D<@[FlexibleNullability] kotlin.Int?, @[FlexibleNullability] kotlin.String?>
|
||||
VALUE_PARAMETER name:f1 index:0 type:kotlin.Function1<kotlin.String, kotlin.String>
|
||||
VALUE_PARAMETER name:f2 index:1 type:kotlin.Function1<kotlin.Int, kotlin.String>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test3 (f1: kotlin.Function1<kotlin.String, kotlin.String>, f2: kotlin.Function1<kotlin.Int, kotlin.String>): <root>.C.D<@[FlexibleNullability] kotlin.Int?, @[FlexibleNullability] kotlin.String?> declared in <root>'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> (jxy: @[FlexibleNullability] <root>.J<@[FlexibleNullability] X of <root>.C?, @[FlexibleNullability] Y of <root>.C.D?>?) declared in <root>.C.D' type=<root>.C.D<@[FlexibleNullability] kotlin.Int?, @[FlexibleNullability] kotlin.String?> origin=null
|
||||
<class: Y>: @[FlexibleNullability] kotlin.Int?
|
||||
$outer: CONSTRUCTOR_CALL 'public constructor <init> (jxx: @[FlexibleNullability] <root>.J<@[FlexibleNullability] X of <root>.C?, @[FlexibleNullability] X of <root>.C?>?) declared in <root>.C' type=<root>.C<@[FlexibleNullability] kotlin.String?> origin=null
|
||||
<class: X>: @[FlexibleNullability] kotlin.String?
|
||||
jxx: TYPE_OP type=@[FlexibleNullability] <root>.J<@[FlexibleNullability] kotlin.String?, @[FlexibleNullability] kotlin.String?>? origin=SAM_CONVERSION typeOperand=@[FlexibleNullability] <root>.J<@[FlexibleNullability] kotlin.String?, @[FlexibleNullability] kotlin.String?>?
|
||||
GET_VAR 'f1: kotlin.Function1<kotlin.String, kotlin.String> declared in <root>.test3' type=kotlin.Function1<kotlin.String, kotlin.String> origin=null
|
||||
jxy: TYPE_OP type=@[FlexibleNullability] <root>.J<@[FlexibleNullability] kotlin.String?, @[FlexibleNullability] kotlin.Int?>? origin=SAM_CONVERSION typeOperand=@[FlexibleNullability] <root>.J<@[FlexibleNullability] kotlin.String?, @[FlexibleNullability] kotlin.Int?>?
|
||||
GET_VAR 'f2: kotlin.Function1<kotlin.Int, kotlin.String> declared in <root>.test3' type=kotlin.Function1<kotlin.Int, kotlin.String> origin=null
|
||||
CLASS CLASS name:Outer modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Outer<T1 of <root>.Outer>
|
||||
TYPE_PARAMETER name:T1 index:0 variance: superTypes:[kotlin.Any?]
|
||||
CONSTRUCTOR visibility:public <> (j11:<root>.J<T1 of <root>.Outer, T1 of <root>.Outer>) returnType:<root>.Outer<T1 of <root>.Outer> [primary]
|
||||
VALUE_PARAMETER name:j11 index:0 type:<root>.J<T1 of <root>.Outer, T1 of <root>.Outer>
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Outer modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
PROPERTY name:j11 visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:j11 type:<root>.J<T1 of <root>.Outer, T1 of <root>.Outer> visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
GET_VAR 'j11: <root>.J<T1 of <root>.Outer, T1 of <root>.Outer> declared in <root>.Outer.<init>' type=<root>.J<T1 of <root>.Outer, T1 of <root>.Outer> origin=INITIALIZE_PROPERTY_FROM_PARAMETER
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-j11> visibility:public modality:FINAL <> ($this:<root>.Outer<T1 of <root>.Outer>) returnType:<root>.J<T1 of <root>.Outer, T1 of <root>.Outer>
|
||||
correspondingProperty: PROPERTY name:j11 visibility:public modality:FINAL [val]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Outer<T1 of <root>.Outer>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-j11> (): <root>.J<T1 of <root>.Outer, T1 of <root>.Outer> declared in <root>.Outer'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:j11 type:<root>.J<T1 of <root>.Outer, T1 of <root>.Outer> visibility:private [final]' type=<root>.J<T1 of <root>.Outer, T1 of <root>.Outer> origin=null
|
||||
receiver: GET_VAR '<this>: <root>.Outer<T1 of <root>.Outer> declared in <root>.Outer.<get-j11>' type=<root>.Outer<T1 of <root>.Outer> origin=null
|
||||
CLASS CLASS name:Inner modality:FINAL visibility:public [inner] superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Outer.Inner<T2 of <root>.Outer.Inner, T1 of <root>.Outer>
|
||||
TYPE_PARAMETER name:T2 index:0 variance: superTypes:[kotlin.Any?]
|
||||
CONSTRUCTOR visibility:public <> ($this:<root>.Outer<T1 of <root>.Outer>, j12:<root>.J<T1 of <root>.Outer, T2 of <root>.Outer.Inner>) returnType:<root>.Outer.Inner<T2 of <root>.Outer.Inner, T1 of <root>.Outer> [primary]
|
||||
$outer: VALUE_PARAMETER name:<this> type:<root>.Outer<T1 of <root>.Outer>
|
||||
VALUE_PARAMETER name:j12 index:0 type:<root>.J<T1 of <root>.Outer, T2 of <root>.Outer.Inner>
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Inner modality:FINAL visibility:public [inner] superTypes:[kotlin.Any]'
|
||||
PROPERTY name:j12 visibility:public modality:FINAL [val]
|
||||
FIELD PROPERTY_BACKING_FIELD name:j12 type:<root>.J<T1 of <root>.Outer, T2 of <root>.Outer.Inner> visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
GET_VAR 'j12: <root>.J<T1 of <root>.Outer, T2 of <root>.Outer.Inner> declared in <root>.Outer.Inner.<init>' type=<root>.J<T1 of <root>.Outer, T2 of <root>.Outer.Inner> origin=INITIALIZE_PROPERTY_FROM_PARAMETER
|
||||
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-j12> visibility:public modality:FINAL <> ($this:<root>.Outer.Inner<T2 of <root>.Outer.Inner, T1 of <root>.Outer>) returnType:<root>.J<T1 of <root>.Outer, T2 of <root>.Outer.Inner>
|
||||
correspondingProperty: PROPERTY name:j12 visibility:public modality:FINAL [val]
|
||||
$this: VALUE_PARAMETER name:<this> type:<root>.Outer.Inner<T2 of <root>.Outer.Inner, T1 of <root>.Outer>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun <get-j12> (): <root>.J<T1 of <root>.Outer, T2 of <root>.Outer.Inner> declared in <root>.Outer.Inner'
|
||||
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:j12 type:<root>.J<T1 of <root>.Outer, T2 of <root>.Outer.Inner> visibility:private [final]' type=<root>.J<T1 of <root>.Outer, T2 of <root>.Outer.Inner> origin=null
|
||||
receiver: GET_VAR '<this>: <root>.Outer.Inner<T2 of <root>.Outer.Inner, T1 of <root>.Outer> declared in <root>.Outer.Inner.<get-j12>' type=<root>.Outer.Inner<T2 of <root>.Outer.Inner, T1 of <root>.Outer> origin=null
|
||||
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 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:test4 visibility:public modality:FINAL <> (f:kotlin.Function1<kotlin.String, kotlin.String>, g:kotlin.Function1<kotlin.Any, kotlin.String>) returnType:<root>.Outer.Inner<@[FlexibleNullability] kotlin.Any?, @[FlexibleNullability] kotlin.String?>
|
||||
VALUE_PARAMETER name:f index:0 type:kotlin.Function1<kotlin.String, kotlin.String>
|
||||
VALUE_PARAMETER name:g index:1 type:kotlin.Function1<kotlin.Any, kotlin.String>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun test4 (f: kotlin.Function1<kotlin.String, kotlin.String>, g: kotlin.Function1<kotlin.Any, kotlin.String>): <root>.Outer.Inner<@[FlexibleNullability] kotlin.Any?, @[FlexibleNullability] kotlin.String?> declared in <root>'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> (j12: <root>.J<T1 of <root>.Outer, T2 of <root>.Outer.Inner>) [primary] declared in <root>.Outer.Inner' type=<root>.Outer.Inner<@[FlexibleNullability] kotlin.Any?, @[FlexibleNullability] kotlin.String?> origin=null
|
||||
<class: T2>: @[FlexibleNullability] kotlin.Any?
|
||||
$outer: CONSTRUCTOR_CALL 'public constructor <init> (j11: <root>.J<T1 of <root>.Outer, T1 of <root>.Outer>) [primary] declared in <root>.Outer' type=<root>.Outer<@[FlexibleNullability] kotlin.String?> origin=null
|
||||
<class: T1>: @[FlexibleNullability] kotlin.String?
|
||||
j11: TYPE_OP type=<root>.J<@[FlexibleNullability] kotlin.String?, @[FlexibleNullability] kotlin.String?> origin=SAM_CONVERSION typeOperand=<root>.J<@[FlexibleNullability] kotlin.String?, @[FlexibleNullability] kotlin.String?>
|
||||
GET_VAR 'f: kotlin.Function1<kotlin.String, kotlin.String> declared in <root>.test4' type=kotlin.Function1<kotlin.String, kotlin.String> origin=null
|
||||
j12: TYPE_OP type=<root>.J<@[FlexibleNullability] kotlin.String?, @[FlexibleNullability] kotlin.Any?> origin=SAM_CONVERSION typeOperand=<root>.J<@[FlexibleNullability] kotlin.String?, @[FlexibleNullability] kotlin.Any?>
|
||||
GET_VAR 'g: kotlin.Function1<kotlin.Any, kotlin.String> declared in <root>.test4' type=kotlin.Function1<kotlin.Any, kotlin.String> origin=null
|
||||
FUN name:testGenericJavaCtor1 visibility:public modality:FINAL <> (f:kotlin.Function1<kotlin.String, kotlin.Int>) returnType:<root>.G<@[FlexibleNullability] kotlin.String?>
|
||||
VALUE_PARAMETER name:f index:0 type:kotlin.Function1<kotlin.String, kotlin.Int>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun testGenericJavaCtor1 (f: kotlin.Function1<kotlin.String, kotlin.Int>): <root>.G<@[FlexibleNullability] kotlin.String?> declared in <root>'
|
||||
CONSTRUCTOR_CALL 'public constructor <init> <TCtor> (x: @[FlexibleNullability] <root>.J<@[FlexibleNullability] TCtor of <root>.G.<init>?, @[FlexibleNullability] TClass of <root>.G?>?) declared in <root>.G' type=<root>.G<@[FlexibleNullability] kotlin.String?> origin=null
|
||||
<class: TClass>: @[FlexibleNullability] kotlin.String?
|
||||
<TCtor>: @[FlexibleNullability] kotlin.Int?
|
||||
x: TYPE_OP type=@[FlexibleNullability] <root>.J<@[FlexibleNullability] kotlin.Int?, @[FlexibleNullability] kotlin.String?>? origin=SAM_CONVERSION typeOperand=@[FlexibleNullability] <root>.J<@[FlexibleNullability] kotlin.Int?, @[FlexibleNullability] kotlin.String?>?
|
||||
GET_VAR 'f: kotlin.Function1<kotlin.String, kotlin.Int> declared in <root>.testGenericJavaCtor1' type=kotlin.Function1<kotlin.String, kotlin.Int> origin=null
|
||||
FUN name:testGenericJavaCtor2 visibility:public modality:FINAL <> (x:kotlin.Any) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:x index:0 type:kotlin.Any
|
||||
BLOCK_BODY
|
||||
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||
TYPE_OP type=kotlin.Function1<kotlin.String, kotlin.Int> origin=CAST typeOperand=kotlin.Function1<kotlin.String, kotlin.Int>
|
||||
GET_VAR 'x: kotlin.Any declared in <root>.testGenericJavaCtor2' type=kotlin.Any origin=null
|
||||
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||
CONSTRUCTOR_CALL 'public constructor <init> <TCtor> (x: @[FlexibleNullability] <root>.J<@[FlexibleNullability] TCtor of <root>.G.<init>?, @[FlexibleNullability] TClass of <root>.G?>?) declared in <root>.G' type=<root>.G<@[FlexibleNullability] kotlin.String?> origin=null
|
||||
<class: TClass>: @[FlexibleNullability] kotlin.String?
|
||||
<TCtor>: @[FlexibleNullability] kotlin.Int?
|
||||
x: TYPE_OP type=@[FlexibleNullability] <root>.J<@[FlexibleNullability] kotlin.Int?, @[FlexibleNullability] kotlin.String?>? origin=SAM_CONVERSION typeOperand=@[FlexibleNullability] <root>.J<@[FlexibleNullability] kotlin.Int?, @[FlexibleNullability] kotlin.String?>?
|
||||
TYPE_OP type=kotlin.Function1<kotlin.String, kotlin.Int> origin=IMPLICIT_CAST typeOperand=kotlin.Function1<kotlin.String, kotlin.Int>
|
||||
GET_VAR 'x: kotlin.Any declared in <root>.testGenericJavaCtor2' type=kotlin.Any origin=null
|
||||
-41
@@ -1,41 +0,0 @@
|
||||
// FIR_IDENTICAL
|
||||
// TARGET_BACKEND: JVM
|
||||
// !LANGUAGE: +NewInference +SamConversionPerArgument +SamConversionForKotlinFunctions +ProhibitVarargAsArrayAfterSamArgument
|
||||
// FILE: samConversionInGenericConstructorCall_NI.kt
|
||||
fun test3(
|
||||
f1: (String) -> String,
|
||||
f2: (Int) -> String
|
||||
) =
|
||||
C(f1).D(f2)
|
||||
|
||||
class Outer<T1>(val j11: J<T1, T1>) {
|
||||
inner class Inner<T2>(val j12: J<T1, T2>)
|
||||
}
|
||||
|
||||
fun test4(f: (String) -> String, g: (Any) -> String) = Outer(f).Inner(g)
|
||||
|
||||
fun testGenericJavaCtor1(f: (String) -> Int) = G(f)
|
||||
|
||||
fun testGenericJavaCtor2(x: Any) {
|
||||
x as (String) -> Int
|
||||
G(x)
|
||||
}
|
||||
|
||||
// FILE: J.java
|
||||
public interface J<T1, T2> {
|
||||
T1 foo(T2 x);
|
||||
}
|
||||
|
||||
// FILE: C.java
|
||||
public class C<X> {
|
||||
public C(J<X, X> jxx) {}
|
||||
|
||||
public class D<Y> {
|
||||
public D(J<X, Y> jxy) {}
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: G.java
|
||||
public class G<TClass> {
|
||||
public <TCtor> G(J<TCtor, TClass> x) {}
|
||||
}
|
||||
Vendored
-42
@@ -1,42 +0,0 @@
|
||||
fun test3(f1: Function1<String, String>, f2: Function1<Int, String>): D<@FlexibleNullability Int?, @FlexibleNullability String?> {
|
||||
return C<@FlexibleNullability String?>(jxx = f1 /*-> @FlexibleNullability J<@FlexibleNullability String?, @FlexibleNullability String?>? */).D<@FlexibleNullability Int?>(jxy = f2 /*-> @FlexibleNullability J<@FlexibleNullability String?, @FlexibleNullability Int?>? */)
|
||||
}
|
||||
|
||||
class Outer<T1 : Any?> {
|
||||
constructor(j11: J<T1, T1>) /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
val j11: J<T1, T1>
|
||||
field = j11
|
||||
get
|
||||
|
||||
inner class Inner<T2 : Any?> {
|
||||
constructor(j12: J<T1, T2>) /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
val j12: J<T1, T2>
|
||||
field = j12
|
||||
get
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun test4(f: Function1<String, String>, g: Function1<Any, String>): Inner<@FlexibleNullability Any?, @FlexibleNullability String?> {
|
||||
return Outer<@FlexibleNullability String?>(j11 = f /*-> J<@FlexibleNullability String?, @FlexibleNullability String?> */).Inner<@FlexibleNullability Any?>(j12 = g /*-> J<@FlexibleNullability String?, @FlexibleNullability Any?> */)
|
||||
}
|
||||
|
||||
fun testGenericJavaCtor1(f: Function1<String, Int>): G<@FlexibleNullability String?> {
|
||||
return G<@FlexibleNullability String?, @FlexibleNullability Int?>(x = f /*-> @FlexibleNullability J<@FlexibleNullability Int?, @FlexibleNullability String?>? */)
|
||||
}
|
||||
|
||||
fun testGenericJavaCtor2(x: Any) {
|
||||
x as Function1<String, Int> /*~> Unit */
|
||||
G<@FlexibleNullability String?, @FlexibleNullability Int?>(x = x /*as Function1<String, Int> */ /*-> @FlexibleNullability J<@FlexibleNullability Int?, @FlexibleNullability String?>? */) /*~> Unit */
|
||||
}
|
||||
+1
-1
@@ -47,7 +47,7 @@ FILE fqName:<root> fileName:/samConversionsWithSmartCasts.kt
|
||||
then: BLOCK type=kotlin.Unit origin=null
|
||||
CALL 'public open fun run2 (r1: @[FlexibleNullability] java.lang.Runnable?, r2: @[FlexibleNullability] java.lang.Runnable?): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=null
|
||||
$this: CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.J' type=<root>.J origin=null
|
||||
r1: TYPE_OP type=@[FlexibleNullability] java.lang.Runnable? origin=SAM_CONVERSION typeOperand=@[FlexibleNullability] java.lang.Runnable?
|
||||
r1: TYPE_OP type=java.lang.Runnable origin=IMPLICIT_CAST typeOperand=java.lang.Runnable
|
||||
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test4' type=kotlin.Function0<kotlin.Unit> origin=null
|
||||
r2: TYPE_OP type=@[FlexibleNullability] java.lang.Runnable? origin=SAM_CONVERSION typeOperand=@[FlexibleNullability] java.lang.Runnable?
|
||||
GET_VAR 'b: kotlin.Function0<kotlin.Unit> declared in <root>.test4' type=kotlin.Function0<kotlin.Unit> origin=null
|
||||
|
||||
+1
-4
@@ -1,7 +1,4 @@
|
||||
// !LANGUAGE: -NewInference
|
||||
// TARGET_BACKEND: JVM
|
||||
// NB new inference doesn't really work with old JVM back-end.
|
||||
|
||||
// WITH_JDK
|
||||
// FILE: samConversionsWithSmartCasts.kt
|
||||
|
||||
@@ -69,4 +66,4 @@ public class J {
|
||||
public void run2(Runnable r1, Runnable r2) {}
|
||||
|
||||
public static <T> T id(T x) { return x; }
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ fun test3(a: Function0<Unit>) {
|
||||
fun test4(a: Function0<Unit>, b: Function0<Unit>) {
|
||||
when {
|
||||
a is Runnable -> { // BLOCK
|
||||
J().run2(r1 = a /*-> @FlexibleNullability Runnable? */, r2 = b /*-> @FlexibleNullability Runnable? */)
|
||||
J().run2(r1 = a /*as Runnable */, r2 = b /*-> @FlexibleNullability Runnable? */)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-3
@@ -1,5 +1,3 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
|
||||
val <T : CharSequence> T.gk: () -> T
|
||||
get() = { -> this }
|
||||
|
||||
@@ -8,4 +6,4 @@ fun testGeneric1(x: String) = x.gk()
|
||||
val <T> T.kt26531Val: () -> T
|
||||
get() = fun () = this
|
||||
|
||||
fun kt26531() = 7.kt26531Val()
|
||||
fun kt26531() = 7.kt26531Val()
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
FILE fqName:<root> fileName:/fixationOrder1.kt
|
||||
FILE fqName:<root> fileName:/newInferenceFixationOrder1.kt
|
||||
FUN name:foo visibility:public modality:FINAL <X, Y> () returnType:kotlin.Function1<X of <root>.foo, Y of <root>.foo>
|
||||
TYPE_PARAMETER name:X index:0 variance: superTypes:[kotlin.Any?]
|
||||
TYPE_PARAMETER name:Y index:1 variance: superTypes:[kotlin.Any?]
|
||||
@@ -1,9 +1,7 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
|
||||
@OptIn(ExperimentalTypeInference::class)
|
||||
fun <R> scopedFlow(@BuilderInference block: suspend CoroutineScope.(FlowCollector<R>) -> Unit): Flow<R> =
|
||||
flow {
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +NewInference
|
||||
|
||||
fun use(fn: () -> Unit) {}
|
||||
|
||||
fun test() {
|
||||
use { 42 }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +NewInference
|
||||
|
||||
interface Foo<in T> {
|
||||
val x: Int
|
||||
@@ -13,4 +12,4 @@ fun Foo<*>.testSmartCastOnExtensionReceiver() {
|
||||
foo("string")
|
||||
}
|
||||
|
||||
fun testValueParameter(vp: Foo<*>) = vp.x
|
||||
fun testValueParameter(vp: Foo<*>) = vp.x
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
FILE fqName:<root> fileName:/intersectionType1_NI.kt
|
||||
FILE fqName:<root> fileName:/intersectionType1.kt
|
||||
CLASS CLASS name:In modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.In<I of <root>.In>
|
||||
TYPE_PARAMETER name:I index:0 variance:in superTypes:[kotlin.Any?]
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
FILE fqName:<root> fileName:/intersectionType1_NI.kt
|
||||
FILE fqName:<root> fileName:/intersectionType1.kt
|
||||
CLASS CLASS name:In modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.In<I of <root>.In>
|
||||
TYPE_PARAMETER name:I index:0 variance:in superTypes:[kotlin.Any?]
|
||||
+1
-3
@@ -1,5 +1,3 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
|
||||
class In<in I>
|
||||
|
||||
fun <S> select(x: S, y: S): S = x
|
||||
@@ -14,4 +12,4 @@ fun test() {
|
||||
val a1 = arrayOf(In<Int>())
|
||||
val a2 = arrayOf(In<String>())
|
||||
foo(a1, a2)
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
FILE fqName:<root> fileName:/intersectionType1_OI.kt
|
||||
CLASS CLASS name:In modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.In<I of <root>.In>
|
||||
TYPE_PARAMETER name:I index:0 variance:in superTypes:[kotlin.Any?]
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.In<I of <root>.In> [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:In modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
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:select visibility:public modality:FINAL <S> (x:S of <root>.select, y:S of <root>.select) returnType:S of <root>.select
|
||||
TYPE_PARAMETER name:S index:0 variance: superTypes:[kotlin.Any?]
|
||||
VALUE_PARAMETER name:x index:0 type:S of <root>.select
|
||||
VALUE_PARAMETER name:y index:1 type:S of <root>.select
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun select <S> (x: S of <root>.select, y: S of <root>.select): S of <root>.select declared in <root>'
|
||||
GET_VAR 'x: S of <root>.select declared in <root>.select' type=S of <root>.select origin=null
|
||||
FUN name:foo visibility:public modality:FINAL <T> (a:kotlin.Array<<root>.In<T of <root>.foo>>, b:kotlin.Array<<root>.In<kotlin.String>>) returnType:kotlin.Boolean
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
VALUE_PARAMETER name:a index:0 type:kotlin.Array<<root>.In<T of <root>.foo>>
|
||||
VALUE_PARAMETER name:b index:1 type:kotlin.Array<<root>.In<kotlin.String>>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun foo <T> (a: kotlin.Array<<root>.In<T of <root>.foo>>, b: kotlin.Array<<root>.In<kotlin.String>>): kotlin.Boolean declared in <root>'
|
||||
CALL 'public final fun ofType <K> (y: kotlin.Any?): kotlin.Boolean [inline] declared in <root>' type=kotlin.Boolean origin=null
|
||||
<K>: kotlin.Any?
|
||||
$receiver: CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array [operator] declared in kotlin.Array' type=<root>.In<kotlin.Nothing> origin=null
|
||||
$this: CALL 'public final fun select <S> (x: S of <root>.select, y: S of <root>.select): S of <root>.select declared in <root>' type=kotlin.Array<out <root>.In<kotlin.Nothing>> origin=null
|
||||
<S>: kotlin.Array<out <root>.In<kotlin.Nothing>>
|
||||
x: GET_VAR 'a: kotlin.Array<<root>.In<T of <root>.foo>> declared in <root>.foo' type=kotlin.Array<<root>.In<T of <root>.foo>> origin=null
|
||||
y: GET_VAR 'b: kotlin.Array<<root>.In<kotlin.String>> declared in <root>.foo' type=kotlin.Array<<root>.In<kotlin.String>> origin=null
|
||||
index: CONST Int type=kotlin.Int value=0
|
||||
y: CONST Boolean type=kotlin.Boolean value=true
|
||||
FUN name:ofType visibility:public modality:FINAL <K> ($receiver:<root>.In<K of <root>.ofType>, y:kotlin.Any?) returnType:kotlin.Boolean [inline]
|
||||
TYPE_PARAMETER name:K index:0 variance: superTypes:[kotlin.Any?]
|
||||
$receiver: VALUE_PARAMETER name:<this> type:<root>.In<K of <root>.ofType>
|
||||
VALUE_PARAMETER name:y index:0 type:kotlin.Any?
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun ofType <K> (y: kotlin.Any?): kotlin.Boolean [inline] declared in <root>'
|
||||
TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=K of <root>.ofType
|
||||
GET_VAR 'y: kotlin.Any? declared in <root>.ofType' type=kotlin.Any? origin=null
|
||||
FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
VAR name:a1 type:kotlin.Array<<root>.In<kotlin.Int>> [val]
|
||||
CALL 'public final fun arrayOf <T> (vararg elements: T of kotlin.arrayOf): kotlin.Array<T of kotlin.arrayOf> [inline] declared in kotlin' type=kotlin.Array<<root>.In<kotlin.Int>> origin=null
|
||||
<T>: <root>.In<kotlin.Int>
|
||||
elements: VARARG type=kotlin.Array<out <root>.In<kotlin.Int>> varargElementType=<root>.In<kotlin.Int>
|
||||
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.In' type=<root>.In<kotlin.Int> origin=null
|
||||
<class: I>: kotlin.Int
|
||||
VAR name:a2 type:kotlin.Array<<root>.In<kotlin.String>> [val]
|
||||
CALL 'public final fun arrayOf <T> (vararg elements: T of kotlin.arrayOf): kotlin.Array<T of kotlin.arrayOf> [inline] declared in kotlin' type=kotlin.Array<<root>.In<kotlin.String>> origin=null
|
||||
<T>: <root>.In<kotlin.String>
|
||||
elements: VARARG type=kotlin.Array<out <root>.In<kotlin.String>> varargElementType=<root>.In<kotlin.String>
|
||||
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.In' type=<root>.In<kotlin.String> origin=null
|
||||
<class: I>: kotlin.String
|
||||
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||
CALL 'public final fun foo <T> (a: kotlin.Array<<root>.In<T of <root>.foo>>, b: kotlin.Array<<root>.In<kotlin.String>>): kotlin.Boolean declared in <root>' type=kotlin.Boolean origin=null
|
||||
<T>: kotlin.Int
|
||||
a: GET_VAR 'val a1: kotlin.Array<<root>.In<kotlin.Int>> [val] declared in <root>.test' type=kotlin.Array<<root>.In<kotlin.Int>> origin=null
|
||||
b: GET_VAR 'val a2: kotlin.Array<<root>.In<kotlin.String>> [val] declared in <root>.test' type=kotlin.Array<<root>.In<kotlin.String>> origin=null
|
||||
@@ -1,26 +0,0 @@
|
||||
class In<in I : Any?> {
|
||||
constructor() /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun <S : Any?> select(x: S, y: S): S {
|
||||
return x
|
||||
}
|
||||
|
||||
fun <T : Any?> foo(a: Array<In<T>>, b: Array<In<String>>): Boolean {
|
||||
return select<Array<out In<Nothing>>>(x = a, y = b).get(index = 0).ofType<Any?>(y = true)
|
||||
}
|
||||
|
||||
inline fun <reified K : Any?> In<K>.ofType(y: Any?): Boolean {
|
||||
return y is K
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val a1: Array<In<Int>> = arrayOf<In<Int>>(elements = [In<Int>()])
|
||||
val a2: Array<In<String>> = arrayOf<In<String>>(elements = [In<String>()])
|
||||
foo<Int>(a = a1, b = a2) /*~> Unit */
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
FILE fqName:<root> fileName:/intersectionType1_OI.kt
|
||||
CLASS CLASS name:In modality:FINAL visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.In<I of <root>.In>
|
||||
TYPE_PARAMETER name:I index:0 variance:in superTypes:[kotlin.Any?]
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.In<I of <root>.In> [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:In modality:FINAL visibility:public superTypes:[kotlin.Any]'
|
||||
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:select visibility:public modality:FINAL <S> (x:S of <root>.select, y:S of <root>.select) returnType:S of <root>.select
|
||||
TYPE_PARAMETER name:S index:0 variance: superTypes:[kotlin.Any?]
|
||||
VALUE_PARAMETER name:x index:0 type:S of <root>.select
|
||||
VALUE_PARAMETER name:y index:1 type:S of <root>.select
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun select <S> (x: S of <root>.select, y: S of <root>.select): S of <root>.select declared in <root>'
|
||||
GET_VAR 'x: S of <root>.select declared in <root>.select' type=S of <root>.select origin=null
|
||||
FUN name:foo visibility:public modality:FINAL <T> (a:kotlin.Array<<root>.In<T of <root>.foo>>, b:kotlin.Array<<root>.In<kotlin.String>>) returnType:kotlin.Boolean
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
VALUE_PARAMETER name:a index:0 type:kotlin.Array<<root>.In<T of <root>.foo>>
|
||||
VALUE_PARAMETER name:b index:1 type:kotlin.Array<<root>.In<kotlin.String>>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun foo <T> (a: kotlin.Array<<root>.In<T of <root>.foo>>, b: kotlin.Array<<root>.In<kotlin.String>>): kotlin.Boolean declared in <root>'
|
||||
CALL 'public final fun ofType <K> (y: kotlin.Any?): kotlin.Boolean [inline] declared in <root>' type=kotlin.Boolean origin=null
|
||||
<K>: kotlin.Any?
|
||||
$receiver: CALL 'public final fun get (index: kotlin.Int): T of kotlin.Array [operator] declared in kotlin.Array' type=<root>.In<kotlin.Any?> origin=GET_ARRAY_ELEMENT
|
||||
$this: CALL 'public final fun select <S> (x: S of <root>.select, y: S of <root>.select): S of <root>.select declared in <root>' type=kotlin.Array<out <root>.In<kotlin.Any?>> origin=null
|
||||
<S>: kotlin.Array<out <root>.In<kotlin.Any?>>
|
||||
x: GET_VAR 'a: kotlin.Array<<root>.In<T of <root>.foo>> declared in <root>.foo' type=kotlin.Array<<root>.In<T of <root>.foo>> origin=null
|
||||
y: GET_VAR 'b: kotlin.Array<<root>.In<kotlin.String>> declared in <root>.foo' type=kotlin.Array<<root>.In<kotlin.String>> origin=null
|
||||
index: CONST Int type=kotlin.Int value=0
|
||||
y: CONST Boolean type=kotlin.Boolean value=true
|
||||
FUN name:ofType visibility:public modality:FINAL <K> ($receiver:<root>.In<K of <root>.ofType>, y:kotlin.Any?) returnType:kotlin.Boolean [inline]
|
||||
TYPE_PARAMETER name:K index:0 variance: superTypes:[kotlin.Any?]
|
||||
$receiver: VALUE_PARAMETER name:<this> type:<root>.In<K of <root>.ofType>
|
||||
VALUE_PARAMETER name:y index:0 type:kotlin.Any?
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun ofType <K> (y: kotlin.Any?): kotlin.Boolean [inline] declared in <root>'
|
||||
TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=K of <root>.ofType
|
||||
GET_VAR 'y: kotlin.Any? declared in <root>.ofType' type=kotlin.Any? origin=null
|
||||
FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Unit
|
||||
BLOCK_BODY
|
||||
VAR name:a1 type:kotlin.Array<<root>.In<kotlin.Int>> [val]
|
||||
CALL 'public final fun arrayOf <T> (vararg elements: T of kotlin.arrayOf): kotlin.Array<T of kotlin.arrayOf> [inline] declared in kotlin' type=kotlin.Array<<root>.In<kotlin.Int>> origin=null
|
||||
<T>: <root>.In<kotlin.Int>
|
||||
elements: VARARG type=kotlin.Array<out <root>.In<kotlin.Int>> varargElementType=<root>.In<kotlin.Int>
|
||||
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.In' type=<root>.In<kotlin.Int> origin=null
|
||||
<class: I>: kotlin.Int
|
||||
VAR name:a2 type:kotlin.Array<<root>.In<kotlin.String>> [val]
|
||||
CALL 'public final fun arrayOf <T> (vararg elements: T of kotlin.arrayOf): kotlin.Array<T of kotlin.arrayOf> [inline] declared in kotlin' type=kotlin.Array<<root>.In<kotlin.String>> origin=null
|
||||
<T>: <root>.In<kotlin.String>
|
||||
elements: VARARG type=kotlin.Array<out <root>.In<kotlin.String>> varargElementType=<root>.In<kotlin.String>
|
||||
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.In' type=<root>.In<kotlin.String> origin=null
|
||||
<class: I>: kotlin.String
|
||||
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||
CALL 'public final fun foo <T> (a: kotlin.Array<<root>.In<T of <root>.foo>>, b: kotlin.Array<<root>.In<kotlin.String>>): kotlin.Boolean declared in <root>' type=kotlin.Boolean origin=null
|
||||
<T>: kotlin.Int
|
||||
a: GET_VAR 'val a1: kotlin.Array<<root>.In<kotlin.Int>> [val] declared in <root>.test' type=kotlin.Array<<root>.In<kotlin.Int>> origin=null
|
||||
b: GET_VAR 'val a2: kotlin.Array<<root>.In<kotlin.String>> [val] declared in <root>.test' type=kotlin.Array<<root>.In<kotlin.String>> origin=null
|
||||
@@ -1,17 +0,0 @@
|
||||
// !LANGUAGE: -NewInference
|
||||
|
||||
class In<in I>
|
||||
|
||||
fun <S> select(x: S, y: S): S = x
|
||||
|
||||
fun <T> foo(a: Array<In<T>>, b: Array<In<String>>) =
|
||||
select(a, b)[0].ofType(true)
|
||||
|
||||
inline fun <reified K> In<K>.ofType(y: Any?) =
|
||||
y is K
|
||||
|
||||
fun test() {
|
||||
val a1 = arrayOf(In<Int>())
|
||||
val a2 = arrayOf(In<String>())
|
||||
foo(a1, a2)
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
class In<in I : Any?> {
|
||||
constructor() /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun <S : Any?> select(x: S, y: S): S {
|
||||
return x
|
||||
}
|
||||
|
||||
fun <T : Any?> foo(a: Array<In<T>>, b: Array<In<String>>): Boolean {
|
||||
return select<Array<out In<Any?>>>(x = a, y = b).get(index = 0).ofType<Any?>(y = true)
|
||||
}
|
||||
|
||||
inline fun <reified K : Any?> In<K>.ofType(y: Any?): Boolean {
|
||||
return y is K
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val a1: Array<In<Int>> = arrayOf<In<Int>>(elements = [In<Int>()])
|
||||
val a2: Array<In<String>> = arrayOf<In<String>>(elements = [In<String>()])
|
||||
foo<Int>(a = a1, b = a2) /*~> Unit */
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
FILE fqName:<root> fileName:/intersectionType2_NI.kt
|
||||
FILE fqName:<root> fileName:/intersectionType2.kt
|
||||
CLASS INTERFACE name:A modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A<T of <root>.A>
|
||||
TYPE_PARAMETER name:T index:0 variance:out superTypes:[kotlin.Any?]
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
FILE fqName:<root> fileName:/intersectionType2_NI.kt
|
||||
FILE fqName:<root> fileName:/intersectionType2.kt
|
||||
CLASS INTERFACE name:A modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A<T of <root>.A>
|
||||
TYPE_PARAMETER name:T index:0 variance:out superTypes:[kotlin.Any?]
|
||||
+1
-3
@@ -1,5 +1,3 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
|
||||
interface A<out T>
|
||||
interface Foo
|
||||
|
||||
@@ -15,4 +13,4 @@ fun foo() = run {
|
||||
val c = if (true) mm else nn
|
||||
|
||||
c
|
||||
}
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
FILE fqName:<root> fileName:/intersectionType2_OI.kt
|
||||
CLASS INTERFACE name:A modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A<T of <root>.A>
|
||||
TYPE_PARAMETER name:T index:0 variance:out superTypes:[kotlin.Any?]
|
||||
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
|
||||
CLASS INTERFACE name:Foo modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Foo
|
||||
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
|
||||
CLASS CLASS name:B modality:OPEN visibility:public superTypes:[<root>.Foo; <root>.A<<root>.B>]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.B
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.B [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:B modality:OPEN visibility:public superTypes:[<root>.Foo; <root>.A<<root>.B>]'
|
||||
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 [fake_override,operator] declared in <root>.Foo
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.A
|
||||
$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 [fake_override] declared in <root>.Foo
|
||||
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.A
|
||||
$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 [fake_override] declared in <root>.Foo
|
||||
public open fun toString (): kotlin.String [fake_override] declared in <root>.A
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
CLASS CLASS name:C modality:OPEN visibility:public superTypes:[<root>.Foo; <root>.A<<root>.C>]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.C
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.C [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:C modality:OPEN visibility:public superTypes:[<root>.Foo; <root>.A<<root>.C>]'
|
||||
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 [fake_override,operator] declared in <root>.Foo
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.A
|
||||
$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 [fake_override] declared in <root>.Foo
|
||||
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.A
|
||||
$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 [fake_override] declared in <root>.Foo
|
||||
public open fun toString (): kotlin.String [fake_override] declared in <root>.A
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN name:run visibility:public modality:FINAL <T> (fn:kotlin.Function0<T of <root>.run>) returnType:T of <root>.run
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
VALUE_PARAMETER name:fn index:0 type:kotlin.Function0<T of <root>.run>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun run <T> (fn: kotlin.Function0<T of <root>.run>): T of <root>.run declared in <root>'
|
||||
CALL 'public abstract fun invoke (): R of kotlin.Function0 [operator] declared in kotlin.Function0' type=T of <root>.run origin=INVOKE
|
||||
$this: GET_VAR 'fn: kotlin.Function0<T of <root>.run> declared in <root>.run' type=kotlin.Function0<T of <root>.run> origin=VARIABLE_AS_FUNCTION
|
||||
FUN name:foo visibility:public modality:FINAL <> () returnType:kotlin.Any
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun foo (): kotlin.Any declared in <root>'
|
||||
CALL 'public final fun run <T> (fn: kotlin.Function0<T of <root>.run>): T of <root>.run declared in <root>' type=<root>.Foo origin=null
|
||||
<T>: <root>.Foo
|
||||
fn: FUN_EXPR type=kotlin.Function0<kotlin.Any> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:<root>.Foo
|
||||
BLOCK_BODY
|
||||
VAR name:mm type:<root>.B [val]
|
||||
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.B' type=<root>.B origin=null
|
||||
VAR name:nn type:<root>.C [val]
|
||||
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.C' type=<root>.C origin=null
|
||||
VAR name:c type:<root>.Foo [val]
|
||||
WHEN type=<root>.Foo origin=IF
|
||||
BRANCH
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: GET_VAR 'val mm: <root>.B [val] declared in <root>.foo.<anonymous>' type=<root>.B origin=null
|
||||
BRANCH
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: GET_VAR 'val nn: <root>.C [val] declared in <root>.foo.<anonymous>' type=<root>.C origin=null
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): <root>.Foo declared in <root>.foo'
|
||||
GET_VAR 'val c: <root>.Foo [val] declared in <root>.foo.<anonymous>' type=<root>.Foo origin=null
|
||||
@@ -1,42 +0,0 @@
|
||||
interface A<out T : Any?> {
|
||||
|
||||
}
|
||||
|
||||
interface Foo {
|
||||
|
||||
}
|
||||
|
||||
open class B : Foo, A<B> {
|
||||
constructor() /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
open class C : Foo, A<C> {
|
||||
constructor() /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun <T : Any?> run(fn: Function0<T>): T {
|
||||
return fn.invoke()
|
||||
}
|
||||
|
||||
fun foo(): Any {
|
||||
return run<Foo>(fn = local fun <anonymous>(): Foo {
|
||||
val mm: B = B()
|
||||
val nn: C = C()
|
||||
val c: Foo = when {
|
||||
true -> mm
|
||||
else -> nn
|
||||
}
|
||||
return c
|
||||
}
|
||||
)
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
FILE fqName:<root> fileName:/intersectionType2_OI.kt
|
||||
CLASS INTERFACE name:A modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A<T of <root>.A>
|
||||
TYPE_PARAMETER name:T index:0 variance:out superTypes:[kotlin.Any?]
|
||||
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
|
||||
CLASS INTERFACE name:Foo modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Foo
|
||||
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
|
||||
CLASS CLASS name:B modality:OPEN visibility:public superTypes:[<root>.Foo; <root>.A<<root>.B>]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.B
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.B [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:B modality:OPEN visibility:public superTypes:[<root>.Foo; <root>.A<<root>.B>]'
|
||||
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 [fake_override,operator] declared in <root>.Foo
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.A
|
||||
$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 [fake_override] declared in <root>.Foo
|
||||
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.A
|
||||
$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 [fake_override] declared in <root>.Foo
|
||||
public open fun toString (): kotlin.String [fake_override] declared in <root>.A
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
CLASS CLASS name:C modality:OPEN visibility:public superTypes:[<root>.Foo; <root>.A<<root>.C>]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.C
|
||||
CONSTRUCTOR visibility:public <> () returnType:<root>.C [primary]
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:C modality:OPEN visibility:public superTypes:[<root>.Foo; <root>.A<<root>.C>]'
|
||||
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 [fake_override,operator] declared in <root>.Foo
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.A
|
||||
$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 [fake_override] declared in <root>.Foo
|
||||
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.A
|
||||
$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 [fake_override] declared in <root>.Foo
|
||||
public open fun toString (): kotlin.String [fake_override] declared in <root>.A
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN name:run visibility:public modality:FINAL <T> (fn:kotlin.Function0<T of <root>.run>) returnType:T of <root>.run
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
VALUE_PARAMETER name:fn index:0 type:kotlin.Function0<T of <root>.run>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun run <T> (fn: kotlin.Function0<T of <root>.run>): T of <root>.run declared in <root>'
|
||||
CALL 'public abstract fun invoke (): R of kotlin.Function0 [operator] declared in kotlin.Function0' type=T of <root>.run origin=INVOKE
|
||||
$this: GET_VAR 'fn: kotlin.Function0<T of <root>.run> declared in <root>.run' type=kotlin.Function0<T of <root>.run> origin=VARIABLE_AS_FUNCTION
|
||||
FUN name:foo visibility:public modality:FINAL <> () returnType:kotlin.Any
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun foo (): kotlin.Any declared in <root>'
|
||||
CALL 'public final fun run <T> (fn: kotlin.Function0<T of <root>.run>): T of <root>.run declared in <root>' type=kotlin.Any origin=null
|
||||
<T>: kotlin.Any
|
||||
fn: FUN_EXPR type=kotlin.Function0<kotlin.Any> origin=LAMBDA
|
||||
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> () returnType:kotlin.Any
|
||||
BLOCK_BODY
|
||||
VAR name:mm type:<root>.B [val]
|
||||
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.B' type=<root>.B origin=null
|
||||
VAR name:nn type:<root>.C [val]
|
||||
CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.C' type=<root>.C origin=null
|
||||
VAR name:c type:kotlin.Any [val]
|
||||
WHEN type=kotlin.Any origin=IF
|
||||
BRANCH
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: GET_VAR 'val mm: <root>.B [val] declared in <root>.foo.<anonymous>' type=<root>.B origin=null
|
||||
BRANCH
|
||||
if: CONST Boolean type=kotlin.Boolean value=true
|
||||
then: GET_VAR 'val nn: <root>.C [val] declared in <root>.foo.<anonymous>' type=<root>.C origin=null
|
||||
RETURN type=kotlin.Nothing from='local final fun <anonymous> (): kotlin.Any declared in <root>.foo'
|
||||
GET_VAR 'val c: kotlin.Any [val] declared in <root>.foo.<anonymous>' type=kotlin.Any origin=null
|
||||
@@ -1,18 +0,0 @@
|
||||
// !LANGUAGE: -NewInference
|
||||
|
||||
interface A<out T>
|
||||
interface Foo
|
||||
|
||||
open class B : Foo, A<B>
|
||||
open class C : Foo, A<C>
|
||||
|
||||
fun <T> run(fn: () -> T) = fn()
|
||||
|
||||
fun foo() = run {
|
||||
val mm = B()
|
||||
val nn = C()
|
||||
|
||||
val c = if (true) mm else nn
|
||||
|
||||
c
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
interface A<out T : Any?> {
|
||||
|
||||
}
|
||||
|
||||
interface Foo {
|
||||
|
||||
}
|
||||
|
||||
open class B : Foo, A<B> {
|
||||
constructor() /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
open class C : Foo, A<C> {
|
||||
constructor() /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun <T : Any?> run(fn: Function0<T>): T {
|
||||
return fn.invoke()
|
||||
}
|
||||
|
||||
fun foo(): Any {
|
||||
return run<Any>(fn = local fun <anonymous>(): Any {
|
||||
val mm: B = B()
|
||||
val nn: C = C()
|
||||
val c: Any = when {
|
||||
true -> mm
|
||||
else -> nn
|
||||
}
|
||||
return c
|
||||
}
|
||||
)
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
FILE fqName:<root> fileName:/intersectionType3_NI.kt
|
||||
FILE fqName:<root> fileName:/intersectionType3.kt
|
||||
CLASS INTERFACE name:In modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.In<T of <root>.In>
|
||||
TYPE_PARAMETER name:T index:0 variance:in superTypes:[kotlin.Any?]
|
||||
-1
@@ -1,5 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +NewInference
|
||||
|
||||
interface In<in T>
|
||||
|
||||
@@ -1,200 +0,0 @@
|
||||
FILE fqName:<root> fileName:/intersectionType3_OI.kt
|
||||
CLASS INTERFACE name:In modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.In<T of <root>.In>
|
||||
TYPE_PARAMETER name:T index:0 variance:in superTypes:[kotlin.Any?]
|
||||
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:isT visibility:public modality:FINAL <T> ($receiver:<root>.In<T of <root>.isT>) returnType:kotlin.Boolean [inline]
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
$receiver: VALUE_PARAMETER name:<this> type:<root>.In<T of <root>.isT>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun isT <T> (): kotlin.Boolean [inline] declared in <root>'
|
||||
TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=T of <root>.isT
|
||||
GET_VAR '<this>: <root>.In<T of <root>.isT> declared in <root>.isT' type=<root>.In<T of <root>.isT> origin=null
|
||||
FUN name:asT visibility:public modality:FINAL <T> ($receiver:<root>.In<T of <root>.asT>) returnType:kotlin.Unit [inline]
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
$receiver: VALUE_PARAMETER name:<this> type:<root>.In<T of <root>.asT>
|
||||
BLOCK_BODY
|
||||
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||
TYPE_OP type=T of <root>.asT origin=CAST typeOperand=T of <root>.asT
|
||||
GET_VAR '<this>: <root>.In<T of <root>.asT> declared in <root>.asT' type=<root>.In<T of <root>.asT> origin=null
|
||||
FUN name:sel visibility:public modality:FINAL <S> (x:S of <root>.sel, y:S of <root>.sel) returnType:S of <root>.sel
|
||||
TYPE_PARAMETER name:S index:0 variance: superTypes:[kotlin.Any?]
|
||||
VALUE_PARAMETER name:x index:0 type:S of <root>.sel
|
||||
VALUE_PARAMETER name:y index:1 type:S of <root>.sel
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun sel <S> (x: S of <root>.sel, y: S of <root>.sel): S of <root>.sel declared in <root>'
|
||||
GET_VAR 'x: S of <root>.sel declared in <root>.sel' type=S of <root>.sel origin=null
|
||||
CLASS INTERFACE name:A modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A
|
||||
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
|
||||
CLASS INTERFACE name:B modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.B
|
||||
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
|
||||
CLASS INTERFACE name:A1 modality:ABSTRACT visibility:public superTypes:[<root>.A]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A1
|
||||
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 [fake_override,operator] declared in <root>.A
|
||||
$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 [fake_override] declared in <root>.A
|
||||
$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 [fake_override] declared in <root>.A
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
CLASS INTERFACE name:A2 modality:ABSTRACT visibility:public superTypes:[<root>.A]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A2
|
||||
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 [fake_override,operator] declared in <root>.A
|
||||
$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 [fake_override] declared in <root>.A
|
||||
$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 [fake_override] declared in <root>.A
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
CLASS INTERFACE name:Z1 modality:ABSTRACT visibility:public superTypes:[<root>.A; <root>.B]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Z1
|
||||
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 [fake_override,operator] declared in <root>.A
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.B
|
||||
$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 [fake_override] declared in <root>.A
|
||||
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.B
|
||||
$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 [fake_override] declared in <root>.A
|
||||
public open fun toString (): kotlin.String [fake_override] declared in <root>.B
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
CLASS INTERFACE name:Z2 modality:ABSTRACT visibility:public superTypes:[<root>.A; <root>.B]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Z2
|
||||
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 [fake_override,operator] declared in <root>.A
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.B
|
||||
$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 [fake_override] declared in <root>.A
|
||||
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.B
|
||||
$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 [fake_override] declared in <root>.A
|
||||
public open fun toString (): kotlin.String [fake_override] declared in <root>.B
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN name:testInIs1 visibility:public modality:FINAL <> (x:<root>.In<<root>.A>, y:<root>.In<<root>.B>) returnType:kotlin.Boolean
|
||||
VALUE_PARAMETER name:x index:0 type:<root>.In<<root>.A>
|
||||
VALUE_PARAMETER name:y index:1 type:<root>.In<<root>.B>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun testInIs1 (x: <root>.In<<root>.A>, y: <root>.In<<root>.B>): kotlin.Boolean declared in <root>'
|
||||
CALL 'public final fun isT <T> (): kotlin.Boolean [inline] declared in <root>' type=kotlin.Boolean origin=null
|
||||
<T>: kotlin.Any
|
||||
$receiver: CALL 'public final fun sel <S> (x: S of <root>.sel, y: S of <root>.sel): S of <root>.sel declared in <root>' type=<root>.In<kotlin.Nothing> origin=null
|
||||
<S>: <root>.In<kotlin.Nothing>
|
||||
x: GET_VAR 'x: <root>.In<<root>.A> declared in <root>.testInIs1' type=<root>.In<<root>.A> origin=null
|
||||
y: GET_VAR 'y: <root>.In<<root>.B> declared in <root>.testInIs1' type=<root>.In<<root>.B> origin=null
|
||||
FUN name:testInIs2 visibility:public modality:FINAL <> (x:<root>.In<<root>.Z1>, y:<root>.In<<root>.Z2>) returnType:kotlin.Boolean
|
||||
VALUE_PARAMETER name:x index:0 type:<root>.In<<root>.Z1>
|
||||
VALUE_PARAMETER name:y index:1 type:<root>.In<<root>.Z2>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun testInIs2 (x: <root>.In<<root>.Z1>, y: <root>.In<<root>.Z2>): kotlin.Boolean declared in <root>'
|
||||
CALL 'public final fun isT <T> (): kotlin.Boolean [inline] declared in <root>' type=kotlin.Boolean origin=null
|
||||
<T>: kotlin.Any
|
||||
$receiver: CALL 'public final fun sel <S> (x: S of <root>.sel, y: S of <root>.sel): S of <root>.sel declared in <root>' type=<root>.In<kotlin.Nothing> origin=null
|
||||
<S>: <root>.In<kotlin.Nothing>
|
||||
x: GET_VAR 'x: <root>.In<<root>.Z1> declared in <root>.testInIs2' type=<root>.In<<root>.Z1> origin=null
|
||||
y: GET_VAR 'y: <root>.In<<root>.Z2> declared in <root>.testInIs2' type=<root>.In<<root>.Z2> origin=null
|
||||
FUN name:testInIs3 visibility:public modality:FINAL <> (x:<root>.In<<root>.A1>, y:<root>.In<<root>.A2>) returnType:kotlin.Boolean
|
||||
VALUE_PARAMETER name:x index:0 type:<root>.In<<root>.A1>
|
||||
VALUE_PARAMETER name:y index:1 type:<root>.In<<root>.A2>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun testInIs3 (x: <root>.In<<root>.A1>, y: <root>.In<<root>.A2>): kotlin.Boolean declared in <root>'
|
||||
CALL 'public final fun isT <T> (): kotlin.Boolean [inline] declared in <root>' type=kotlin.Boolean origin=null
|
||||
<T>: <root>.A
|
||||
$receiver: CALL 'public final fun sel <S> (x: S of <root>.sel, y: S of <root>.sel): S of <root>.sel declared in <root>' type=<root>.In<kotlin.Nothing> origin=null
|
||||
<S>: <root>.In<kotlin.Nothing>
|
||||
x: GET_VAR 'x: <root>.In<<root>.A1> declared in <root>.testInIs3' type=<root>.In<<root>.A1> origin=null
|
||||
y: GET_VAR 'y: <root>.In<<root>.A2> declared in <root>.testInIs3' type=<root>.In<<root>.A2> origin=null
|
||||
FUN name:testInAs1 visibility:public modality:FINAL <> (x:<root>.In<<root>.A>, y:<root>.In<<root>.B>) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:x index:0 type:<root>.In<<root>.A>
|
||||
VALUE_PARAMETER name:y index:1 type:<root>.In<<root>.B>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun testInAs1 (x: <root>.In<<root>.A>, y: <root>.In<<root>.B>): kotlin.Unit declared in <root>'
|
||||
CALL 'public final fun asT <T> (): kotlin.Unit [inline] declared in <root>' type=kotlin.Unit origin=null
|
||||
<T>: kotlin.Any
|
||||
$receiver: CALL 'public final fun sel <S> (x: S of <root>.sel, y: S of <root>.sel): S of <root>.sel declared in <root>' type=<root>.In<kotlin.Nothing> origin=null
|
||||
<S>: <root>.In<kotlin.Nothing>
|
||||
x: GET_VAR 'x: <root>.In<<root>.A> declared in <root>.testInAs1' type=<root>.In<<root>.A> origin=null
|
||||
y: GET_VAR 'y: <root>.In<<root>.B> declared in <root>.testInAs1' type=<root>.In<<root>.B> origin=null
|
||||
FUN name:testInAs2 visibility:public modality:FINAL <> (x:<root>.In<<root>.Z1>, y:<root>.In<<root>.Z2>) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:x index:0 type:<root>.In<<root>.Z1>
|
||||
VALUE_PARAMETER name:y index:1 type:<root>.In<<root>.Z2>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun testInAs2 (x: <root>.In<<root>.Z1>, y: <root>.In<<root>.Z2>): kotlin.Unit declared in <root>'
|
||||
CALL 'public final fun asT <T> (): kotlin.Unit [inline] declared in <root>' type=kotlin.Unit origin=null
|
||||
<T>: kotlin.Any
|
||||
$receiver: CALL 'public final fun sel <S> (x: S of <root>.sel, y: S of <root>.sel): S of <root>.sel declared in <root>' type=<root>.In<kotlin.Nothing> origin=null
|
||||
<S>: <root>.In<kotlin.Nothing>
|
||||
x: GET_VAR 'x: <root>.In<<root>.Z1> declared in <root>.testInAs2' type=<root>.In<<root>.Z1> origin=null
|
||||
y: GET_VAR 'y: <root>.In<<root>.Z2> declared in <root>.testInAs2' type=<root>.In<<root>.Z2> origin=null
|
||||
FUN name:testInAs3 visibility:public modality:FINAL <> (x:<root>.In<<root>.A1>, y:<root>.In<<root>.A2>) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:x index:0 type:<root>.In<<root>.A1>
|
||||
VALUE_PARAMETER name:y index:1 type:<root>.In<<root>.A2>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun testInAs3 (x: <root>.In<<root>.A1>, y: <root>.In<<root>.A2>): kotlin.Unit declared in <root>'
|
||||
CALL 'public final fun asT <T> (): kotlin.Unit [inline] declared in <root>' type=kotlin.Unit origin=null
|
||||
<T>: <root>.A
|
||||
$receiver: CALL 'public final fun sel <S> (x: S of <root>.sel, y: S of <root>.sel): S of <root>.sel declared in <root>' type=<root>.In<kotlin.Nothing> origin=null
|
||||
<S>: <root>.In<kotlin.Nothing>
|
||||
x: GET_VAR 'x: <root>.In<<root>.A1> declared in <root>.testInAs3' type=<root>.In<<root>.A1> origin=null
|
||||
y: GET_VAR 'y: <root>.In<<root>.A2> declared in <root>.testInAs3' type=<root>.In<<root>.A2> origin=null
|
||||
@@ -1,63 +0,0 @@
|
||||
interface In<in T : Any?> {
|
||||
|
||||
}
|
||||
|
||||
inline fun <reified T : Any?> In<T>.isT(): Boolean {
|
||||
return <this> is T
|
||||
}
|
||||
|
||||
inline fun <reified T : Any?> In<T>.asT() {
|
||||
<this> as T /*~> Unit */
|
||||
}
|
||||
|
||||
fun <S : Any?> sel(x: S, y: S): S {
|
||||
return x
|
||||
}
|
||||
|
||||
interface A {
|
||||
|
||||
}
|
||||
|
||||
interface B {
|
||||
|
||||
}
|
||||
|
||||
interface A1 : A {
|
||||
|
||||
}
|
||||
|
||||
interface A2 : A {
|
||||
|
||||
}
|
||||
|
||||
interface Z1 : A, B {
|
||||
|
||||
}
|
||||
|
||||
interface Z2 : A, B {
|
||||
|
||||
}
|
||||
|
||||
fun testInIs1(x: In<A>, y: In<B>): Boolean {
|
||||
return sel<In<Nothing>>(x = x, y = y).isT<Any>()
|
||||
}
|
||||
|
||||
fun testInIs2(x: In<Z1>, y: In<Z2>): Boolean {
|
||||
return sel<In<Nothing>>(x = x, y = y).isT<Any>()
|
||||
}
|
||||
|
||||
fun testInIs3(x: In<A1>, y: In<A2>): Boolean {
|
||||
return sel<In<Nothing>>(x = x, y = y).isT<A>()
|
||||
}
|
||||
|
||||
fun testInAs1(x: In<A>, y: In<B>) {
|
||||
return sel<In<Nothing>>(x = x, y = y).asT<Any>()
|
||||
}
|
||||
|
||||
fun testInAs2(x: In<Z1>, y: In<Z2>) {
|
||||
return sel<In<Nothing>>(x = x, y = y).asT<Any>()
|
||||
}
|
||||
|
||||
fun testInAs3(x: In<A1>, y: In<A2>) {
|
||||
return sel<In<Nothing>>(x = x, y = y).asT<A>()
|
||||
}
|
||||
@@ -1,200 +0,0 @@
|
||||
FILE fqName:<root> fileName:/intersectionType3_OI.kt
|
||||
CLASS INTERFACE name:In modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.In<T of <root>.In>
|
||||
TYPE_PARAMETER name:T index:0 variance:in superTypes:[kotlin.Any?]
|
||||
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:isT visibility:public modality:FINAL <T> ($receiver:<root>.In<T of <root>.isT>) returnType:kotlin.Boolean [inline]
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
$receiver: VALUE_PARAMETER name:<this> type:<root>.In<T of <root>.isT>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun isT <T> (): kotlin.Boolean [inline] declared in <root>'
|
||||
TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=T of <root>.isT
|
||||
GET_VAR '<this>: <root>.In<T of <root>.isT> declared in <root>.isT' type=<root>.In<T of <root>.isT> origin=null
|
||||
FUN name:asT visibility:public modality:FINAL <T> ($receiver:<root>.In<T of <root>.asT>) returnType:kotlin.Unit [inline]
|
||||
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?]
|
||||
$receiver: VALUE_PARAMETER name:<this> type:<root>.In<T of <root>.asT>
|
||||
BLOCK_BODY
|
||||
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
|
||||
TYPE_OP type=T of <root>.asT origin=CAST typeOperand=T of <root>.asT
|
||||
GET_VAR '<this>: <root>.In<T of <root>.asT> declared in <root>.asT' type=<root>.In<T of <root>.asT> origin=null
|
||||
FUN name:sel visibility:public modality:FINAL <S> (x:S of <root>.sel, y:S of <root>.sel) returnType:S of <root>.sel
|
||||
TYPE_PARAMETER name:S index:0 variance: superTypes:[kotlin.Any?]
|
||||
VALUE_PARAMETER name:x index:0 type:S of <root>.sel
|
||||
VALUE_PARAMETER name:y index:1 type:S of <root>.sel
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun sel <S> (x: S of <root>.sel, y: S of <root>.sel): S of <root>.sel declared in <root>'
|
||||
GET_VAR 'x: S of <root>.sel declared in <root>.sel' type=S of <root>.sel origin=null
|
||||
CLASS INTERFACE name:A modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A
|
||||
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
|
||||
CLASS INTERFACE name:B modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.B
|
||||
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
|
||||
CLASS INTERFACE name:A1 modality:ABSTRACT visibility:public superTypes:[<root>.A]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A1
|
||||
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 [fake_override,operator] declared in <root>.A
|
||||
$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 [fake_override] declared in <root>.A
|
||||
$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 [fake_override] declared in <root>.A
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
CLASS INTERFACE name:A2 modality:ABSTRACT visibility:public superTypes:[<root>.A]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.A2
|
||||
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 [fake_override,operator] declared in <root>.A
|
||||
$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 [fake_override] declared in <root>.A
|
||||
$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 [fake_override] declared in <root>.A
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
CLASS INTERFACE name:Z1 modality:ABSTRACT visibility:public superTypes:[<root>.A; <root>.B]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Z1
|
||||
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 [fake_override,operator] declared in <root>.A
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.B
|
||||
$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 [fake_override] declared in <root>.A
|
||||
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.B
|
||||
$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 [fake_override] declared in <root>.A
|
||||
public open fun toString (): kotlin.String [fake_override] declared in <root>.B
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
CLASS INTERFACE name:Z2 modality:ABSTRACT visibility:public superTypes:[<root>.A; <root>.B]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Z2
|
||||
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 [fake_override,operator] declared in <root>.A
|
||||
public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in <root>.B
|
||||
$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 [fake_override] declared in <root>.A
|
||||
public open fun hashCode (): kotlin.Int [fake_override] declared in <root>.B
|
||||
$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 [fake_override] declared in <root>.A
|
||||
public open fun toString (): kotlin.String [fake_override] declared in <root>.B
|
||||
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
|
||||
FUN name:testInIs1 visibility:public modality:FINAL <> (x:<root>.In<<root>.A>, y:<root>.In<<root>.B>) returnType:kotlin.Boolean
|
||||
VALUE_PARAMETER name:x index:0 type:<root>.In<<root>.A>
|
||||
VALUE_PARAMETER name:y index:1 type:<root>.In<<root>.B>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun testInIs1 (x: <root>.In<<root>.A>, y: <root>.In<<root>.B>): kotlin.Boolean declared in <root>'
|
||||
CALL 'public final fun isT <T> (): kotlin.Boolean [inline] declared in <root>' type=kotlin.Boolean origin=null
|
||||
<T>: kotlin.Any
|
||||
$receiver: CALL 'public final fun sel <S> (x: S of <root>.sel, y: S of <root>.sel): S of <root>.sel declared in <root>' type=<root>.In<kotlin.Any> origin=null
|
||||
<S>: <root>.In<kotlin.Any>
|
||||
x: GET_VAR 'x: <root>.In<<root>.A> declared in <root>.testInIs1' type=<root>.In<<root>.A> origin=null
|
||||
y: GET_VAR 'y: <root>.In<<root>.B> declared in <root>.testInIs1' type=<root>.In<<root>.B> origin=null
|
||||
FUN name:testInIs2 visibility:public modality:FINAL <> (x:<root>.In<<root>.Z1>, y:<root>.In<<root>.Z2>) returnType:kotlin.Boolean
|
||||
VALUE_PARAMETER name:x index:0 type:<root>.In<<root>.Z1>
|
||||
VALUE_PARAMETER name:y index:1 type:<root>.In<<root>.Z2>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun testInIs2 (x: <root>.In<<root>.Z1>, y: <root>.In<<root>.Z2>): kotlin.Boolean declared in <root>'
|
||||
CALL 'public final fun isT <T> (): kotlin.Boolean [inline] declared in <root>' type=kotlin.Boolean origin=null
|
||||
<T>: kotlin.Any
|
||||
$receiver: CALL 'public final fun sel <S> (x: S of <root>.sel, y: S of <root>.sel): S of <root>.sel declared in <root>' type=<root>.In<kotlin.Any> origin=null
|
||||
<S>: <root>.In<kotlin.Any>
|
||||
x: GET_VAR 'x: <root>.In<<root>.Z1> declared in <root>.testInIs2' type=<root>.In<<root>.Z1> origin=null
|
||||
y: GET_VAR 'y: <root>.In<<root>.Z2> declared in <root>.testInIs2' type=<root>.In<<root>.Z2> origin=null
|
||||
FUN name:testInIs3 visibility:public modality:FINAL <> (x:<root>.In<<root>.A1>, y:<root>.In<<root>.A2>) returnType:kotlin.Boolean
|
||||
VALUE_PARAMETER name:x index:0 type:<root>.In<<root>.A1>
|
||||
VALUE_PARAMETER name:y index:1 type:<root>.In<<root>.A2>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun testInIs3 (x: <root>.In<<root>.A1>, y: <root>.In<<root>.A2>): kotlin.Boolean declared in <root>'
|
||||
CALL 'public final fun isT <T> (): kotlin.Boolean [inline] declared in <root>' type=kotlin.Boolean origin=null
|
||||
<T>: <root>.A
|
||||
$receiver: CALL 'public final fun sel <S> (x: S of <root>.sel, y: S of <root>.sel): S of <root>.sel declared in <root>' type=<root>.In<<root>.A> origin=null
|
||||
<S>: <root>.In<<root>.A>
|
||||
x: GET_VAR 'x: <root>.In<<root>.A1> declared in <root>.testInIs3' type=<root>.In<<root>.A1> origin=null
|
||||
y: GET_VAR 'y: <root>.In<<root>.A2> declared in <root>.testInIs3' type=<root>.In<<root>.A2> origin=null
|
||||
FUN name:testInAs1 visibility:public modality:FINAL <> (x:<root>.In<<root>.A>, y:<root>.In<<root>.B>) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:x index:0 type:<root>.In<<root>.A>
|
||||
VALUE_PARAMETER name:y index:1 type:<root>.In<<root>.B>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun testInAs1 (x: <root>.In<<root>.A>, y: <root>.In<<root>.B>): kotlin.Unit declared in <root>'
|
||||
CALL 'public final fun asT <T> (): kotlin.Unit [inline] declared in <root>' type=kotlin.Unit origin=null
|
||||
<T>: kotlin.Any
|
||||
$receiver: CALL 'public final fun sel <S> (x: S of <root>.sel, y: S of <root>.sel): S of <root>.sel declared in <root>' type=<root>.In<kotlin.Any> origin=null
|
||||
<S>: <root>.In<kotlin.Any>
|
||||
x: GET_VAR 'x: <root>.In<<root>.A> declared in <root>.testInAs1' type=<root>.In<<root>.A> origin=null
|
||||
y: GET_VAR 'y: <root>.In<<root>.B> declared in <root>.testInAs1' type=<root>.In<<root>.B> origin=null
|
||||
FUN name:testInAs2 visibility:public modality:FINAL <> (x:<root>.In<<root>.Z1>, y:<root>.In<<root>.Z2>) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:x index:0 type:<root>.In<<root>.Z1>
|
||||
VALUE_PARAMETER name:y index:1 type:<root>.In<<root>.Z2>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun testInAs2 (x: <root>.In<<root>.Z1>, y: <root>.In<<root>.Z2>): kotlin.Unit declared in <root>'
|
||||
CALL 'public final fun asT <T> (): kotlin.Unit [inline] declared in <root>' type=kotlin.Unit origin=null
|
||||
<T>: kotlin.Any
|
||||
$receiver: CALL 'public final fun sel <S> (x: S of <root>.sel, y: S of <root>.sel): S of <root>.sel declared in <root>' type=<root>.In<kotlin.Any> origin=null
|
||||
<S>: <root>.In<kotlin.Any>
|
||||
x: GET_VAR 'x: <root>.In<<root>.Z1> declared in <root>.testInAs2' type=<root>.In<<root>.Z1> origin=null
|
||||
y: GET_VAR 'y: <root>.In<<root>.Z2> declared in <root>.testInAs2' type=<root>.In<<root>.Z2> origin=null
|
||||
FUN name:testInAs3 visibility:public modality:FINAL <> (x:<root>.In<<root>.A1>, y:<root>.In<<root>.A2>) returnType:kotlin.Unit
|
||||
VALUE_PARAMETER name:x index:0 type:<root>.In<<root>.A1>
|
||||
VALUE_PARAMETER name:y index:1 type:<root>.In<<root>.A2>
|
||||
BLOCK_BODY
|
||||
RETURN type=kotlin.Nothing from='public final fun testInAs3 (x: <root>.In<<root>.A1>, y: <root>.In<<root>.A2>): kotlin.Unit declared in <root>'
|
||||
CALL 'public final fun asT <T> (): kotlin.Unit [inline] declared in <root>' type=kotlin.Unit origin=null
|
||||
<T>: <root>.A
|
||||
$receiver: CALL 'public final fun sel <S> (x: S of <root>.sel, y: S of <root>.sel): S of <root>.sel declared in <root>' type=<root>.In<<root>.A> origin=null
|
||||
<S>: <root>.In<<root>.A>
|
||||
x: GET_VAR 'x: <root>.In<<root>.A1> declared in <root>.testInAs3' type=<root>.In<<root>.A1> origin=null
|
||||
y: GET_VAR 'y: <root>.In<<root>.A2> declared in <root>.testInAs3' type=<root>.In<<root>.A2> origin=null
|
||||
@@ -1,32 +0,0 @@
|
||||
// !LANGUAGE: -NewInference
|
||||
|
||||
interface In<in T>
|
||||
|
||||
inline fun <reified T> In<T>.isT(): Boolean =
|
||||
this is T
|
||||
|
||||
inline fun <reified T> In<T>.asT() { this as T }
|
||||
|
||||
fun <S> sel(x: S, y: S): S = x
|
||||
|
||||
interface A
|
||||
interface B
|
||||
|
||||
interface A1 : A
|
||||
interface A2 : A
|
||||
|
||||
interface Z1 : A, B
|
||||
interface Z2 : A, B
|
||||
|
||||
|
||||
fun testInIs1(x: In<A>, y: In<B>) = sel(x, y).isT()
|
||||
|
||||
fun testInIs2(x: In<Z1>, y: In<Z2>) = sel(x, y).isT()
|
||||
|
||||
fun testInIs3(x: In<A1>, y: In<A2>) = sel(x, y).isT()
|
||||
|
||||
fun testInAs1(x: In<A>, y: In<B>) = sel(x, y).asT()
|
||||
|
||||
fun testInAs2(x: In<Z1>, y: In<Z2>) = sel(x, y).asT()
|
||||
|
||||
fun testInAs3(x: In<A1>, y: In<A2>) = sel(x, y).asT()
|
||||
@@ -1,63 +0,0 @@
|
||||
interface In<in T : Any?> {
|
||||
|
||||
}
|
||||
|
||||
inline fun <reified T : Any?> In<T>.isT(): Boolean {
|
||||
return <this> is T
|
||||
}
|
||||
|
||||
inline fun <reified T : Any?> In<T>.asT() {
|
||||
<this> as T /*~> Unit */
|
||||
}
|
||||
|
||||
fun <S : Any?> sel(x: S, y: S): S {
|
||||
return x
|
||||
}
|
||||
|
||||
interface A {
|
||||
|
||||
}
|
||||
|
||||
interface B {
|
||||
|
||||
}
|
||||
|
||||
interface A1 : A {
|
||||
|
||||
}
|
||||
|
||||
interface A2 : A {
|
||||
|
||||
}
|
||||
|
||||
interface Z1 : A, B {
|
||||
|
||||
}
|
||||
|
||||
interface Z2 : A, B {
|
||||
|
||||
}
|
||||
|
||||
fun testInIs1(x: In<A>, y: In<B>): Boolean {
|
||||
return sel<In<Any>>(x = x, y = y).isT<Any>()
|
||||
}
|
||||
|
||||
fun testInIs2(x: In<Z1>, y: In<Z2>): Boolean {
|
||||
return sel<In<Any>>(x = x, y = y).isT<Any>()
|
||||
}
|
||||
|
||||
fun testInIs3(x: In<A1>, y: In<A2>): Boolean {
|
||||
return sel<In<A>>(x = x, y = y).isT<A>()
|
||||
}
|
||||
|
||||
fun testInAs1(x: In<A>, y: In<B>) {
|
||||
return sel<In<Any>>(x = x, y = y).asT<Any>()
|
||||
}
|
||||
|
||||
fun testInAs2(x: In<Z1>, y: In<Z2>) {
|
||||
return sel<In<Any>>(x = x, y = y).asT<Any>()
|
||||
}
|
||||
|
||||
fun testInAs3(x: In<A1>, y: In<A2>) {
|
||||
return sel<In<A>>(x = x, y = y).asT<A>()
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
FILE fqName:<root> fileName:/localVariableOfIntersectionType_NI.kt
|
||||
FILE fqName:<root> fileName:/localVariableOfIntersectionType.kt
|
||||
CLASS INTERFACE name:In modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.In<T of <root>.In>
|
||||
TYPE_PARAMETER name:T index:0 variance:in superTypes:[kotlin.Any?]
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
FILE fqName:<root> fileName:/localVariableOfIntersectionType_NI.kt
|
||||
FILE fqName:<root> fileName:/localVariableOfIntersectionType.kt
|
||||
CLASS INTERFACE name:In modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.In<T of <root>.In>
|
||||
TYPE_PARAMETER name:T index:0 variance:in superTypes:[kotlin.Any?]
|
||||
@@ -0,0 +1,25 @@
|
||||
interface In<in T>
|
||||
|
||||
interface Inv<T> {
|
||||
val t: T
|
||||
}
|
||||
|
||||
interface Z {
|
||||
fun <T> create(x: In<T>, y: In<T>): Inv<T>
|
||||
}
|
||||
|
||||
interface IA {
|
||||
fun foo()
|
||||
}
|
||||
|
||||
interface IB {
|
||||
fun bar()
|
||||
}
|
||||
|
||||
fun test(a: In<IA>, b: In<IB>, z: Z) {
|
||||
z.create(a, b).t.foo()
|
||||
z.create(a, b).t.bar()
|
||||
val t = z.create(a, b).t
|
||||
t.foo()
|
||||
t.bar()
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// With -NewInference we have
|
||||
// TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS: Type inference failed: Cannot infer type parameter T in fun <T> create(x: In<T>, y: In<T>): Inv<T>
|
||||
// None of the following substitutions
|
||||
// (In<IA>,In<IA>)
|
||||
// (In<IB>,In<IB>)
|
||||
// can be applied to
|
||||
// (In<IA>,In<IB>)
|
||||
|
||||
interface In<in T>
|
||||
|
||||
interface Inv<T> {
|
||||
val t: T
|
||||
}
|
||||
|
||||
interface Z {
|
||||
fun <T> create(x: In<T>, y: In<T>): Inv<T>
|
||||
}
|
||||
|
||||
interface IA {
|
||||
fun foo()
|
||||
}
|
||||
|
||||
interface IB {
|
||||
fun bar()
|
||||
}
|
||||
|
||||
fun test(a: In<IA>, b: In<IB>, z: Z) {
|
||||
z.create(a, b).t.foo()
|
||||
z.create(a, b).t.bar()
|
||||
val t = z.create(a, b).t
|
||||
t.foo()
|
||||
t.bar()
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// TARGET_BACKEND: JVM
|
||||
// FILE: receiverOfIntersectionType.kt
|
||||
|
||||
@@ -38,4 +37,4 @@ public class Java {
|
||||
public static A a() { return new A(); }
|
||||
public static B b() { return new B(); }
|
||||
public static <T> T id(T x) { return x; }
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
FILE fqName:<root> fileName:/starProjection_OI.kt
|
||||
FILE fqName:<root> fileName:/starProjection.kt
|
||||
CLASS INTERFACE name:Continuation modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Continuation<T of <root>.Continuation>
|
||||
TYPE_PARAMETER name:T index:0 variance:in superTypes:[kotlin.Any?]
|
||||
+1
-2
@@ -1,8 +1,7 @@
|
||||
// !LANGUAGE: -NewInference
|
||||
// FIR_IDENTICAL
|
||||
|
||||
interface Continuation<in T>
|
||||
|
||||
abstract class C {
|
||||
abstract fun dispatchResumeWithException(exception: Throwable, continuation: Continuation<*>): Boolean
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,10 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
|
||||
// KT-42036
|
||||
|
||||
typealias Action<RenderingT> = (@UnsafeVariance RenderingT) -> Unit
|
||||
// When a typealias is used, the compiler crashes.
|
||||
|
||||
data class Tag<out RenderingT>(val action: Action<RenderingT>)
|
||||
// When no typealias is used, the compiler is fine.
|
||||
//data class Tag<out RenderingT>(val action: (@UnsafeVariance RenderingT) -> Unit)
|
||||
|
||||
fun getTag(): Tag<*> = throw Exception()
|
||||
fun doAction() {
|
||||
// This line crashes the compiler.
|
||||
getTag().action
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user