diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java index 5f1ec072168..56ed7cdea14 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/fir/Fir2IrTextTestGenerated.java @@ -2246,6 +2246,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { runTest("compiler/testData/ir/irText/types/starProjection_OI.kt"); } + @TestMetadata("typeAliasWithUnsafeVariance.kt") + public void testTypeAliasWithUnsafeVariance() throws Exception { + runTest("compiler/testData/ir/irText/types/typeAliasWithUnsafeVariance.kt"); + } + @TestMetadata("compiler/testData/ir/irText/types/nullChecks") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/testData/ir/irText/types/typeAliasWithUnsafeVariance.fir.kt.txt b/compiler/testData/ir/irText/types/typeAliasWithUnsafeVariance.fir.kt.txt new file mode 100644 index 00000000000..ad11ecd704c --- /dev/null +++ b/compiler/testData/ir/irText/types/typeAliasWithUnsafeVariance.fir.kt.txt @@ -0,0 +1,51 @@ +typealias Action = Function1 +data class Tag { + constructor(action: Function1) /* primary */ { + super/*Any*/() + /* () */ + + } + + val action: Function1 + field = action + get + + fun component1(): Function1 { + return .#action + } + + fun copy(action: Function1 = .#action): Tag { + return Tag(action = action) + } + + override fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is Tag -> return false + } + val tmp0_other_with_cast: Tag = other as Tag + when { + EQEQ(arg0 = .#action, arg1 = tmp0_other_with_cast.#action).not() -> return false + } + return true + } + + override fun hashCode(): Int { + return .#action.hashCode() + } + + override fun toString(): String { + return "Tag(" + "action=" + .#action + ")" + } + +} + +fun getTag(): Tag<*> { + return throw Exception() +} + +fun doAction() { + getTag().() /*~> Unit */ +} diff --git a/compiler/testData/ir/irText/types/typeAliasWithUnsafeVariance.fir.txt b/compiler/testData/ir/irText/types/typeAliasWithUnsafeVariance.fir.txt new file mode 100644 index 00000000000..66300117be1 --- /dev/null +++ b/compiler/testData/ir/irText/types/typeAliasWithUnsafeVariance.fir.txt @@ -0,0 +1,104 @@ +FILE fqName: fileName:/typeAliasWithUnsafeVariance.kt + TYPEALIAS name:Action visibility:public expandedType:kotlin.Function1.Action, kotlin.Unit> + TYPE_PARAMETER name:RenderingT index:0 variance: superTypes:[kotlin.Any?] + CLASS CLASS name:Tag modality:FINAL visibility:public [data] superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Tag.Tag> + TYPE_PARAMETER name:RenderingT index:0 variance:out superTypes:[kotlin.Any?] + CONSTRUCTOR visibility:public <> (action:kotlin.Function1.Tag, kotlin.Unit>) returnType:.Tag.Tag> [primary] + VALUE_PARAMETER name:action index:0 type:kotlin.Function1.Tag, kotlin.Unit> + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Tag modality:FINAL visibility:public [data] superTypes:[kotlin.Any]' + PROPERTY name:action visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:action type:kotlin.Function1.Tag, kotlin.Unit> visibility:private [final] + EXPRESSION_BODY + GET_VAR 'action: kotlin.Function1.Tag, kotlin.Unit> declared in .Tag.' type=kotlin.Function1.Tag, kotlin.Unit> origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Tag.Tag>) returnType:kotlin.Function1.Tag, kotlin.Unit> + correspondingProperty: PROPERTY name:action visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.Tag.Tag> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.Function1.Tag, kotlin.Unit> declared in .Tag' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:action type:kotlin.Function1.Tag, kotlin.Unit> visibility:private [final]' type=kotlin.Function1.Tag, kotlin.Unit> origin=null + receiver: GET_VAR ': .Tag.Tag> declared in .Tag.' type=.Tag.Tag> origin=null + FUN name:component1 visibility:public modality:FINAL <> ($this:.Tag.Tag>) returnType:kotlin.Function1.Tag, kotlin.Unit> + $this: VALUE_PARAMETER name: type:.Tag.Tag> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.Function1.Tag, kotlin.Unit> declared in .Tag' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:action type:kotlin.Function1.Tag, kotlin.Unit> visibility:private [final]' type=kotlin.Function1.Tag, kotlin.Unit> origin=null + receiver: GET_VAR ': .Tag.Tag> declared in .Tag.component1' type=.Tag.Tag> origin=null + FUN name:copy visibility:public modality:FINAL <> ($this:.Tag.Tag>, action:kotlin.Function1.Tag, kotlin.Unit>) returnType:.Tag.Tag> + $this: VALUE_PARAMETER name: type:.Tag.Tag> + VALUE_PARAMETER name:action index:0 type:kotlin.Function1.Tag, kotlin.Unit> + EXPRESSION_BODY + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:action type:kotlin.Function1.Tag, kotlin.Unit> visibility:private [final]' type=kotlin.Function1.Tag, kotlin.Unit> origin=null + receiver: GET_VAR ': .Tag.Tag> declared in .Tag.copy' type=.Tag.Tag> origin=null + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun copy (action: kotlin.Function1.Tag, kotlin.Unit>): .Tag.Tag> declared in .Tag' + CONSTRUCTOR_CALL 'public constructor (action: kotlin.Function1.Tag, kotlin.Unit>) [primary] declared in .Tag' type=.Tag.Tag> origin=null + : kotlin.Any + action: GET_VAR 'action: kotlin.Function1.Tag, kotlin.Unit> declared in .Tag.copy' type=kotlin.Function1.Tag, kotlin.Unit> origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:equals visibility:public modality:OPEN <> ($this:.Tag.Tag>, other:kotlin.Any?) returnType:kotlin.Boolean + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.Tag.Tag> + VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name:other index:0 type:kotlin.Any? + BLOCK_BODY + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun EQEQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQEQ + arg0: GET_VAR ': .Tag.Tag> declared in .Tag.equals' type=.Tag.Tag> origin=null + arg1: GET_VAR 'other: kotlin.Any? declared in .Tag.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Tag' + CONST Boolean type=kotlin.Boolean value=true + WHEN type=kotlin.Unit origin=null + BRANCH + if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=.Tag.Tag> + GET_VAR 'other: kotlin.Any? declared in .Tag.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Tag' + CONST Boolean type=kotlin.Boolean value=false + VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:.Tag.Tag> [val] + TYPE_OP type=.Tag.Tag> origin=CAST typeOperand=.Tag.Tag> + GET_VAR 'other: kotlin.Any? declared in .Tag.equals' type=kotlin.Any? origin=null + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean [operator] 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: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:action type:kotlin.Function1.Tag, kotlin.Unit> visibility:private [final]' type=kotlin.Function1.Tag, kotlin.Unit> origin=null + receiver: GET_VAR ': .Tag.Tag> declared in .Tag.equals' type=.Tag.Tag> origin=null + arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:action type:kotlin.Function1.Tag, kotlin.Unit> visibility:private [final]' type=kotlin.Function1.Tag, kotlin.Unit> origin=null + receiver: GET_VAR 'val tmp_0: .Tag.Tag> [val] declared in .Tag.equals' type=.Tag.Tag> origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Tag' + CONST Boolean type=kotlin.Boolean value=false + RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .Tag' + CONST Boolean type=kotlin.Boolean value=true + FUN GENERATED_DATA_CLASS_MEMBER name:hashCode visibility:public modality:OPEN <> ($this:.Tag.Tag>) returnType:kotlin.Int + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.Tag.Tag> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in .Tag' + CALL 'public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.Function1' type=kotlin.Int origin=null + $this: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:action type:kotlin.Function1.Tag, kotlin.Unit> visibility:private [final]' type=kotlin.Function1.Tag, kotlin.Unit> origin=null + receiver: GET_VAR ': .Tag.Tag> declared in .Tag.hashCode' type=.Tag.Tag> origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:toString visibility:public modality:OPEN <> ($this:.Tag.Tag>) returnType:kotlin.String + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.Tag.Tag> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in .Tag' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="Tag(" + CONST String type=kotlin.String value="action=" + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:action type:kotlin.Function1.Tag, kotlin.Unit> visibility:private [final]' type=kotlin.Function1.Tag, kotlin.Unit> origin=null + receiver: GET_VAR ': .Tag.Tag> declared in .Tag.toString' type=.Tag.Tag> origin=null + CONST String type=kotlin.String value=")" + FUN name:getTag visibility:public modality:FINAL <> () returnType:.Tag<*> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun getTag (): .Tag<*> declared in ' + THROW type=kotlin.Nothing + CONSTRUCTOR_CALL 'public constructor () declared in java.lang.Exception' type=java.lang.Exception origin=null + FUN name:doAction visibility:public modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + CALL 'public final fun (): kotlin.Function1.Tag, kotlin.Unit> declared in .Tag' type=kotlin.Function1 origin=GET_PROPERTY + $this: CALL 'public final fun getTag (): .Tag<*> declared in ' type=.Tag<*> origin=null diff --git a/compiler/testData/ir/irText/types/typeAliasWithUnsafeVariance.kt b/compiler/testData/ir/irText/types/typeAliasWithUnsafeVariance.kt new file mode 100644 index 00000000000..5261aab0215 --- /dev/null +++ b/compiler/testData/ir/irText/types/typeAliasWithUnsafeVariance.kt @@ -0,0 +1,14 @@ +// !LANGUAGE: +NewInference + +// KT-42036 + +typealias Action = (@UnsafeVariance RenderingT) -> Unit +// When a typealias is used, the compiler crashes. +data class Tag(val action: Action) +// When no typealias is used, the compiler is fine. +//data class Tag(val action: (@UnsafeVariance RenderingT) -> Unit) +fun getTag(): Tag<*> = throw Exception() +fun doAction() { + // This line crashes the compiler. + getTag().action +} \ No newline at end of file diff --git a/compiler/testData/ir/irText/types/typeAliasWithUnsafeVariance.kt.txt b/compiler/testData/ir/irText/types/typeAliasWithUnsafeVariance.kt.txt new file mode 100644 index 00000000000..d62f18582aa --- /dev/null +++ b/compiler/testData/ir/irText/types/typeAliasWithUnsafeVariance.kt.txt @@ -0,0 +1,51 @@ +typealias Action = Function1<@UnsafeVariance RenderingT, Unit> +data class Tag { + constructor(action: Function1<@UnsafeVariance RenderingT, Unit>) /* primary */ { + super/*Any*/() + /* () */ + + } + + val action: Function1<@UnsafeVariance RenderingT, Unit> + field = action + get + + operator fun component1(): Function1<@UnsafeVariance RenderingT, Unit> { + return .#action + } + + fun copy(action: Function1<@UnsafeVariance RenderingT, Unit> = .#action): Tag { + return Tag(action = action) + } + + override fun toString(): String { + return "Tag(" + "action=" + .#action + ")" + } + + override fun hashCode(): Int { + return .#action.hashCode() + } + + override operator fun equals(other: Any?): Boolean { + when { + EQEQEQ(arg0 = , arg1 = other) -> return true + } + when { + other !is Tag -> return false + } + val tmp0_other_with_cast: Tag = other as Tag + when { + EQEQ(arg0 = .#action, arg1 = tmp0_other_with_cast.#action).not() -> return false + } + return true + } + +} + +fun getTag(): Tag<*> { + throw Exception() +} + +fun doAction() { + getTag().() /*~> Unit */ +} diff --git a/compiler/testData/ir/irText/types/typeAliasWithUnsafeVariance.txt b/compiler/testData/ir/irText/types/typeAliasWithUnsafeVariance.txt new file mode 100644 index 00000000000..329ceddc9bf --- /dev/null +++ b/compiler/testData/ir/irText/types/typeAliasWithUnsafeVariance.txt @@ -0,0 +1,103 @@ +FILE fqName: fileName:/typeAliasWithUnsafeVariance.kt + TYPEALIAS name:Action visibility:public expandedType:kotlin.Function1<@[UnsafeVariance] RenderingT of .Action, kotlin.Unit> + TYPE_PARAMETER name:RenderingT index:0 variance: superTypes:[kotlin.Any?] + CLASS CLASS name:Tag modality:FINAL visibility:public [data] superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Tag.Tag> + TYPE_PARAMETER name:RenderingT index:0 variance:out superTypes:[kotlin.Any?] + CONSTRUCTOR visibility:public <> (action:kotlin.Function1<@[UnsafeVariance] RenderingT of .Tag, kotlin.Unit>{ .Action.Tag> }) returnType:.Tag.Tag> [primary] + VALUE_PARAMETER name:action index:0 type:kotlin.Function1<@[UnsafeVariance] RenderingT of .Tag, kotlin.Unit>{ .Action.Tag> } + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Tag modality:FINAL visibility:public [data] superTypes:[kotlin.Any]' + PROPERTY name:action visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:action type:kotlin.Function1<@[UnsafeVariance] RenderingT of .Tag, kotlin.Unit>{ .Action.Tag> } visibility:private [final] + EXPRESSION_BODY + GET_VAR 'action: kotlin.Function1<@[UnsafeVariance] RenderingT of .Tag, kotlin.Unit>{ .Action.Tag> } declared in .Tag.' type=kotlin.Function1<@[UnsafeVariance] RenderingT of .Tag, kotlin.Unit>{ .Action.Tag> } origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.Tag.Tag>) returnType:kotlin.Function1<@[UnsafeVariance] RenderingT of .Tag, kotlin.Unit>{ .Action.Tag> } + correspondingProperty: PROPERTY name:action visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.Tag.Tag> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.Function1<@[UnsafeVariance] RenderingT of .Tag, kotlin.Unit>{ .Action.Tag> } declared in .Tag' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:action type:kotlin.Function1<@[UnsafeVariance] RenderingT of .Tag, kotlin.Unit>{ .Action.Tag> } visibility:private [final]' type=kotlin.Function1<@[UnsafeVariance] RenderingT of .Tag, kotlin.Unit>{ .Action.Tag> } origin=null + receiver: GET_VAR ': .Tag.Tag> declared in .Tag.' type=.Tag.Tag> origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:component1 visibility:public modality:FINAL <> ($this:.Tag.Tag>) returnType:kotlin.Function1<@[UnsafeVariance] RenderingT of .Tag, kotlin.Unit>{ .Action.Tag> } [operator] + $this: VALUE_PARAMETER name: type:.Tag.Tag> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.Function1<@[UnsafeVariance] RenderingT of .Tag, kotlin.Unit>{ .Action.Tag> } [operator] declared in .Tag' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:action type:kotlin.Function1<@[UnsafeVariance] RenderingT of .Tag, kotlin.Unit>{ .Action.Tag> } visibility:private [final]' type=kotlin.Function1<@[UnsafeVariance] RenderingT of .Tag, kotlin.Unit>{ .Action.Tag> } origin=null + receiver: GET_VAR ': .Tag.Tag> declared in .Tag.component1' type=.Tag.Tag> origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:copy visibility:public modality:FINAL <> ($this:.Tag.Tag>, action:kotlin.Function1<@[UnsafeVariance] RenderingT of .Tag, kotlin.Unit>{ .Action.Tag> }) returnType:.Tag.Tag> + $this: VALUE_PARAMETER name: type:.Tag.Tag> + VALUE_PARAMETER name:action index:0 type:kotlin.Function1<@[UnsafeVariance] RenderingT of .Tag, kotlin.Unit>{ .Action.Tag> } + EXPRESSION_BODY + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:action type:kotlin.Function1<@[UnsafeVariance] RenderingT of .Tag, kotlin.Unit>{ .Action.Tag> } visibility:private [final]' type=kotlin.Function1<@[UnsafeVariance] RenderingT of .Tag, kotlin.Unit>{ .Action.Tag> } origin=null + receiver: GET_VAR ': .Tag.Tag> declared in .Tag.copy' type=.Tag.Tag> origin=null + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun copy (action: kotlin.Function1<@[UnsafeVariance] RenderingT of .Tag, kotlin.Unit>{ .Action.Tag> }): .Tag.Tag> declared in .Tag' + CONSTRUCTOR_CALL 'public constructor (action: kotlin.Function1<@[UnsafeVariance] RenderingT of .Tag, kotlin.Unit>{ .Action.Tag> }) [primary] declared in .Tag' type=.Tag.Tag> origin=null + : RenderingT of .Tag + action: GET_VAR 'action: kotlin.Function1<@[UnsafeVariance] RenderingT of .Tag, kotlin.Unit>{ .Action.Tag> } declared in .Tag.copy' type=kotlin.Function1<@[UnsafeVariance] RenderingT of .Tag, kotlin.Unit>{ .Action.Tag> } origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:toString visibility:public modality:OPEN <> ($this:.Tag.Tag>) returnType:kotlin.String + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER name: type:.Tag.Tag> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in .Tag' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="Tag(" + CONST String type=kotlin.String value="action=" + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:action type:kotlin.Function1<@[UnsafeVariance] RenderingT of .Tag, kotlin.Unit>{ .Action.Tag> } visibility:private [final]' type=kotlin.Function1<@[UnsafeVariance] RenderingT of .Tag, kotlin.Unit>{ .Action.Tag> } origin=null + receiver: GET_VAR ': .Tag.Tag> declared in .Tag.toString' type=.Tag.Tag> origin=null + CONST String type=kotlin.String value=")" + FUN GENERATED_DATA_CLASS_MEMBER name:hashCode visibility:public modality:OPEN <> ($this:.Tag.Tag>) returnType:kotlin.Int + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER name: type:.Tag.Tag> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in .Tag' + CALL 'public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.Function1' type=kotlin.Int origin=null + $this: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:action type:kotlin.Function1<@[UnsafeVariance] RenderingT of .Tag, kotlin.Unit>{ .Action.Tag> } visibility:private [final]' type=kotlin.Function1<@[UnsafeVariance] RenderingT of .Tag, kotlin.Unit>{ .Action.Tag> } origin=null + receiver: GET_VAR ': .Tag.Tag> declared in .Tag.hashCode' type=.Tag.Tag> origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:equals visibility:public modality:OPEN <> ($this:.Tag.Tag>, other:kotlin.Any?) returnType:kotlin.Boolean [operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: type:.Tag.Tag> + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + BLOCK_BODY + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun EQEQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQEQ + arg0: GET_VAR ': .Tag.Tag> declared in .Tag.equals' type=.Tag.Tag> origin=null + arg1: GET_VAR 'other: kotlin.Any? declared in .Tag.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .Tag' + CONST Boolean type=kotlin.Boolean value=true + WHEN type=kotlin.Unit origin=null + BRANCH + if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=.Tag.Tag> + GET_VAR 'other: kotlin.Any? declared in .Tag.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .Tag' + CONST Boolean type=kotlin.Boolean value=false + VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:.Tag.Tag> [val] + TYPE_OP type=.Tag.Tag> origin=CAST typeOperand=.Tag.Tag> + GET_VAR 'other: kotlin.Any? declared in .Tag.equals' type=kotlin.Any? origin=null + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun not (): kotlin.Boolean [operator] 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: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:action type:kotlin.Function1<@[UnsafeVariance] RenderingT of .Tag, kotlin.Unit>{ .Action.Tag> } visibility:private [final]' type=kotlin.Function1<@[UnsafeVariance] RenderingT of .Tag, kotlin.Unit>{ .Action.Tag> } origin=null + receiver: GET_VAR ': .Tag.Tag> declared in .Tag.equals' type=.Tag.Tag> origin=null + arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:action type:kotlin.Function1<@[UnsafeVariance] RenderingT of .Tag, kotlin.Unit>{ .Action.Tag> } visibility:private [final]' type=kotlin.Function1<@[UnsafeVariance] RenderingT of .Tag, kotlin.Unit>{ .Action.Tag> } origin=null + receiver: GET_VAR 'val tmp_0: .Tag.Tag> [val] declared in .Tag.equals' type=.Tag.Tag> origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .Tag' + CONST Boolean type=kotlin.Boolean value=false + RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .Tag' + CONST Boolean type=kotlin.Boolean value=true + FUN name:getTag visibility:public modality:FINAL <> () returnType:.Tag<*> + BLOCK_BODY + THROW type=kotlin.Nothing + CONSTRUCTOR_CALL 'public constructor () declared in java.lang.Exception' type=java.lang.Exception origin=null + FUN name:doAction visibility:public modality:FINAL <> () returnType:kotlin.Unit + BLOCK_BODY + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + CALL 'public final fun (): kotlin.Function1<@[UnsafeVariance] RenderingT of .Tag, kotlin.Unit>{ .Action.Tag> } declared in .Tag' type=kotlin.Function1{ .Action } origin=GET_PROPERTY + $this: CALL 'public final fun getTag (): .Tag<*> declared in ' type=.Tag<*> origin=null diff --git a/compiler/tests-gen/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java index 5223278165b..a5a06590a09 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/ir/IrTextTestCaseGenerated.java @@ -2245,6 +2245,11 @@ public class IrTextTestCaseGenerated extends AbstractIrTextTestCase { runTest("compiler/testData/ir/irText/types/starProjection_OI.kt"); } + @TestMetadata("typeAliasWithUnsafeVariance.kt") + public void testTypeAliasWithUnsafeVariance() throws Exception { + runTest("compiler/testData/ir/irText/types/typeAliasWithUnsafeVariance.kt"); + } + @TestMetadata("compiler/testData/ir/irText/types/nullChecks") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class)