[FIR2IR] Properly approximate intersection types during fir2ir conversion

^KT-62544 Fixed
This commit is contained in:
Dmitriy Novozhilov
2023-10-16 13:19:40 +03:00
committed by Space Team
parent 8c6da9fddb
commit 9366847e96
52 changed files with 450 additions and 803 deletions
@@ -234,8 +234,11 @@ class Fir2IrTypeConverter(
original.toIrType(typeOrigin).makeNotNull()
}
is ConeIntersectionType -> {
// TODO: add intersectionTypeApproximation
intersectedTypes.first().toIrType(typeOrigin)
val approximated = session.typeApproximator.approximateToSuperType(
this,
TypeApproximatorConfiguration.FrontendToBackendTypesApproximation
)!!
approximated.toIrType(typeOrigin)
}
is ConeStubType -> createErrorType()
is ConeIntegerLiteralType -> createErrorType()
@@ -21025,6 +21025,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
runTest("compiler/testData/codegen/box/inference/intersectionTypeInArguments.kt");
}
@Test
@TestMetadata("intersectionWithInvisibleComponent.kt")
public void testIntersectionWithInvisibleComponent() throws Exception {
runTest("compiler/testData/codegen/box/inference/intersectionWithInvisibleComponent.kt");
}
@Test
@TestMetadata("kt10822.kt")
public void testKt10822() throws Exception {
@@ -21025,6 +21025,12 @@ public class FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated
runTest("compiler/testData/codegen/box/inference/intersectionTypeInArguments.kt");
}
@Test
@TestMetadata("intersectionWithInvisibleComponent.kt")
public void testIntersectionWithInvisibleComponent() throws Exception {
runTest("compiler/testData/codegen/box/inference/intersectionWithInvisibleComponent.kt");
}
@Test
@TestMetadata("kt10822.kt")
public void testKt10822() throws Exception {
@@ -21025,6 +21025,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
runTest("compiler/testData/codegen/box/inference/intersectionTypeInArguments.kt");
}
@Test
@TestMetadata("intersectionWithInvisibleComponent.kt")
public void testIntersectionWithInvisibleComponent() throws Exception {
runTest("compiler/testData/codegen/box/inference/intersectionWithInvisibleComponent.kt");
}
@Test
@TestMetadata("kt10822.kt")
public void testKt10822() throws Exception {
@@ -29,17 +29,9 @@ class TypeTranslatorImpl(
private val typeApproximatorForNI = TypeApproximator(moduleDescriptor.builtIns, languageVersionSettings)
private val typeApproximatorConfiguration =
object : TypeApproximatorConfiguration.AllFlexibleSameValue() {
override val allFlexible: Boolean get() = true
override val errorType: Boolean get() = true
override val integerLiteralConstantType: Boolean get() = true
override val intersectionTypesInContravariantPositions: Boolean get() = true
}
override fun approximateType(type: KotlinType): KotlinType =
substituteAlternativesInPublicType(type).let {
typeApproximatorForNI.approximateToSuperType(it, typeApproximatorConfiguration) ?: it
typeApproximatorForNI.approximateToSuperType(it, TypeApproximatorConfiguration.FrontendToBackendTypesApproximation) ?: it
}
override fun commonSupertype(types: Collection<KotlinType>): KotlinType =
@@ -133,4 +133,11 @@ open class TypeApproximatorConfiguration {
override val allFlexible: Boolean get() = true
override val intersection: IntersectionStrategy = IntersectionStrategy.TO_UPPER_BOUND_IF_SUPERTYPE
}
object FrontendToBackendTypesApproximation : AllFlexibleSameValue() {
override val allFlexible: Boolean get() = true
override val errorType: Boolean get() = true
override val integerLiteralConstantType: Boolean get() = true
override val intersectionTypesInContravariantPositions: Boolean get() = true
}
}
@@ -100,9 +100,9 @@ FILE fqName:<root> fileName:/delegationToIntersectionType.kt
VALUE_PARAMETER name:c index:0 type:<root>.C
VALUE_PARAMETER name:d index:1 type:<root>.D
BLOCK_BODY
VAR name:intersection type:<root>.A [val]
CALL 'public final fun select <T> (a: T of <root>.select, b: T of <root>.select): T of <root>.select declared in <root>' type=<root>.A origin=null
<T>: <root>.A
VAR name:intersection type:kotlin.Any [val]
CALL 'public final fun select <T> (a: T of <root>.select, b: T of <root>.select): T of <root>.select declared in <root>' type=kotlin.Any origin=null
<T>: kotlin.Any
a: GET_VAR 'c: <root>.C declared in <root>.test' type=<root>.C origin=null
b: GET_VAR 'd: <root>.D declared in <root>.test' type=<root>.D origin=null
RETURN type=kotlin.Nothing from='public final fun test (c: <root>.C, d: <root>.D): kotlin.String declared in <root>'
@@ -114,9 +114,9 @@ FILE fqName:<root> fileName:/delegationToIntersectionType.kt
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:<no name provided> modality:FINAL visibility:local superTypes:[<root>.B]'
FIELD DELEGATE name:$$delegate_0 type:<root>.A visibility:private [final]
FIELD DELEGATE name:$$delegate_0 type:kotlin.Any visibility:private [final]
EXPRESSION_BODY
GET_VAR 'val intersection: <root>.A declared in <root>.test' type=<root>.A origin=null
GET_VAR 'val intersection: kotlin.Any declared in <root>.test' type=kotlin.Any origin=null
FUN DELEGATED_MEMBER name:foo visibility:public modality:OPEN <> ($this:<root>.test.<no name provided>) returnType:kotlin.String
overridden:
public abstract fun foo (): kotlin.String declared in <root>.B
@@ -125,7 +125,7 @@ FILE fqName:<root> fileName:/delegationToIntersectionType.kt
RETURN type=kotlin.Nothing from='public open fun foo (): kotlin.String declared in <root>.test.<no name provided>'
CALL 'public abstract fun foo (): kotlin.String declared in <root>.B' type=kotlin.String origin=null
$this: TYPE_OP type=<root>.B origin=IMPLICIT_CAST typeOperand=<root>.B
GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:<root>.A visibility:private [final]' type=<root>.A origin=null
GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:kotlin.Any visibility:private [final]' type=kotlin.Any origin=null
receiver: GET_VAR '<this>: <root>.test.<no name provided> declared in <root>.test.<no name provided>.foo' type=<root>.test.<no name provided> origin=null
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
@@ -104,9 +104,9 @@ FILE fqName:<root> fileName:/delegationToIntersectionType2.kt
VALUE_PARAMETER name:c index:0 type:<root>.C
VALUE_PARAMETER name:d index:1 type:<root>.D
BLOCK_BODY
VAR name:intersection type:<root>.A [val]
CALL 'public final fun select <T> (a: T of <root>.select, b: T of <root>.select): T of <root>.select declared in <root>' type=<root>.A origin=null
<T>: <root>.A
VAR name:intersection type:kotlin.Any [val]
CALL 'public final fun select <T> (a: T of <root>.select, b: T of <root>.select): T of <root>.select declared in <root>' type=kotlin.Any origin=null
<T>: kotlin.Any
a: GET_VAR 'c: <root>.C declared in <root>.test' type=<root>.C origin=null
b: GET_VAR 'd: <root>.D declared in <root>.test' type=<root>.D origin=null
RETURN type=kotlin.Nothing from='public final fun test (c: <root>.C, d: <root>.D): kotlin.String declared in <root>'
@@ -119,9 +119,9 @@ FILE fqName:<root> fileName:/delegationToIntersectionType2.kt
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:<no name provided> modality:FINAL visibility:local superTypes:[<root>.A]'
FIELD DELEGATE name:$$delegate_0 type:<root>.A visibility:private [final]
FIELD DELEGATE name:$$delegate_0 type:kotlin.Any visibility:private [final]
EXPRESSION_BODY
GET_VAR 'val intersection: <root>.A declared in <root>.test' type=<root>.A origin=null
GET_VAR 'val intersection: kotlin.Any declared in <root>.test' type=kotlin.Any origin=null
FUN DELEGATED_MEMBER name:foo visibility:public modality:OPEN <> ($this:<root>.test.<no name provided>) returnType:kotlin.Any
overridden:
public abstract fun foo (): kotlin.Any declared in <root>.A
@@ -130,7 +130,7 @@ FILE fqName:<root> fileName:/delegationToIntersectionType2.kt
RETURN type=kotlin.Nothing from='public open fun foo (): kotlin.Any declared in <root>.test.<no name provided>'
CALL 'public abstract fun foo (): kotlin.String declared in <root>.B' type=kotlin.String origin=null
$this: TYPE_OP type=<root>.B origin=IMPLICIT_CAST typeOperand=<root>.B
GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:<root>.A visibility:private [final]' type=<root>.A origin=null
GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:kotlin.Any visibility:private [final]' type=kotlin.Any origin=null
receiver: GET_VAR '<this>: <root>.test.<no name provided> declared in <root>.test.<no name provided>.foo' type=<root>.test.<no name provided> origin=null
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
@@ -0,0 +1,40 @@
// TARGET_BACKEND: JVM_IR
// ISSUE: KT-62544
// FILE: Base.java
public interface Base {
String get();
}
// FILE: Impl.java
class Impl {}
// FILE: O.java
public class O extends Impl implements Base {
@Override
public String get() { return "O"; }
}
// FILE: K.java
public class K extends Impl implements Base {
@Override
public String get() { return "K"; }
}
// FILE: box.kt
package test
import O
import K
fun <A, B : A, C : A> foo(
b: B,
c: C,
f: (A) -> String
): String {
return f(b) + f(c)
}
fun box(): String {
return foo(O(), K()) { it.get() }
}
@@ -1,51 +0,0 @@
@kotlin.Metadata
public interface A {
// source: 'nonApproxToValidSupertype.kt'
}
@kotlin.Metadata
public interface B {
// source: 'nonApproxToValidSupertype.kt'
}
@kotlin.Metadata
public final class G {
// source: 'nonApproxToValidSupertype.kt'
public method <init>(): void
public final method check(@org.jetbrains.annotations.NotNull p0: IFoo): void
}
@kotlin.Metadata
public interface IFoo {
// source: 'nonApproxToValidSupertype.kt'
public abstract method accept(@org.jetbrains.annotations.NotNull p0: X): void
}
@kotlin.Metadata
final class NonApproxToValidSupertypeKt$test$1 {
// source: 'nonApproxToValidSupertype.kt'
enclosing method NonApproxToValidSupertypeKt.test()V
public final static field INSTANCE: NonApproxToValidSupertypeKt$test$1
inner (anonymous) class NonApproxToValidSupertypeKt$test$1
static method <clinit>(): void
method <init>(): void
public final method accept(p0: X): void
}
@kotlin.Metadata
public final class NonApproxToValidSupertypeKt {
// source: 'nonApproxToValidSupertype.kt'
inner (anonymous) class NonApproxToValidSupertypeKt$test$1
public final static method sel(p0: java.lang.Object, p1: java.lang.Object): java.lang.Object
public final static method test(): void
}
@kotlin.Metadata
public interface X {
// source: 'nonApproxToValidSupertype.kt'
}
@kotlin.Metadata
public interface Z {
// source: 'nonApproxToValidSupertype.kt'
}
@@ -1,6 +1,3 @@
// K1 generates `accept(Object)` and bridge `accept(X)` in the SAM adapter.
// K2 generates `accept(X)` only. It is fine though, because if `check`'s parameter is passed where Z is expected, checkcast is added.
interface X
interface Z
@@ -1,62 +0,0 @@
@kotlin.Metadata
public interface A {
// source: 'nonApproxToValidSupertype2.kt'
}
@kotlin.Metadata
public interface B {
// source: 'nonApproxToValidSupertype2.kt'
}
@kotlin.Metadata
public final class G {
// source: 'nonApproxToValidSupertype2.kt'
public method <init>(): void
public final method check(@org.jetbrains.annotations.NotNull p0: IFoo): void
}
@kotlin.Metadata
public interface IFoo {
// source: 'nonApproxToValidSupertype2.kt'
public abstract method accept(@org.jetbrains.annotations.NotNull p0: U): void
}
@kotlin.Metadata
final class NonApproxToValidSupertype2Kt$test$1 {
// source: 'nonApproxToValidSupertype2.kt'
enclosing method NonApproxToValidSupertype2Kt.test()V
public final static field INSTANCE: NonApproxToValidSupertype2Kt$test$1
inner (anonymous) class NonApproxToValidSupertype2Kt$test$1
static method <clinit>(): void
method <init>(): void
public synthetic bridge method accept(p0: U): void
public final method accept(p0: X): void
}
@kotlin.Metadata
public final class NonApproxToValidSupertype2Kt {
// source: 'nonApproxToValidSupertype2.kt'
inner (anonymous) class NonApproxToValidSupertype2Kt$test$1
public final static method sel(p0: java.lang.Object, p1: java.lang.Object): java.lang.Object
public final static method test(): void
}
@kotlin.Metadata
public interface U {
// source: 'nonApproxToValidSupertype2.kt'
}
@kotlin.Metadata
public interface W {
// source: 'nonApproxToValidSupertype2.kt'
}
@kotlin.Metadata
public interface X {
// source: 'nonApproxToValidSupertype2.kt'
}
@kotlin.Metadata
public interface Z {
// source: 'nonApproxToValidSupertype2.kt'
}
@@ -1,6 +1,3 @@
// K1 generates `accept(Object)` and bridge `accept(U)` in the SAM adapter.
// K2 generates `accept(X)` and bridge `accept(U)`. It is fine though, because if `check`'s parameter is passed where Z or W is expected, checkcast is added.
interface X: U, W
interface Z: U, W
@@ -45,16 +45,16 @@ FILE fqName:<root> fileName:/bangbang.kt
if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.String?
GET_VAR 'a: X of <root>.test4 declared in <root>.test4' type=X of <root>.test4 origin=null
then: TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.String origin=EXCLEXCL
<T0>: kotlin.String
arg0: TYPE_OP type=kotlin.String? origin=IMPLICIT_CAST typeOperand=kotlin.String?
CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.Any origin=EXCLEXCL
<T0>: kotlin.Any
arg0: TYPE_OP type=kotlin.Any? origin=IMPLICIT_CAST typeOperand=kotlin.Any?
GET_VAR 'a: X of <root>.test4 declared in <root>.test4' type=X of <root>.test4 origin=null
WHEN type=kotlin.Unit origin=IF
BRANCH
if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=kotlin.String?
GET_VAR 'a: X of <root>.test4 declared in <root>.test4' type=X of <root>.test4 origin=null
then: CALL 'public final fun useString (s: kotlin.String): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
s: CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.String origin=EXCLEXCL
<T0>: kotlin.String
arg0: TYPE_OP type=kotlin.String origin=IMPLICIT_CAST typeOperand=kotlin.String
s: CALL 'public final fun CHECK_NOT_NULL <T0> (arg0: T0 of kotlin.internal.ir.CHECK_NOT_NULL?): {T0 of kotlin.internal.ir.CHECK_NOT_NULL & Any} declared in kotlin.internal.ir' type=kotlin.Any origin=EXCLEXCL
<T0>: kotlin.Any
arg0: TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any
GET_VAR 'a: X of <root>.test4 declared in <root>.test4' type=X of <root>.test4 origin=null
@@ -21,9 +21,10 @@ fun useString(s: String) {
fun <X : Any?> test4(a: X) {
when {
a is String? -> CHECK_NOT_NULL<String>(arg0 = a /*as String? */) /*~> Unit */
a is String? -> CHECK_NOT_NULL<Any>(arg0 = a /*as Any? */) /*~> Unit */
}
when {
a is String? -> useString(s = CHECK_NOT_NULL<String>(arg0 = a /*as String */))
a is String? -> useString(s = CHECK_NOT_NULL<Any>(arg0 = a /*as Any */))
}
}
@@ -179,16 +179,16 @@ FILE fqName:<root> fileName:/caoWithAdaptationForSam.kt
BLOCK type=kotlin.Unit origin=null
VAR IR_TEMPORARY_VARIABLE name:tmp_6 type:<root>.A [val]
GET_OBJECT 'CLASS OBJECT name:A modality:FINAL visibility:public superTypes:[kotlin.Any]' type=<root>.A
VAR IR_TEMPORARY_VARIABLE name:tmp_7 type:<root>.IFoo [val]
TYPE_OP type=<root>.IFoo origin=IMPLICIT_CAST typeOperand=<root>.IFoo
VAR IR_TEMPORARY_VARIABLE name:tmp_7 type:kotlin.Any [val]
TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any
GET_VAR 'fn: kotlin.Function1<kotlin.Int, kotlin.Unit> declared in <root>.test4' type=kotlin.Function1<kotlin.Int, kotlin.Unit> origin=null
CALL 'public final fun set (i: <root>.IFoo, newValue: kotlin.Int): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
$receiver: GET_VAR 'val tmp_6: <root>.A declared in <root>.test4' type=<root>.A origin=null
i: GET_VAR 'val tmp_7: <root>.IFoo declared in <root>.test4' type=<root>.IFoo origin=null
i: GET_VAR 'val tmp_7: kotlin.Any declared in <root>.test4' type=kotlin.Any origin=null
newValue: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
$this: CALL 'public final fun get (i: <root>.IFoo): kotlin.Int declared in <root>' type=kotlin.Int origin=null
$receiver: GET_VAR 'val tmp_6: <root>.A declared in <root>.test4' type=<root>.A origin=null
i: GET_VAR 'val tmp_7: <root>.IFoo declared in <root>.test4' type=<root>.IFoo origin=null
i: GET_VAR 'val tmp_7: kotlin.Any declared in <root>.test4' type=kotlin.Any origin=null
other: CONST Int type=kotlin.Int value=1
FUN name:test5 visibility:public modality:FINAL <> (a:kotlin.Any) returnType:kotlin.Unit
VALUE_PARAMETER name:a index:0 type:kotlin.Any
@@ -225,14 +225,13 @@ FILE fqName:<root> fileName:/caoWithAdaptationForSam.kt
BLOCK type=kotlin.Unit origin=null
VAR IR_TEMPORARY_VARIABLE name:tmp_10 type:<root>.A [val]
GET_OBJECT 'CLASS OBJECT name:A modality:FINAL visibility:public superTypes:[kotlin.Any]' type=<root>.A
VAR IR_TEMPORARY_VARIABLE name:tmp_11 type:kotlin.Function1<kotlin.Int, kotlin.Unit> [val]
TYPE_OP type=kotlin.Function1<kotlin.Int, kotlin.Unit> origin=IMPLICIT_CAST typeOperand=kotlin.Function1<kotlin.Int, kotlin.Unit>
GET_VAR 'a: kotlin.Any declared in <root>.test6' type=kotlin.Any origin=null
VAR IR_TEMPORARY_VARIABLE name:tmp_11 type:kotlin.Any [val]
GET_VAR 'a: kotlin.Any declared in <root>.test6' type=kotlin.Any origin=null
CALL 'public final fun set (i: <root>.IFoo, newValue: kotlin.Int): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
$receiver: GET_VAR 'val tmp_10: <root>.A declared in <root>.test6' type=<root>.A origin=null
i: GET_VAR 'val tmp_11: kotlin.Function1<kotlin.Int, kotlin.Unit> declared in <root>.test6' type=kotlin.Function1<kotlin.Int, kotlin.Unit> origin=null
i: GET_VAR 'val tmp_11: kotlin.Any declared in <root>.test6' type=kotlin.Any origin=null
newValue: CALL 'public final fun plus (other: kotlin.Int): kotlin.Int declared in kotlin.Int' type=kotlin.Int origin=null
$this: CALL 'public final fun get (i: <root>.IFoo): kotlin.Int declared in <root>' type=kotlin.Int origin=null
$receiver: GET_VAR 'val tmp_10: <root>.A declared in <root>.test6' type=<root>.A origin=null
i: GET_VAR 'val tmp_11: kotlin.Function1<kotlin.Int, kotlin.Unit> declared in <root>.test6' type=kotlin.Function1<kotlin.Int, kotlin.Unit> origin=null
i: GET_VAR 'val tmp_11: kotlin.Any declared in <root>.test6' type=kotlin.Any origin=null
other: CONST Int type=kotlin.Int value=1
@@ -84,7 +84,7 @@ fun test4(fn: Function1<Int, Unit>) {
fn is IFoo -> { // BLOCK
{ // BLOCK
val tmp_6: A = A
val tmp_7: IFoo = fn /*as IFoo */
val tmp_7: Any = fn /*as Any */
tmp_6.set(i = tmp_7, newValue = tmp_6.get(i = tmp_7).plus(other = 1))
}
}
@@ -105,7 +105,7 @@ fun test6(a: Any) {
a /*as Function1<Int, Unit> */ as IFoo /*~> Unit */
{ // BLOCK
val tmp_10: A = A
val tmp_11: Function1<Int, Unit> = a /*as Function1<Int, Unit> */
val tmp_11: Any = a
tmp_10.set(i = tmp_11, newValue = tmp_10.get(i = tmp_11).plus(other = 1))
}
}
@@ -44,7 +44,7 @@ FILE fqName:<root> fileName:/samConversionsWithSmartCasts.kt
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test1' type=kotlin.Function0<kotlin.Unit> origin=null
then: BLOCK type=kotlin.Unit 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=IMPLICIT_CAST typeOperand=<root>.KRunnable
r: TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test1' type=kotlin.Function0<kotlin.Unit> origin=null
FUN name:test2 visibility:public modality:FINAL <> (a:<root>.KRunnable) returnType:kotlin.Unit
VALUE_PARAMETER name:a index:0 type:<root>.KRunnable
@@ -53,7 +53,7 @@ FILE fqName:<root> fileName:/samConversionsWithSmartCasts.kt
TYPE_OP type=kotlin.Function0<kotlin.Unit> origin=CAST typeOperand=kotlin.Function0<kotlin.Unit>
GET_VAR 'a: <root>.KRunnable declared in <root>.test2' type=<root>.KRunnable origin=null
CALL 'public final fun run1 (r: <root>.KRunnable): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
r: TYPE_OP type=kotlin.Function0<kotlin.Unit> origin=IMPLICIT_CAST typeOperand=kotlin.Function0<kotlin.Unit>
r: TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any
GET_VAR 'a: <root>.KRunnable declared in <root>.test2' type=<root>.KRunnable origin=null
FUN name:test3 visibility:public modality:FINAL <> (a:kotlin.Function0<kotlin.Unit>) returnType:kotlin.Unit
VALUE_PARAMETER name:a index:0 type:kotlin.Function0<kotlin.Unit>
@@ -64,9 +64,9 @@ FILE fqName:<root> fileName:/samConversionsWithSmartCasts.kt
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test3' type=kotlin.Function0<kotlin.Unit> origin=null
then: BLOCK type=kotlin.Unit origin=null
CALL 'public final fun run2 (r1: <root>.KRunnable, r2: <root>.KRunnable): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
r1: TYPE_OP type=<root>.KRunnable origin=IMPLICIT_CAST typeOperand=<root>.KRunnable
r1: TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test3' type=kotlin.Function0<kotlin.Unit> origin=null
r2: TYPE_OP type=<root>.KRunnable origin=IMPLICIT_CAST typeOperand=<root>.KRunnable
r2: TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test3' type=kotlin.Function0<kotlin.Unit> origin=null
FUN name:test4 visibility:public modality:FINAL <> (a:kotlin.Function0<kotlin.Unit>, b:kotlin.Function0<kotlin.Unit>) returnType:kotlin.Unit
VALUE_PARAMETER name:a index:0 type:kotlin.Function0<kotlin.Unit>
@@ -78,7 +78,7 @@ FILE fqName:<root> fileName:/samConversionsWithSmartCasts.kt
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test4' type=kotlin.Function0<kotlin.Unit> origin=null
then: BLOCK type=kotlin.Unit origin=null
CALL 'public final fun run2 (r1: <root>.KRunnable, r2: <root>.KRunnable): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
r1: TYPE_OP type=<root>.KRunnable origin=IMPLICIT_CAST typeOperand=<root>.KRunnable
r1: TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test4' type=kotlin.Function0<kotlin.Unit> origin=null
r2: TYPE_OP type=<root>.KRunnable origin=SAM_CONVERSION typeOperand=<root>.KRunnable
GET_VAR 'b: kotlin.Function0<kotlin.Unit> declared in <root>.test4' type=kotlin.Function0<kotlin.Unit> origin=null
@@ -106,8 +106,7 @@ FILE fqName:<root> fileName:/samConversionsWithSmartCasts.kt
TYPE_OP type=<root>.KRunnable origin=IMPLICIT_CAST typeOperand=<root>.KRunnable
GET_VAR 'a: kotlin.Any declared in <root>.test5x' type=kotlin.Any 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=IMPLICIT_CAST typeOperand=<root>.KRunnable
GET_VAR 'a: kotlin.Any declared in <root>.test5x' type=kotlin.Any origin=null
r: GET_VAR 'a: kotlin.Any declared in <root>.test5x' type=kotlin.Any origin=null
FUN name:test6 visibility:public modality:FINAL <> (a:kotlin.Any) returnType:kotlin.Unit
VALUE_PARAMETER name:a index:0 type:kotlin.Any
BLOCK_BODY
@@ -126,7 +125,7 @@ FILE fqName:<root> fileName:/samConversionsWithSmartCasts.kt
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>
TYPE_OP type=kotlin.Function<kotlin.Any> origin=IMPLICIT_CAST typeOperand=kotlin.Function<kotlin.Any>
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>] reified:false
@@ -137,7 +136,7 @@ FILE fqName:<root> fileName:/samConversionsWithSmartCasts.kt
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>
TYPE_OP type=kotlin.Function<kotlin.Any> origin=IMPLICIT_CAST typeOperand=kotlin.Function<kotlin.Any>
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>] reified:false
@@ -20,20 +20,20 @@ fun <T> test0(a: T) where T : KRunnable, T : Function0<Unit> {
fun test1(a: Function0<Unit>) {
when {
a is KRunnable -> { // BLOCK
run1(r = a /*as KRunnable */)
run1(r = a /*as Any */)
}
}
}
fun test2(a: KRunnable) {
a as Function0<Unit> /*~> Unit */
run1(r = a /*as Function0<Unit> */)
run1(r = a /*as Any */)
}
fun test3(a: Function0<Unit>) {
when {
a is KRunnable -> { // BLOCK
run2(r1 = a /*as KRunnable */, r2 = a /*as KRunnable */)
run2(r1 = a /*as Any */, r2 = a /*as Any */)
}
}
}
@@ -41,7 +41,7 @@ fun test3(a: Function0<Unit>) {
fun test4(a: Function0<Unit>, b: Function0<Unit>) {
when {
a is KRunnable -> { // BLOCK
run2(r1 = a /*as KRunnable */, r2 = b /*-> KRunnable */)
run2(r1 = a /*as Any */, r2 = b /*-> KRunnable */)
}
}
}
@@ -58,7 +58,7 @@ fun test5x(a: Any) {
when {
a is KRunnable -> { // BLOCK
a /*as KRunnable */ as Function0<Unit> /*~> Unit */
run1(r = a /*as KRunnable */)
run1(r = a)
}
}
}
@@ -70,12 +70,12 @@ fun test6(a: Any) {
fun test7(a: Function1<Int, Int>) {
a as Function0<Unit> /*~> Unit */
run1(r = a /*as Function0<Unit> */ /*-> KRunnable */)
run1(r = a /*as Function<Any> */ /*-> KRunnable */)
}
fun <T : Function1<Int, Int>> test7a(a: T) {
a as Function0<Unit> /*~> Unit */
run1(r = a /*as Function0<Unit> */ /*-> KRunnable */)
run1(r = a /*as Function<Any> */ /*-> KRunnable */)
}
fun <T> test7b(a: T) where T : Function1<Int, Unit>, T : Function0<Unit> {
@@ -36,11 +36,11 @@ FILE fqName:<root> fileName:/implicitCastToTypeParameter.kt
$receiver: VALUE_PARAMETER name:<this> type:<root>.Foo<T of <root>.<get-asT>>
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-asT> <T> (): T of <root>.<get-asT>? declared in <root>'
WHEN type=T of <root>.<get-asT>? origin=IF
WHEN type=kotlin.Any? origin=IF
BRANCH
if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=T of <root>.<get-asT>
GET_VAR '<this>: <root>.Foo<T of <root>.<get-asT>> declared in <root>.<get-asT>' type=<root>.Foo<T of <root>.<get-asT>> origin=null
then: TYPE_OP type=T of <root>.<get-asT> origin=IMPLICIT_CAST typeOperand=T of <root>.<get-asT>
then: TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any
GET_VAR '<this>: <root>.Foo<T of <root>.<get-asT>> declared in <root>.<get-asT>' type=<root>.Foo<T of <root>.<get-asT>> origin=null
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
@@ -12,7 +12,7 @@ interface Foo<T : Any?> {
val <reified T : Any> Foo<T>.asT: T?
inline get(): T? {
return when {
<this> is T -> <this> /*as T */
<this> is T -> <this> /*as Any */
else -> null
}
}
@@ -128,8 +128,8 @@ FILE fqName:<root> fileName:/jvmFieldWithIntersectionTypes.kt
CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Derived1' type=<root>.Derived1 origin=null
VAR name:d2 type:<root>.Derived2 [val]
CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.Derived2' type=<root>.Derived2 origin=null
VAR name:k type:<root>.JFieldOwner [val]
WHEN type=<root>.JFieldOwner origin=IF
VAR name:k type:kotlin.Any [val]
WHEN type=kotlin.Any origin=IF
BRANCH
if: GET_VAR 'b: kotlin.Boolean declared in <root>.test' type=kotlin.Boolean origin=null
then: GET_VAR 'val d1: <root>.Derived1 declared in <root>.test' type=<root>.Derived1 origin=null
@@ -137,17 +137,19 @@ FILE fqName:<root> fileName:/jvmFieldWithIntersectionTypes.kt
if: CONST Boolean type=kotlin.Boolean value=true
then: GET_VAR 'val d2: <root>.Derived2 declared in <root>.test' type=<root>.Derived2 origin=null
SET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:f type:kotlin.Int visibility:public' type=kotlin.Unit origin=EQ
receiver: GET_VAR 'val k: <root>.JFieldOwner declared in <root>.test' type=<root>.JFieldOwner origin=null
receiver: TYPE_OP type=<root>.JFieldOwner origin=IMPLICIT_CAST typeOperand=<root>.JFieldOwner
GET_VAR 'val k: kotlin.Any declared in <root>.test' type=kotlin.Any origin=null
value: CONST Int type=kotlin.Int value=42
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
GET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:f type:kotlin.Int visibility:public' type=kotlin.Int origin=GET_PROPERTY
receiver: GET_VAR 'val k: <root>.JFieldOwner declared in <root>.test' type=<root>.JFieldOwner origin=null
receiver: TYPE_OP type=<root>.JFieldOwner origin=IMPLICIT_CAST typeOperand=<root>.JFieldOwner
GET_VAR 'val k: kotlin.Any declared in <root>.test' type=kotlin.Any origin=null
VAR name:md1 type:<root>.DerivedThroughMid1 [val]
CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.DerivedThroughMid1' type=<root>.DerivedThroughMid1 origin=null
VAR name:md2 type:<root>.DerivedThroughMid2 [val]
CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.DerivedThroughMid2' type=<root>.DerivedThroughMid2 origin=null
VAR name:mk type:<root>.Mid [val]
WHEN type=<root>.Mid origin=IF
VAR name:mk type:kotlin.Any [val]
WHEN type=kotlin.Any origin=IF
BRANCH
if: GET_VAR 'b: kotlin.Boolean declared in <root>.test' type=kotlin.Boolean origin=null
then: GET_VAR 'val md1: <root>.DerivedThroughMid1 declared in <root>.test' type=<root>.DerivedThroughMid1 origin=null
@@ -155,8 +157,10 @@ FILE fqName:<root> fileName:/jvmFieldWithIntersectionTypes.kt
if: CONST Boolean type=kotlin.Boolean value=true
then: GET_VAR 'val md2: <root>.DerivedThroughMid2 declared in <root>.test' type=<root>.DerivedThroughMid2 origin=null
SET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:f type:kotlin.Int visibility:public' type=kotlin.Unit origin=EQ
receiver: GET_VAR 'val mk: <root>.Mid declared in <root>.test' type=<root>.Mid origin=null
receiver: TYPE_OP type=<root>.Mid origin=IMPLICIT_CAST typeOperand=<root>.Mid
GET_VAR 'val mk: kotlin.Any declared in <root>.test' type=kotlin.Any origin=null
value: CONST Int type=kotlin.Int value=44
TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit
GET_FIELD 'FIELD IR_EXTERNAL_JAVA_DECLARATION_STUB name:f type:kotlin.Int visibility:public' type=kotlin.Int origin=GET_PROPERTY
receiver: GET_VAR 'val mk: <root>.Mid declared in <root>.test' type=<root>.Mid origin=null
receiver: TYPE_OP type=<root>.Mid origin=IMPLICIT_CAST typeOperand=<root>.Mid
GET_VAR 'val mk: kotlin.Any declared in <root>.test' type=kotlin.Any origin=null
@@ -50,19 +50,19 @@ class DerivedThroughMid2 : Mid, IFoo {
fun test(b: Boolean) {
val d1: Derived1 = Derived1()
val d2: Derived2 = Derived2()
val k: JFieldOwner = when {
val k: Any = when {
b -> d1
else -> d2
}
k.#f = 42
k.#f /*~> Unit */
k /*as JFieldOwner */.#f = 42
k /*as JFieldOwner */.#f /*~> Unit */
val md1: DerivedThroughMid1 = DerivedThroughMid1()
val md2: DerivedThroughMid2 = DerivedThroughMid2()
val mk: Mid = when {
val mk: Any = when {
b -> md1
else -> md2
}
mk.#f = 44
mk.#f /*~> Unit */
mk /*as Mid */.#f = 44
mk /*as Mid */.#f /*~> Unit */
}
@@ -50,8 +50,7 @@ FILE fqName:<root> fileName:/multipleSmartCasts.kt
then: CONST Boolean type=kotlin.Boolean value=false
then: BLOCK type=kotlin.Unit origin=null
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Any [val]
TYPE_OP type=<root>.IC1 origin=IMPLICIT_CAST typeOperand=<root>.IC1
GET_VAR 'x: kotlin.Any declared in <root>.test' type=kotlin.Any origin=null
GET_VAR 'x: kotlin.Any declared in <root>.test' type=kotlin.Any origin=null
VAR name:x1 type:kotlin.Int [val]
CALL 'public abstract fun component1 (): kotlin.Int declared in <root>.IC1' type=kotlin.Int origin=COMPONENT_N(index=1)
$this: TYPE_OP type=<root>.IC1 origin=IMPLICIT_CAST typeOperand=<root>.IC1
@@ -59,5 +58,4 @@ FILE fqName:<root> fileName:/multipleSmartCasts.kt
VAR name:x2 type:kotlin.String [val]
CALL 'public abstract fun component2 (): kotlin.String declared in <root>.IC2' type=kotlin.String origin=COMPONENT_N(index=2)
$this: TYPE_OP type=<root>.IC2 origin=IMPLICIT_CAST typeOperand=<root>.IC2
TYPE_OP type=<root>.IC1 origin=IMPLICIT_CAST typeOperand=<root>.IC1
GET_VAR 'val tmp_0: kotlin.Any declared in <root>.test' type=kotlin.Any origin=null
GET_VAR 'val tmp_0: kotlin.Any declared in <root>.test' type=kotlin.Any origin=null
@@ -14,9 +14,10 @@ fun test(x: Any) {
x is IC1 -> x /*as IC1 */ is IC2
else -> false
} -> { // BLOCK
val tmp_0: Any = x /*as IC1 */
val tmp_0: Any = x
val x1: Int = tmp_0 /*as IC1 */.component1()
val x2: String = tmp_0 /*as IC1 */ /*as IC2 */.component2()
val x2: String = tmp_0 /*as IC2 */.component2()
}
}
}
@@ -8,7 +8,7 @@ FILE fqName:<root> fileName:/samConversionsWithSmartCasts.kt
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test1' type=kotlin.Function0<kotlin.Unit> origin=null
then: BLOCK type=kotlin.Unit origin=null
CALL 'public open fun runStatic (r: @[FlexibleNullability] java.lang.Runnable?): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=null
r: TYPE_OP type=java.lang.Runnable origin=IMPLICIT_CAST typeOperand=java.lang.Runnable
r: TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test1' type=kotlin.Function0<kotlin.Unit> origin=null
FUN name:test2 visibility:public modality:FINAL <> (a:kotlin.Function0<kotlin.Unit>) returnType:kotlin.Unit
VALUE_PARAMETER name:a index:0 type:kotlin.Function0<kotlin.Unit>
@@ -20,7 +20,7 @@ FILE fqName:<root> fileName:/samConversionsWithSmartCasts.kt
then: BLOCK type=kotlin.Unit origin=null
CALL 'public open fun run1 (r: @[FlexibleNullability] java.lang.Runnable?): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=null
$this: CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.J' type=<root>.J origin=null
r: TYPE_OP type=java.lang.Runnable origin=IMPLICIT_CAST typeOperand=java.lang.Runnable
r: TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test2' type=kotlin.Function0<kotlin.Unit> origin=null
FUN name:test3 visibility:public modality:FINAL <> (a:kotlin.Function0<kotlin.Unit>) returnType:kotlin.Unit
VALUE_PARAMETER name:a index:0 type:kotlin.Function0<kotlin.Unit>
@@ -32,9 +32,9 @@ 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> () declared in <root>.J' type=<root>.J origin=null
r1: TYPE_OP type=java.lang.Runnable origin=IMPLICIT_CAST typeOperand=java.lang.Runnable
r1: TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test3' type=kotlin.Function0<kotlin.Unit> origin=null
r2: TYPE_OP type=java.lang.Runnable origin=IMPLICIT_CAST typeOperand=java.lang.Runnable
r2: TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.test3' type=kotlin.Function0<kotlin.Unit> origin=null
FUN name:test4 visibility:public modality:FINAL <> (a:kotlin.Function0<kotlin.Unit>, b:kotlin.Function0<kotlin.Unit>) returnType:kotlin.Unit
VALUE_PARAMETER name:a index:0 type:kotlin.Function0<kotlin.Unit>
@@ -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> () declared in <root>.J' type=<root>.J origin=null
r1: TYPE_OP type=java.lang.Runnable origin=IMPLICIT_CAST typeOperand=java.lang.Runnable
r1: TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any
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
@@ -77,8 +77,7 @@ FILE fqName:<root> fileName:/samConversionsWithSmartCasts.kt
GET_VAR 'a: kotlin.Any declared in <root>.test5x' type=kotlin.Any origin=null
CALL 'public open fun run1 (r: @[FlexibleNullability] java.lang.Runnable?): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=null
$this: CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.J' type=<root>.J origin=null
r: TYPE_OP type=java.lang.Runnable origin=IMPLICIT_CAST typeOperand=java.lang.Runnable
GET_VAR 'a: kotlin.Any declared in <root>.test5x' type=kotlin.Any origin=null
r: GET_VAR 'a: kotlin.Any declared in <root>.test5x' type=kotlin.Any origin=null
FUN name:test6 visibility:public modality:FINAL <> (a:kotlin.Any) returnType:kotlin.Unit
VALUE_PARAMETER name:a index:0 type:kotlin.Any
BLOCK_BODY
@@ -99,7 +98,7 @@ FILE fqName:<root> fileName:/samConversionsWithSmartCasts.kt
CALL 'public open fun run1 (r: @[FlexibleNullability] java.lang.Runnable?): kotlin.Unit declared in <root>.J' type=kotlin.Unit origin=null
$this: CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.J' type=<root>.J origin=null
r: TYPE_OP type=@[FlexibleNullability] java.lang.Runnable? origin=SAM_CONVERSION typeOperand=@[FlexibleNullability] java.lang.Runnable?
TYPE_OP type=kotlin.Function0<kotlin.Unit> origin=IMPLICIT_CAST typeOperand=kotlin.Function0<kotlin.Unit>
TYPE_OP type=kotlin.Function<kotlin.Any> origin=IMPLICIT_CAST typeOperand=kotlin.Function<kotlin.Any>
GET_VAR 'a: kotlin.Function1<kotlin.Int, kotlin.Int> declared in <root>.test7' type=kotlin.Function1<kotlin.Int, kotlin.Int> 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>
@@ -1,7 +1,7 @@
fun test1(a: Function0<Unit>) {
when {
a is Runnable -> { // BLOCK
runStatic(r = a /*as Runnable */)
runStatic(r = a /*as Any */)
}
}
}
@@ -9,7 +9,7 @@ fun test1(a: Function0<Unit>) {
fun test2(a: Function0<Unit>) {
when {
a is Runnable -> { // BLOCK
J().run1(r = a /*as Runnable */)
J().run1(r = a /*as Any */)
}
}
}
@@ -17,7 +17,7 @@ fun test2(a: Function0<Unit>) {
fun test3(a: Function0<Unit>) {
when {
a is Runnable -> { // BLOCK
J().run2(r1 = a /*as Runnable */, r2 = a /*as Runnable */)
J().run2(r1 = a /*as Any */, r2 = a /*as Any */)
}
}
}
@@ -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 /*as Runnable */, r2 = b /*-> @FlexibleNullability Runnable? */)
J().run2(r1 = a /*as Any */, r2 = b /*-> @FlexibleNullability Runnable? */)
}
}
}
@@ -42,7 +42,7 @@ fun test5x(a: Any) {
when {
a is Runnable -> { // BLOCK
a /*as Runnable */ as Function0<Unit> /*~> Unit */
J().run1(r = a /*as Runnable */)
J().run1(r = a)
}
}
}
@@ -54,7 +54,7 @@ fun test6(a: Any) {
fun test7(a: Function1<Int, Int>) {
a as Function0<Unit> /*~> Unit */
J().run1(r = a /*as Function0<Unit> */ /*-> @FlexibleNullability Runnable? */)
J().run1(r = a /*as Function<Any> */ /*-> @FlexibleNullability Runnable? */)
}
fun test8(a: Function0<Unit>) {
@@ -49,13 +49,13 @@ FILE fqName:<root> fileName:/smartCastsWithDestructuring.kt
then: RETURN type=kotlin.Nothing from='public final fun test (x: <root>.I1): kotlin.Unit declared in <root>'
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:<root>.I1 [val]
TYPE_OP type=<root>.I2 origin=IMPLICIT_CAST typeOperand=<root>.I2
TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any
GET_VAR 'x: <root>.I1 declared in <root>.test' type=<root>.I1 origin=null
VAR name:c1 type:kotlin.Int [val]
CALL 'public final fun component1 (): kotlin.Int declared in <root>' type=kotlin.Int origin=COMPONENT_N(index=1)
$receiver: TYPE_OP type=<root>.I2 origin=IMPLICIT_CAST typeOperand=<root>.I2
$receiver: TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any
GET_VAR 'val tmp_0: <root>.I1 declared in <root>.test' type=<root>.I1 origin=null
VAR name:c2 type:kotlin.String [val]
CALL 'public final fun component2 (): kotlin.String declared in <root>' type=kotlin.String origin=COMPONENT_N(index=2)
$receiver: TYPE_OP type=<root>.I2 origin=IMPLICIT_CAST typeOperand=<root>.I2
$receiver: TYPE_OP type=kotlin.Any origin=IMPLICIT_CAST typeOperand=kotlin.Any
GET_VAR 'val tmp_0: <root>.I1 declared in <root>.test' type=<root>.I1 origin=null
@@ -18,7 +18,7 @@ fun test(x: I1) {
when {
x !is I2 -> return Unit
}
val tmp_0: I1 = x /*as I2 */
val c1: Int = tmp_0 /*as I2 */.component1()
val c2: String = tmp_0 /*as I2 */.component2()
val tmp_0: I1 = x /*as Any */
val c1: Int = tmp_0 /*as Any */.component1()
val c2: String = tmp_0 /*as Any */.component2()
}
@@ -254,7 +254,7 @@ FILE fqName:<root> fileName:/suspendConversionOnArbitraryExpression.kt
TYPE_OP type=kotlin.coroutines.SuspendFunction0<kotlin.Unit> origin=CAST typeOperand=kotlin.coroutines.SuspendFunction0<kotlin.Unit>
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.testSmartCastVsSuspendConversion' type=kotlin.Function0<kotlin.Unit> origin=null
CALL 'public final fun useSuspend (sfn: kotlin.coroutines.SuspendFunction0<kotlin.Unit>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
sfn: TYPE_OP type=kotlin.coroutines.SuspendFunction0<kotlin.Unit> origin=IMPLICIT_CAST typeOperand=kotlin.coroutines.SuspendFunction0<kotlin.Unit>
sfn: TYPE_OP type=kotlin.Function<kotlin.Unit> origin=IMPLICIT_CAST typeOperand=kotlin.Function<kotlin.Unit>
GET_VAR 'a: kotlin.Function0<kotlin.Unit> declared in <root>.testSmartCastVsSuspendConversion' type=kotlin.Function0<kotlin.Unit> origin=null
FUN name:testSmartCastOnVarVsSuspendConversion visibility:public modality:FINAL <> (a:kotlin.Function0<kotlin.Unit>) returnType:kotlin.Unit
VALUE_PARAMETER name:a index:0 type:kotlin.Function0<kotlin.Unit>
@@ -265,7 +265,7 @@ FILE fqName:<root> fileName:/suspendConversionOnArbitraryExpression.kt
TYPE_OP type=kotlin.coroutines.SuspendFunction0<kotlin.Unit> origin=CAST typeOperand=kotlin.coroutines.SuspendFunction0<kotlin.Unit>
GET_VAR 'var b: kotlin.Function0<kotlin.Unit> declared in <root>.testSmartCastOnVarVsSuspendConversion' type=kotlin.Function0<kotlin.Unit> origin=null
CALL 'public final fun useSuspend (sfn: kotlin.coroutines.SuspendFunction0<kotlin.Unit>): kotlin.Unit declared in <root>' type=kotlin.Unit origin=null
sfn: TYPE_OP type=kotlin.coroutines.SuspendFunction0<kotlin.Unit> origin=IMPLICIT_CAST typeOperand=kotlin.coroutines.SuspendFunction0<kotlin.Unit>
sfn: TYPE_OP type=kotlin.Function<kotlin.Unit> origin=IMPLICIT_CAST typeOperand=kotlin.Function<kotlin.Unit>
GET_VAR 'var b: kotlin.Function0<kotlin.Unit> declared in <root>.testSmartCastOnVarVsSuspendConversion' type=kotlin.Function0<kotlin.Unit> origin=null
FUN name:testIntersectionVsSuspendConversion visibility:public modality:FINAL <T> (x:T of <root>.testIntersectionVsSuspendConversion) returnType:kotlin.Unit
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Function0<kotlin.Unit>; kotlin.coroutines.SuspendFunction0<kotlin.Unit>] reified:false
@@ -175,15 +175,16 @@ fun testSmartCastOnVarWithSuspendConversion(a: Any) {
fun testSmartCastVsSuspendConversion(a: Function0<Unit>) {
a as SuspendFunction0<Unit> /*~> Unit */
useSuspend(sfn = a /*as SuspendFunction0<Unit> */)
useSuspend(sfn = a /*as Function<Unit> */)
}
fun testSmartCastOnVarVsSuspendConversion(a: Function0<Unit>) {
var b: Function0<Unit> = a
b as SuspendFunction0<Unit> /*~> Unit */
useSuspend(sfn = b /*as SuspendFunction0<Unit> */)
useSuspend(sfn = b /*as Function<Unit> */)
}
fun <T> testIntersectionVsSuspendConversion(x: T) where T : Function0<Unit>, T : SuspendFunction0<Unit> {
useSuspend(sfn = x)
}
@@ -0,0 +1,170 @@
FILE fqName:<root> fileName:/Modality.kt
CLASS INTERFACE name:Substitutable modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Substitutable<T of <root>.Substitutable>
TYPE_PARAMETER name:T index:0 variance:out superTypes:[<root>.DeclarationDescriptorNonRoot] reified:false
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 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:ResolutionPart modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.ResolutionPart
CONSTRUCTOR visibility:public <> () returnType:<root>.ResolutionPart [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:ResolutionPart modality:ABSTRACT visibility:public superTypes:[kotlin.Any]'
FUN name:process visibility:public modality:ABSTRACT <> ($this:<root>.ResolutionPart, $receiver:<root>.KotlinResolutionCandidate) returnType:kotlin.String
$this: VALUE_PARAMETER name:<this> type:<root>.ResolutionPart
$receiver: VALUE_PARAMETER name:<this> type:<root>.KotlinResolutionCandidate
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 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:KotlinResolutionCandidate modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.KotlinResolutionCandidate
CONSTRUCTOR visibility:public <> (resolvedCall:<root>.Atom) returnType:<root>.KotlinResolutionCandidate [primary]
VALUE_PARAMETER name:resolvedCall index:0 type:<root>.Atom
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:KotlinResolutionCandidate modality:FINAL visibility:public superTypes:[kotlin.Any]'
PROPERTY name:resolvedCall visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:resolvedCall type:<root>.Atom visibility:private [final]
EXPRESSION_BODY
GET_VAR 'resolvedCall: <root>.Atom declared in <root>.KotlinResolutionCandidate.<init>' type=<root>.Atom origin=INITIALIZE_PROPERTY_FROM_PARAMETER
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-resolvedCall> visibility:public modality:FINAL <> ($this:<root>.KotlinResolutionCandidate) returnType:<root>.Atom
correspondingProperty: PROPERTY name:resolvedCall visibility:public modality:FINAL [val]
$this: VALUE_PARAMETER name:<this> type:<root>.KotlinResolutionCandidate
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-resolvedCall> (): <root>.Atom declared in <root>.KotlinResolutionCandidate'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:resolvedCall type:<root>.Atom visibility:private [final]' type=<root>.Atom origin=null
receiver: GET_VAR '<this>: <root>.KotlinResolutionCandidate declared in <root>.KotlinResolutionCandidate.<get-resolvedCall>' type=<root>.KotlinResolutionCandidate 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 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:Atom modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Atom
CONSTRUCTOR visibility:public <> (candidateDescriptor:<root>.CallableDescriptor) returnType:<root>.Atom [primary]
VALUE_PARAMETER name:candidateDescriptor index:0 type:<root>.CallableDescriptor
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Atom modality:FINAL visibility:public superTypes:[kotlin.Any]'
PROPERTY name:candidateDescriptor visibility:public modality:FINAL [val]
FIELD PROPERTY_BACKING_FIELD name:candidateDescriptor type:<root>.CallableDescriptor visibility:private [final]
EXPRESSION_BODY
GET_VAR 'candidateDescriptor: <root>.CallableDescriptor declared in <root>.Atom.<init>' type=<root>.CallableDescriptor origin=INITIALIZE_PROPERTY_FROM_PARAMETER
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-candidateDescriptor> visibility:public modality:FINAL <> ($this:<root>.Atom) returnType:<root>.CallableDescriptor
correspondingProperty: PROPERTY name:candidateDescriptor visibility:public modality:FINAL [val]
$this: VALUE_PARAMETER name:<this> type:<root>.Atom
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun <get-candidateDescriptor> (): <root>.CallableDescriptor declared in <root>.Atom'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:candidateDescriptor type:<root>.CallableDescriptor visibility:private [final]' type=<root>.CallableDescriptor origin=null
receiver: GET_VAR '<this>: <root>.Atom declared in <root>.Atom.<get-candidateDescriptor>' type=<root>.Atom 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 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 OBJECT name:Owner modality:FINAL visibility:public superTypes:[<root>.ResolutionPart]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Owner
CONSTRUCTOR visibility:private <> () returnType:<root>.Owner [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.ResolutionPart'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:Owner modality:FINAL visibility:public superTypes:[<root>.ResolutionPart]'
FUN name:process visibility:public modality:OPEN <> ($this:<root>.Owner, $receiver:<root>.KotlinResolutionCandidate) returnType:kotlin.String
overridden:
public abstract fun process (): kotlin.String declared in <root>.ResolutionPart
$this: VALUE_PARAMETER name:<this> type:<root>.Owner
$receiver: VALUE_PARAMETER name:<this> type:<root>.KotlinResolutionCandidate
BLOCK_BODY
VAR name:candidateDescriptor type:<root>.CallableDescriptor [val]
CALL 'public final fun <get-candidateDescriptor> (): <root>.CallableDescriptor declared in <root>.Atom' type=<root>.CallableDescriptor origin=GET_PROPERTY
$this: CALL 'public final fun <get-resolvedCall> (): <root>.Atom declared in <root>.KotlinResolutionCandidate' type=<root>.Atom origin=GET_PROPERTY
$this: GET_VAR '<this>: <root>.KotlinResolutionCandidate declared in <root>.Owner.process' type=<root>.KotlinResolutionCandidate origin=null
WHEN type=kotlin.Unit origin=IF
BRANCH
if: WHEN type=kotlin.Boolean origin=ANDAND
BRANCH
if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=<root>.MemberDescriptor
GET_VAR 'val candidateDescriptor: <root>.CallableDescriptor declared in <root>.Owner.process' type=<root>.CallableDescriptor origin=null
then: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ
$this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ
arg0: CALL 'public abstract fun getModality (): @[FlexibleNullability] <root>.Modality? declared in <root>.MemberDescriptor' type=@[FlexibleNullability] <root>.Modality? origin=GET_PROPERTY
$this: TYPE_OP type=<root>.MemberDescriptor origin=IMPLICIT_CAST typeOperand=<root>.MemberDescriptor
TYPE_OP type=<root>.DeclarationDescriptor origin=IMPLICIT_CAST typeOperand=<root>.DeclarationDescriptor
GET_VAR 'val candidateDescriptor: <root>.CallableDescriptor declared in <root>.Owner.process' type=<root>.CallableDescriptor origin=null
arg1: CONST Null type=kotlin.Nothing? value=null
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CONST Boolean type=kotlin.Boolean value=false
then: BLOCK type=kotlin.Unit origin=null
RETURN type=kotlin.Nothing from='public open fun process (): kotlin.String declared in <root>.Owner'
CONST String type=kotlin.String value="OK"
RETURN type=kotlin.Nothing from='public open fun process (): kotlin.String declared in <root>.Owner'
CONST String type=kotlin.String value="FAIL"
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 declared in <root>.ResolutionPart
$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 <root>.ResolutionPart
$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 <root>.ResolutionPart
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS OBJECT name:Final modality:FINAL visibility:public superTypes:[<root>.Modality]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Final
CONSTRUCTOR visibility:private <> () returnType:<root>.Final [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:Final modality:FINAL visibility:public superTypes:[<root>.Modality]'
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 declared in <root>.Modality
$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 <root>.Modality
$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 <root>.Modality
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
@@ -0,0 +1,71 @@
interface Substitutable<out T : DeclarationDescriptorNonRoot> {
}
abstract class ResolutionPart {
constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
abstract fun KotlinResolutionCandidate.process(): String
}
class KotlinResolutionCandidate {
constructor(resolvedCall: Atom) /* primary */ {
super/*Any*/()
/* <init>() */
}
val resolvedCall: Atom
field = resolvedCall
get
}
class Atom {
constructor(candidateDescriptor: CallableDescriptor) /* primary */ {
super/*Any*/()
/* <init>() */
}
val candidateDescriptor: CallableDescriptor
field = candidateDescriptor
get
}
object Owner : ResolutionPart {
private constructor() /* primary */ {
super/*ResolutionPart*/()
/* <init>() */
}
override fun KotlinResolutionCandidate.process(): String {
val candidateDescriptor: CallableDescriptor = <this>.<get-resolvedCall>().<get-candidateDescriptor>()
when {
when {
candidateDescriptor is MemberDescriptor -> EQEQ(arg0 = candidateDescriptor /*as DeclarationDescriptor */ /*as MemberDescriptor */.getModality(), arg1 = null).not()
else -> false
} -> { // BLOCK
return "OK"
}
}
return "FAIL"
}
}
object Final : Modality {
private constructor() /* primary */ {
super/*Any*/()
/* <init>() */
}
}
-1
View File
@@ -1,4 +1,3 @@
// FIR_IDENTICAL
// TARGET_BACKEND: JVM
// FILE: Modality.java
public interface Modality
@@ -132,8 +132,8 @@ FILE fqName:<root> fileName:/candidateSymbol.kt
FUN name:foo visibility:public modality:FINAL <> (candidate:<root>.Candidate) returnType:kotlin.Unit
VALUE_PARAMETER name:candidate index:0 type:<root>.Candidate
BLOCK_BODY
VAR name:me type:<root>.FirSymbolOwner<*> [val]
CALL 'public final fun <get-fir> (): E of <root>.AbstractFirBasedSymbol declared in <root>.AbstractFirBasedSymbol' type=<root>.FirSymbolOwner<*> origin=GET_PROPERTY
VAR name:me type:kotlin.Any [val]
CALL 'public final fun <get-fir> (): E of <root>.AbstractFirBasedSymbol declared in <root>.AbstractFirBasedSymbol' type=kotlin.Any origin=GET_PROPERTY
$this: CALL 'public final fun <get-symbol> (): <root>.AbstractFirBasedSymbol<*> declared in <root>.Candidate' type=<root>.AbstractFirBasedSymbol<*> origin=GET_PROPERTY
$this: GET_VAR 'candidate: <root>.Candidate declared in <root>.foo' type=<root>.Candidate origin=null
WHEN type=kotlin.Unit origin=IF
@@ -141,12 +141,12 @@ FILE fqName:<root> fileName:/candidateSymbol.kt
if: WHEN type=kotlin.Boolean origin=ANDAND
BRANCH
if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=<root>.FirCallableMemberDeclaration<*>
GET_VAR 'val me: <root>.FirSymbolOwner<*> declared in <root>.foo' type=<root>.FirSymbolOwner<*> origin=null
GET_VAR 'val me: kotlin.Any declared in <root>.foo' type=kotlin.Any origin=null
then: CALL 'public final fun not (): kotlin.Boolean declared in kotlin.Boolean' type=kotlin.Boolean origin=EXCLEQ
$this: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EXCLEQ
arg0: CALL 'public abstract fun <get-symbol> (): <root>.AbstractFirBasedSymbol<F of <root>.FirCallableMemberDeclaration> declared in <root>.FirCallableMemberDeclaration' type=<root>.AbstractFirBasedSymbol<out <root>.FirCallableMemberDeclaration<*>> origin=GET_PROPERTY
$this: TYPE_OP type=<root>.FirCallableMemberDeclaration<*> origin=IMPLICIT_CAST typeOperand=<root>.FirCallableMemberDeclaration<*>
GET_VAR 'val me: <root>.FirSymbolOwner<*> declared in <root>.foo' type=<root>.FirSymbolOwner<*> origin=null
GET_VAR 'val me: kotlin.Any declared in <root>.foo' type=kotlin.Any origin=null
arg1: CONST Null type=kotlin.Nothing? value=null
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
@@ -41,7 +41,7 @@ interface FirCallableMemberDeclaration<F : FirCallableMemberDeclaration<F>> : Fi
}
fun foo(candidate: Candidate) {
val me: FirSymbolOwner<*> = candidate.<get-symbol>().<get-fir>()
val me: Any = candidate.<get-symbol>().<get-fir>()
when {
when {
me is FirCallableMemberDeclaration<*> -> EQEQ(arg0 = me /*as FirCallableMemberDeclaration<*> */.<get-symbol>(), arg1 = null).not()
@@ -50,3 +50,4 @@ fun foo(candidate: Candidate) {
}
}
}
@@ -1,105 +0,0 @@
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?] reified:false
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 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 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> () 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 declared in <root>.Foo
public open fun equals (other: kotlin.Any?): kotlin.Boolean 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 declared in <root>.Foo
public open fun hashCode (): kotlin.Int 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 declared in <root>.Foo
public open fun toString (): kotlin.String 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> () 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 declared in <root>.Foo
public open fun equals (other: kotlin.Any?): kotlin.Boolean 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 declared in <root>.Foo
public open fun hashCode (): kotlin.Int 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 declared in <root>.Foo
public open fun toString (): kotlin.String 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?] reified:false
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 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> () declared in <root>.B' type=<root>.B origin=null
VAR name:nn type:<root>.C [val]
CONSTRUCTOR_CALL 'public constructor <init> () 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 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 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 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,3 +1,4 @@
// FIR_IDENTICAL
interface A<out T>
interface Foo
@@ -1,241 +0,0 @@
FILE fqName:<root> fileName:/intersectionTypeInSamType.kt
CLASS INTERFACE name:X modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.X
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 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:Z modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Z
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 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:A modality:ABSTRACT visibility:public superTypes:[<root>.X; <root>.Z]
$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 declared in <root>.X
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in <root>.Z
$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 <root>.X
public open fun hashCode (): kotlin.Int declared in <root>.Z
$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 <root>.X
public open fun toString (): kotlin.String declared in <root>.Z
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS INTERFACE name:B modality:ABSTRACT visibility:public superTypes:[<root>.X; <root>.Z]
$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 declared in <root>.X
public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in <root>.Z
$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 <root>.X
public open fun hashCode (): kotlin.Int declared in <root>.Z
$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 <root>.X
public open fun toString (): kotlin.String declared in <root>.Z
$this: VALUE_PARAMETER name:<this> type:kotlin.Any
CLASS INTERFACE name:IFoo modality:ABSTRACT visibility:public [fun] superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.IFoo<T of <root>.IFoo>
TYPE_PARAMETER name:T index:0 variance: superTypes:[<root>.X] reified:false
FUN name:foo visibility:public modality:ABSTRACT <> ($this:<root>.IFoo<T of <root>.IFoo>, t:T of <root>.IFoo) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.IFoo<T of <root>.IFoo>
VALUE_PARAMETER name:t index:0 type:T of <root>.IFoo
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 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:IBar1 modality:ABSTRACT visibility:public [fun] superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.IBar1<T of <root>.IBar1>
TYPE_PARAMETER name:T index:0 variance: superTypes:[<root>.X; <root>.Z] reified:false
FUN name:bar visibility:public modality:ABSTRACT <> ($this:<root>.IBar1<T of <root>.IBar1>, t:T of <root>.IBar1) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.IBar1<T of <root>.IBar1>
VALUE_PARAMETER name:t index:0 type:T of <root>.IBar1
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 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:IBar2 modality:ABSTRACT visibility:public [fun] superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.IBar2<T of <root>.IBar2>
TYPE_PARAMETER name:T index:0 variance: superTypes:[<root>.X; <root>.Z] reified:false
FUN name:bar visibility:public modality:ABSTRACT <> ($this:<root>.IBar2<T of <root>.IBar2>, t:T of <root>.IBar2) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.IBar2<T of <root>.IBar2>
VALUE_PARAMETER name:t index:0 type:T of <root>.IBar2
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 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:sel visibility:public modality:FINAL <T> (x:T of <root>.sel, y:T of <root>.sel) returnType:T of <root>.sel
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false
VALUE_PARAMETER name:x index:0 type:T of <root>.sel
VALUE_PARAMETER name:y index:1 type:T of <root>.sel
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun sel <T> (x: T of <root>.sel, y: T of <root>.sel): T of <root>.sel declared in <root>'
GET_VAR 'x: T of <root>.sel declared in <root>.sel' type=T of <root>.sel origin=null
CLASS CLASS name:G1 modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.G1<T of <root>.G1>
TYPE_PARAMETER name:T index:0 variance: superTypes:[<root>.X] reified:false
CONSTRUCTOR visibility:public <> () returnType:<root>.G1<T of <root>.G1> [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:G1 modality:FINAL visibility:public superTypes:[kotlin.Any]'
FUN name:checkFoo visibility:public modality:FINAL <> ($this:<root>.G1<T of <root>.G1>, x:<root>.IFoo<in T of <root>.G1>) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.G1<T of <root>.G1>
VALUE_PARAMETER name:x index:0 type:<root>.IFoo<in T of <root>.G1>
BLOCK_BODY
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 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:G2 modality:FINAL visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.G2<T of <root>.G2>
TYPE_PARAMETER name:T index:0 variance: superTypes:[<root>.X; <root>.Z] reified:false
CONSTRUCTOR visibility:public <> () returnType:<root>.G2<T of <root>.G2> [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:G2 modality:FINAL visibility:public superTypes:[kotlin.Any]'
FUN name:checkFoo visibility:public modality:FINAL <> ($this:<root>.G2<T of <root>.G2>, x:<root>.IFoo<in T of <root>.G2>) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.G2<T of <root>.G2>
VALUE_PARAMETER name:x index:0 type:<root>.IFoo<in T of <root>.G2>
BLOCK_BODY
FUN name:checkBar1 visibility:public modality:FINAL <> ($this:<root>.G2<T of <root>.G2>, x:<root>.IBar1<in T of <root>.G2>) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.G2<T of <root>.G2>
VALUE_PARAMETER name:x index:0 type:<root>.IBar1<in T of <root>.G2>
BLOCK_BODY
FUN name:checkBar2 visibility:public modality:FINAL <> ($this:<root>.G2<T of <root>.G2>, x:<root>.IBar2<in T of <root>.G2>) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.G2<T of <root>.G2>
VALUE_PARAMETER name:x index:0 type:<root>.IBar2<in T of <root>.G2>
BLOCK_BODY
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 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:test1 visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
VAR name:g type:<root>.G1<*> [val]
CALL 'public final fun sel <T> (x: T of <root>.sel, y: T of <root>.sel): T of <root>.sel declared in <root>' type=<root>.G1<*> origin=null
<T>: <root>.G1<*>
x: CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.G1' type=<root>.G1<<root>.A> origin=null
<class: T>: <root>.A
y: CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.G1' type=<root>.G1<<root>.B> origin=null
<class: T>: <root>.B
CALL 'public final fun checkFoo (x: <root>.IFoo<in T of <root>.G1>): kotlin.Unit declared in <root>.G1' type=kotlin.Unit origin=null
$this: GET_VAR 'val g: <root>.G1<*> declared in <root>.test1' type=<root>.G1<*> origin=null
x: TYPE_OP type=<root>.IFoo<in kotlin.Nothing> origin=SAM_CONVERSION typeOperand=<root>.IFoo<in kotlin.Nothing>
FUN_EXPR type=kotlin.Function1<kotlin.Nothing, kotlin.Unit> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:<root>.X) returnType:kotlin.Unit
VALUE_PARAMETER name:it index:0 type:<root>.X
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: <root>.X): kotlin.Unit declared in <root>.test1'
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
FUN name:test2 visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
VAR name:g type:<root>.G2<*> [val]
CALL 'public final fun sel <T> (x: T of <root>.sel, y: T of <root>.sel): T of <root>.sel declared in <root>' type=<root>.G2<*> origin=null
<T>: <root>.G2<*>
x: CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.G2' type=<root>.G2<<root>.A> origin=null
<class: T>: <root>.A
y: CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.G2' type=<root>.G2<<root>.B> origin=null
<class: T>: <root>.B
CALL 'public final fun checkFoo (x: <root>.IFoo<in T of <root>.G2>): kotlin.Unit declared in <root>.G2' type=kotlin.Unit origin=null
$this: GET_VAR 'val g: <root>.G2<*> declared in <root>.test2' type=<root>.G2<*> origin=null
x: TYPE_OP type=<root>.IFoo<in kotlin.Nothing> origin=SAM_CONVERSION typeOperand=<root>.IFoo<in kotlin.Nothing>
FUN_EXPR type=kotlin.Function1<kotlin.Nothing, kotlin.Unit> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:<root>.X) returnType:kotlin.Unit
VALUE_PARAMETER name:it index:0 type:<root>.X
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: <root>.X): kotlin.Unit declared in <root>.test2'
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
CALL 'public final fun checkBar1 (x: <root>.IBar1<in T of <root>.G2>): kotlin.Unit declared in <root>.G2' type=kotlin.Unit origin=null
$this: GET_VAR 'val g: <root>.G2<*> declared in <root>.test2' type=<root>.G2<*> origin=null
x: TYPE_OP type=<root>.IBar1<in kotlin.Nothing> origin=SAM_CONVERSION typeOperand=<root>.IBar1<in kotlin.Nothing>
FUN_EXPR type=kotlin.Function1<kotlin.Nothing, kotlin.Unit> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:<root>.X) returnType:kotlin.Unit
VALUE_PARAMETER name:it index:0 type:<root>.X
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: <root>.X): kotlin.Unit declared in <root>.test2'
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
CALL 'public final fun checkBar2 (x: <root>.IBar2<in T of <root>.G2>): kotlin.Unit declared in <root>.G2' type=kotlin.Unit origin=null
$this: GET_VAR 'val g: <root>.G2<*> declared in <root>.test2' type=<root>.G2<*> origin=null
x: TYPE_OP type=<root>.IBar2<in kotlin.Nothing> origin=SAM_CONVERSION typeOperand=<root>.IBar2<in kotlin.Nothing>
FUN_EXPR type=kotlin.Function1<kotlin.Nothing, kotlin.Unit> origin=LAMBDA
FUN LOCAL_FUNCTION_FOR_LAMBDA name:<anonymous> visibility:local modality:FINAL <> (it:<root>.X) returnType:kotlin.Unit
VALUE_PARAMETER name:it index:0 type:<root>.X
BLOCK_BODY
RETURN type=kotlin.Nothing from='local final fun <anonymous> (it: <root>.X): kotlin.Unit declared in <root>.test2'
GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Unit modality:FINAL visibility:public superTypes:[kotlin.Any]' type=kotlin.Unit
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// SKIP_KT_DUMP
// IGNORE_BACKEND_K1: JS_IR
// IGNORE_BACKEND_K1: JS_IR_ES6
-15
View File
@@ -1,15 +0,0 @@
FILE fqName:<root> fileName:/kt49526.kt
FUN name:test visibility:public modality:FINAL <> () returnType:kotlin.Boolean
BLOCK_BODY
VAR name:ref type:kotlin.reflect.KFunction1<kotlin.Nothing, kotlin.Boolean> [val]
FUNCTION_REFERENCE 'public abstract fun contains (element: E of kotlin.collections.List): kotlin.Boolean declared in kotlin.collections.List' type=kotlin.reflect.KFunction1<kotlin.Any, kotlin.Boolean> origin=null reflectionTarget=<same>
$this: CALL 'public final fun plus <T> (element: T of kotlin.collections.plus): kotlin.collections.List<T of kotlin.collections.plus> declared in kotlin.collections' type=kotlin.collections.List<kotlin.Any> origin=PLUS
<T>: kotlin.Comparable<kotlin.Nothing>
$receiver: CALL 'public final fun listOf <T> (element: T of kotlin.collections.listOf): kotlin.collections.List<T of kotlin.collections.listOf> declared in kotlin.collections' type=kotlin.collections.List<kotlin.Char> origin=null
<T>: kotlin.Char
element: CONST Char type=kotlin.Char value='a'
element: CONST String type=kotlin.String value="-"
RETURN type=kotlin.Nothing from='public final fun test (): kotlin.Boolean declared in <root>'
CALL 'public abstract fun invoke (p1: P1 of kotlin.reflect.KFunction1): R of kotlin.reflect.KFunction1 declared in kotlin.reflect.KFunction1' type=kotlin.Boolean origin=INVOKE
$this: GET_VAR 'val ref: kotlin.reflect.KFunction1<kotlin.Nothing, kotlin.Boolean> declared in <root>.test' type=kotlin.reflect.KFunction1<kotlin.Nothing, kotlin.Boolean> origin=VARIABLE_AS_FUNCTION
p1: CONST Char type=kotlin.Char value='a'
+1
View File
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// WITH_STDLIB
// SKIP_KT_DUMP
// IGNORE_BACKEND: JS_IR
@@ -1,123 +0,0 @@
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?] reified:false
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 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:Inv modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Inv<T of <root>.Inv>
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false
PROPERTY name:t visibility:public modality:ABSTRACT [val]
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-t> visibility:public modality:ABSTRACT <> ($this:<root>.Inv<T of <root>.Inv>) returnType:T of <root>.Inv
correspondingProperty: PROPERTY name:t visibility:public modality:ABSTRACT [val]
$this: VALUE_PARAMETER name:<this> type:<root>.Inv<T of <root>.Inv>
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 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:Z modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Z
FUN name:create visibility:public modality:ABSTRACT <T> ($this:<root>.Z, x:<root>.In<T of <root>.Z.create>, y:<root>.In<T of <root>.Z.create>) returnType:<root>.Inv<T of <root>.Z.create>
TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false
$this: VALUE_PARAMETER name:<this> type:<root>.Z
VALUE_PARAMETER name:x index:0 type:<root>.In<T of <root>.Z.create>
VALUE_PARAMETER name:y index:1 type:<root>.In<T of <root>.Z.create>
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 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:IA modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.IA
FUN name:foo visibility:public modality:ABSTRACT <> ($this:<root>.IA) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.IA
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 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:IB modality:ABSTRACT visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.IB
FUN name:bar visibility:public modality:ABSTRACT <> ($this:<root>.IB) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.IB
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 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:test visibility:public modality:FINAL <> (a:<root>.In<<root>.IA>, b:<root>.In<<root>.IB>, z:<root>.Z) returnType:kotlin.Unit
VALUE_PARAMETER name:a index:0 type:<root>.In<<root>.IA>
VALUE_PARAMETER name:b index:1 type:<root>.In<<root>.IB>
VALUE_PARAMETER name:z index:2 type:<root>.Z
BLOCK_BODY
CALL 'public abstract fun foo (): kotlin.Unit declared in <root>.IA' type=kotlin.Unit origin=null
$this: CALL 'public abstract fun <get-t> (): T of <root>.Inv declared in <root>.Inv' type=<root>.IA origin=GET_PROPERTY
$this: CALL 'public abstract fun create <T> (x: <root>.In<T of <root>.Z.create>, y: <root>.In<T of <root>.Z.create>): <root>.Inv<T of <root>.Z.create> declared in <root>.Z' type=<root>.Inv<out kotlin.Any> origin=null
<T>: <root>.IA
$this: GET_VAR 'z: <root>.Z declared in <root>.test' type=<root>.Z origin=null
x: GET_VAR 'a: <root>.In<<root>.IA> declared in <root>.test' type=<root>.In<<root>.IA> origin=null
y: GET_VAR 'b: <root>.In<<root>.IB> declared in <root>.test' type=<root>.In<<root>.IB> origin=null
CALL 'public abstract fun bar (): kotlin.Unit declared in <root>.IB' type=kotlin.Unit origin=null
$this: TYPE_OP type=<root>.IB origin=IMPLICIT_CAST typeOperand=<root>.IB
CALL 'public abstract fun <get-t> (): T of <root>.Inv declared in <root>.Inv' type=<root>.IA origin=GET_PROPERTY
$this: CALL 'public abstract fun create <T> (x: <root>.In<T of <root>.Z.create>, y: <root>.In<T of <root>.Z.create>): <root>.Inv<T of <root>.Z.create> declared in <root>.Z' type=<root>.Inv<out kotlin.Any> origin=null
<T>: <root>.IA
$this: GET_VAR 'z: <root>.Z declared in <root>.test' type=<root>.Z origin=null
x: GET_VAR 'a: <root>.In<<root>.IA> declared in <root>.test' type=<root>.In<<root>.IA> origin=null
y: GET_VAR 'b: <root>.In<<root>.IB> declared in <root>.test' type=<root>.In<<root>.IB> origin=null
VAR name:t type:<root>.IA [val]
CALL 'public abstract fun <get-t> (): T of <root>.Inv declared in <root>.Inv' type=<root>.IA origin=GET_PROPERTY
$this: CALL 'public abstract fun create <T> (x: <root>.In<T of <root>.Z.create>, y: <root>.In<T of <root>.Z.create>): <root>.Inv<T of <root>.Z.create> declared in <root>.Z' type=<root>.Inv<out kotlin.Any> origin=null
<T>: <root>.IA
$this: GET_VAR 'z: <root>.Z declared in <root>.test' type=<root>.Z origin=null
x: GET_VAR 'a: <root>.In<<root>.IA> declared in <root>.test' type=<root>.In<<root>.IA> origin=null
y: GET_VAR 'b: <root>.In<<root>.IB> declared in <root>.test' type=<root>.In<<root>.IB> origin=null
CALL 'public abstract fun foo (): kotlin.Unit declared in <root>.IA' type=kotlin.Unit origin=null
$this: GET_VAR 'val t: <root>.IA declared in <root>.test' type=<root>.IA origin=null
CALL 'public abstract fun bar (): kotlin.Unit declared in <root>.IB' type=kotlin.Unit origin=null
$this: TYPE_OP type=<root>.IB origin=IMPLICIT_CAST typeOperand=<root>.IB
GET_VAR 'val t: <root>.IA declared in <root>.test' type=<root>.IA origin=null
@@ -1,32 +0,0 @@
interface In<in T : Any?> {
}
interface Inv<T : Any?> {
abstract val t: T
abstract get
}
interface Z {
abstract fun <T : Any?> create(x: In<T>, y: In<T>): Inv<T>
}
interface IA {
abstract fun foo()
}
interface IB {
abstract fun bar()
}
fun test(a: In<IA>, b: In<IB>, z: Z) {
z.create<IA>(x = a, y = b).<get-t>().foo()
z.create<IA>(x = a, y = b).<get-t>() /*as IB */.bar()
val t: IA = z.create<IA>(x = a, y = b).<get-t>()
t.foo()
t /*as IB */.bar()
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
interface In<in T>
interface Inv<T> {
@@ -104,8 +104,8 @@ FILE fqName:<root> fileName:/receiverOfIntersectionType.kt
VALUE_PARAMETER name:a index:0 type:<root>.A
VALUE_PARAMETER name:b index:1 type:<root>.B
BLOCK_BODY
VAR name:v type:<root>.I [val]
WHEN type=<root>.I origin=IF
VAR name:v type:<root>.K [val]
WHEN type=<root>.K origin=IF
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: GET_VAR 'a: <root>.A declared in <root>.testIntersection' type=<root>.A origin=null
@@ -113,11 +113,12 @@ FILE fqName:<root> fileName:/receiverOfIntersectionType.kt
if: CONST Boolean type=kotlin.Boolean value=true
then: GET_VAR 'b: <root>.B declared in <root>.testIntersection' type=<root>.B origin=null
CALL 'public abstract fun ff (): kotlin.Unit declared in <root>.I' type=kotlin.Unit origin=null
$this: GET_VAR 'val v: <root>.I declared in <root>.testIntersection' type=<root>.I origin=null
$this: TYPE_OP type=<root>.I origin=IMPLICIT_CAST typeOperand=<root>.I
GET_VAR 'val v: <root>.K declared in <root>.testIntersection' type=<root>.K origin=null
FUN name:testFlexible1 visibility:public modality:FINAL <> () returnType:kotlin.Unit
BLOCK_BODY
VAR name:v type:<root>.I? [val]
WHEN type=<root>.I? origin=IF
VAR name:v type:<root>.K? [val]
WHEN type=<root>.K? origin=IF
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public open fun a (): @[FlexibleNullability] <root>.A? declared in <root>.Java' type=@[FlexibleNullability] <root>.A? origin=null
@@ -125,13 +126,13 @@ FILE fqName:<root> fileName:/receiverOfIntersectionType.kt
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public open fun b (): @[FlexibleNullability] <root>.B? declared in <root>.Java' type=@[FlexibleNullability] <root>.B? origin=null
CALL 'public abstract fun ff (): kotlin.Unit declared in <root>.I' type=kotlin.Unit origin=null
$this: GET_VAR 'val v: <root>.I? declared in <root>.testFlexible1' type=<root>.I? origin=null
$this: GET_VAR 'val v: <root>.K? declared in <root>.testFlexible1' type=<root>.K? origin=null
FUN name:testFlexible2 visibility:public modality:FINAL <> (a:<root>.A, b:<root>.B) returnType:kotlin.Unit
VALUE_PARAMETER name:a index:0 type:<root>.A
VALUE_PARAMETER name:b index:1 type:<root>.B
BLOCK_BODY
VAR name:v type:<root>.I? [val]
WHEN type=<root>.I? origin=IF
VAR name:v type:<root>.K? [val]
WHEN type=<root>.K? origin=IF
BRANCH
if: CONST Boolean type=kotlin.Boolean value=true
then: CALL 'public open fun id <T> (x: @[FlexibleNullability] T of <root>.Java.id?): @[FlexibleNullability] T of <root>.Java.id? declared in <root>.Java' type=@[FlexibleNullability] <root>.A? origin=null
@@ -143,4 +144,4 @@ FILE fqName:<root> fileName:/receiverOfIntersectionType.kt
<T>: @[FlexibleNullability] <root>.B?
x: GET_VAR 'b: <root>.B declared in <root>.testFlexible2' type=<root>.B origin=null
CALL 'public abstract fun ff (): kotlin.Unit declared in <root>.I' type=kotlin.Unit origin=null
$this: GET_VAR 'val v: <root>.I? declared in <root>.testFlexible2' type=<root>.I? origin=null
$this: GET_VAR 'val v: <root>.K? declared in <root>.testFlexible2' type=<root>.K? origin=null
@@ -36,15 +36,15 @@ class B : I, J {
}
fun testIntersection(a: A, b: B) {
val v: I = when {
val v: K = when {
true -> a
else -> b
}
v.ff()
v /*as I */.ff()
}
fun testFlexible1() {
val v: I? = when {
val v: K? = when {
true -> a()
else -> b()
}
@@ -52,9 +52,10 @@ fun testFlexible1() {
}
fun testFlexible2(a: A, b: B) {
val v: I? = when {
val v: K? = when {
true -> id<@FlexibleNullability A?>(x = a)
else -> id<@FlexibleNullability B?>(x = b)
}
v.ff()
}
@@ -21025,6 +21025,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/inference/intersectionTypeInArguments.kt");
}
@Test
@TestMetadata("intersectionWithInvisibleComponent.kt")
public void testIntersectionWithInvisibleComponent() throws Exception {
runTest("compiler/testData/codegen/box/inference/intersectionWithInvisibleComponent.kt");
}
@Test
@TestMetadata("kt10822.kt")
public void testKt10822() throws Exception {
@@ -21025,6 +21025,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
runTest("compiler/testData/codegen/box/inference/intersectionTypeInArguments.kt");
}
@Test
@TestMetadata("intersectionWithInvisibleComponent.kt")
public void testIntersectionWithInvisibleComponent() throws Exception {
runTest("compiler/testData/codegen/box/inference/intersectionWithInvisibleComponent.kt");
}
@Test
@TestMetadata("kt10822.kt")
public void testKt10822() throws Exception {
@@ -17550,6 +17550,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/inference/intersectionTypeInArguments.kt");
}
@TestMetadata("intersectionWithInvisibleComponent.kt")
public void testIntersectionWithInvisibleComponent() throws Exception {
runTest("compiler/testData/codegen/box/inference/intersectionWithInvisibleComponent.kt");
}
@TestMetadata("kt10822.kt")
public void testKt10822() throws Exception {
runTest("compiler/testData/codegen/box/inference/kt10822.kt");
@@ -1,5 +1,3 @@
// IGNORE K2
interface A
interface B
class Inv<T>(e: T)