From f228c3bb04c6f56c7afb302a5a9a56f1fe81855f Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Wed, 21 Apr 2021 13:22:18 +0300 Subject: [PATCH] Add tests for KT-45236 --- .../FirBlackBoxCodegenTestGenerated.java | 6 + .../runners/ir/Fir2IrTextTestGenerated.java | 6 + .../testData/codegen/box/contracts/kt45236.kt | 34 +++ .../ir/irText/regressions/kt45236.fir.txt | 202 +++++++++++++++++ .../testData/ir/irText/regressions/kt45236.kt | 24 ++ .../ir/irText/regressions/kt45236.txt | 214 ++++++++++++++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 6 + .../IrBlackBoxCodegenTestGenerated.java | 6 + .../test/runners/ir/IrTextTestGenerated.java | 6 + .../LightAnalysisModeTestGenerated.java | 5 + .../IrJsCodegenBoxES6TestGenerated.java | 5 + .../IrJsCodegenBoxTestGenerated.java | 5 + .../semantics/JsCodegenBoxTestGenerated.java | 5 + 13 files changed, 524 insertions(+) create mode 100644 compiler/testData/codegen/box/contracts/kt45236.kt create mode 100644 compiler/testData/ir/irText/regressions/kt45236.fir.txt create mode 100644 compiler/testData/ir/irText/regressions/kt45236.kt create mode 100644 compiler/testData/ir/irText/regressions/kt45236.txt diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java index 56749e8d276..e5d9ed623fd 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java @@ -7400,6 +7400,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/contracts/kt39374.kt"); } + @Test + @TestMetadata("kt45236.kt") + public void testKt45236() throws Exception { + runTest("compiler/testData/codegen/box/contracts/kt45236.kt"); + } + @Test @TestMetadata("lambdaParameter.kt") public void testLambdaParameter() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/Fir2IrTextTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/Fir2IrTextTestGenerated.java index 309484d4b6b..484eaf352b3 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/Fir2IrTextTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/ir/Fir2IrTextTestGenerated.java @@ -2400,6 +2400,12 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest { runTest("compiler/testData/ir/irText/regressions/kt24114.kt"); } + @Test + @TestMetadata("kt45236.kt") + public void testKt45236() throws Exception { + runTest("compiler/testData/ir/irText/regressions/kt45236.kt"); + } + @Test @TestMetadata("typeAliasCtorForGenericClass.kt") public void testTypeAliasCtorForGenericClass() throws Exception { diff --git a/compiler/testData/codegen/box/contracts/kt45236.kt b/compiler/testData/codegen/box/contracts/kt45236.kt new file mode 100644 index 00000000000..4bb4c568991 --- /dev/null +++ b/compiler/testData/codegen/box/contracts/kt45236.kt @@ -0,0 +1,34 @@ +// WITH_RUNTIME + +import kotlin.contracts.ExperimentalContracts +import kotlin.contracts.contract + +sealed class NetRequestStatus { + abstract val value: T? + data class Error( + val error: Throwable, + override val value: T? = null, + ) : NetRequestStatus() +} + +@OptIn(ExperimentalContracts::class) +fun NetRequestStatus.isError(): Boolean { + contract { returns(true) implies (this@isError is NetRequestStatus.Error) } + return (this is NetRequestStatus.Error) +} + +fun successOrThrow() { + val nextTerminal: NetRequestStatus = NetRequestStatus.Error(Exception()) + if (nextTerminal.isError()) throw nextTerminal.error +} + + +fun box(): String { + try { + successOrThrow() + } catch (e: Exception) { + return "OK" + } + + return "'successOrThrow<...>()' should throw an exception" +} diff --git a/compiler/testData/ir/irText/regressions/kt45236.fir.txt b/compiler/testData/ir/irText/regressions/kt45236.fir.txt new file mode 100644 index 00000000000..8d340b09d7b --- /dev/null +++ b/compiler/testData/ir/irText/regressions/kt45236.fir.txt @@ -0,0 +1,202 @@ +FILE fqName: fileName:/kt45236.kt + CLASS CLASS name:NetRequestStatus modality:SEALED visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.NetRequestStatus.NetRequestStatus> + TYPE_PARAMETER name:T index:0 variance:out superTypes:[kotlin.Any] + CONSTRUCTOR visibility:protected <> () returnType:.NetRequestStatus.NetRequestStatus> [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:NetRequestStatus modality:SEALED visibility:public superTypes:[kotlin.Any]' + PROPERTY name:value visibility:public modality:ABSTRACT [val] + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:ABSTRACT <> ($this:.NetRequestStatus.NetRequestStatus>) returnType:T of .NetRequestStatus? + correspondingProperty: PROPERTY name:value visibility:public modality:ABSTRACT [val] + $this: VALUE_PARAMETER name: type:.NetRequestStatus.NetRequestStatus> + CLASS CLASS name:Error modality:FINAL visibility:public [data] superTypes:[.NetRequestStatus.NetRequestStatus.Error>] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.NetRequestStatus.Error.NetRequestStatus.Error> + TYPE_PARAMETER name:T index:0 variance:out superTypes:[kotlin.Any] + CONSTRUCTOR visibility:public <> (error:kotlin.Throwable, value:T of .NetRequestStatus.Error?) returnType:.NetRequestStatus.Error.NetRequestStatus.Error> [primary] + VALUE_PARAMETER name:error index:0 type:kotlin.Throwable + VALUE_PARAMETER name:value index:1 type:T of .NetRequestStatus.Error? + EXPRESSION_BODY + CONST Null type=kotlin.Nothing? value=null + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'protected constructor () [primary] declared in .NetRequestStatus' + : T of .NetRequestStatus.Error + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Error modality:FINAL visibility:public [data] superTypes:[.NetRequestStatus.NetRequestStatus.Error>]' + PROPERTY name:error visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:error type:kotlin.Throwable visibility:private [final] + EXPRESSION_BODY + GET_VAR 'error: kotlin.Throwable declared in .NetRequestStatus.Error.' type=kotlin.Throwable origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.NetRequestStatus.Error.NetRequestStatus.Error>) returnType:kotlin.Throwable + correspondingProperty: PROPERTY name:error visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.NetRequestStatus.Error.NetRequestStatus.Error> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.Throwable declared in .NetRequestStatus.Error' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:error type:kotlin.Throwable visibility:private [final]' type=kotlin.Throwable origin=null + receiver: GET_VAR ': .NetRequestStatus.Error.NetRequestStatus.Error> declared in .NetRequestStatus.Error.' type=.NetRequestStatus.Error.NetRequestStatus.Error> origin=null + PROPERTY name:value visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:value type:T of .NetRequestStatus.Error? visibility:private [final] + EXPRESSION_BODY + GET_VAR 'value: T of .NetRequestStatus.Error? declared in .NetRequestStatus.Error.' type=T of .NetRequestStatus.Error? origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.NetRequestStatus.Error.NetRequestStatus.Error>) returnType:T of .NetRequestStatus.Error? + correspondingProperty: PROPERTY name:value visibility:public modality:FINAL [val] + overridden: + public abstract fun (): T of .NetRequestStatus? declared in .NetRequestStatus + $this: VALUE_PARAMETER name: type:.NetRequestStatus.Error.NetRequestStatus.Error> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): T of .NetRequestStatus.Error? declared in .NetRequestStatus.Error' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:value type:T of .NetRequestStatus.Error? visibility:private [final]' type=T of .NetRequestStatus.Error? origin=null + receiver: GET_VAR ': .NetRequestStatus.Error.NetRequestStatus.Error> declared in .NetRequestStatus.Error.' type=.NetRequestStatus.Error.NetRequestStatus.Error> origin=null + FUN name:component1 visibility:public modality:FINAL <> ($this:.NetRequestStatus.Error.NetRequestStatus.Error>) returnType:kotlin.Throwable [operator] + $this: VALUE_PARAMETER name: type:.NetRequestStatus.Error.NetRequestStatus.Error> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.Throwable [operator] declared in .NetRequestStatus.Error' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:error type:kotlin.Throwable visibility:private [final]' type=kotlin.Throwable origin=null + receiver: GET_VAR ': .NetRequestStatus.Error.NetRequestStatus.Error> declared in .NetRequestStatus.Error.component1' type=.NetRequestStatus.Error.NetRequestStatus.Error> origin=null + FUN name:component2 visibility:public modality:FINAL <> ($this:.NetRequestStatus.Error.NetRequestStatus.Error>) returnType:T of .NetRequestStatus.Error? [operator] + $this: VALUE_PARAMETER name: type:.NetRequestStatus.Error.NetRequestStatus.Error> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun component2 (): T of .NetRequestStatus.Error? [operator] declared in .NetRequestStatus.Error' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:value type:T of .NetRequestStatus.Error? visibility:private [final]' type=T of .NetRequestStatus.Error? origin=null + receiver: GET_VAR ': .NetRequestStatus.Error.NetRequestStatus.Error> declared in .NetRequestStatus.Error.component2' type=.NetRequestStatus.Error.NetRequestStatus.Error> origin=null + FUN name:copy visibility:public modality:FINAL <> ($this:.NetRequestStatus.Error.NetRequestStatus.Error>, error:kotlin.Throwable, value:T of .NetRequestStatus.Error?) returnType:.NetRequestStatus.Error.NetRequestStatus.Error> + $this: VALUE_PARAMETER name: type:.NetRequestStatus.Error.NetRequestStatus.Error> + VALUE_PARAMETER name:error index:0 type:kotlin.Throwable + EXPRESSION_BODY + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:error type:kotlin.Throwable visibility:private [final]' type=kotlin.Throwable origin=null + receiver: GET_VAR ': .NetRequestStatus.Error.NetRequestStatus.Error> declared in .NetRequestStatus.Error.copy' type=.NetRequestStatus.Error.NetRequestStatus.Error> origin=null + VALUE_PARAMETER name:value index:1 type:T of .NetRequestStatus.Error? + EXPRESSION_BODY + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:value type:T of .NetRequestStatus.Error? visibility:private [final]' type=T of .NetRequestStatus.Error? origin=null + receiver: GET_VAR ': .NetRequestStatus.Error.NetRequestStatus.Error> declared in .NetRequestStatus.Error.copy' type=.NetRequestStatus.Error.NetRequestStatus.Error> origin=null + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun copy (error: kotlin.Throwable, value: T of .NetRequestStatus.Error?): .NetRequestStatus.Error.NetRequestStatus.Error> declared in .NetRequestStatus.Error' + CONSTRUCTOR_CALL 'public constructor (error: kotlin.Throwable, value: T of .NetRequestStatus.Error?) [primary] declared in .NetRequestStatus.Error' type=.NetRequestStatus.Error.NetRequestStatus.Error> origin=null + : kotlin.Any + error: GET_VAR 'error: kotlin.Throwable declared in .NetRequestStatus.Error.copy' type=kotlin.Throwable origin=null + value: GET_VAR 'value: T of .NetRequestStatus.Error? declared in .NetRequestStatus.Error.copy' type=T of .NetRequestStatus.Error? origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:equals visibility:public modality:OPEN <> ($this:.NetRequestStatus.Error.NetRequestStatus.Error>, 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:.NetRequestStatus.Error.NetRequestStatus.Error> + 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 ': .NetRequestStatus.Error.NetRequestStatus.Error> declared in .NetRequestStatus.Error.equals' type=.NetRequestStatus.Error.NetRequestStatus.Error> origin=null + arg1: GET_VAR 'other: kotlin.Any? declared in .NetRequestStatus.Error.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .NetRequestStatus.Error' + CONST Boolean type=kotlin.Boolean value=true + WHEN type=kotlin.Unit origin=null + BRANCH + if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=.NetRequestStatus.Error.NetRequestStatus.Error> + GET_VAR 'other: kotlin.Any? declared in .NetRequestStatus.Error.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .NetRequestStatus.Error' + CONST Boolean type=kotlin.Boolean value=false + VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:.NetRequestStatus.Error.NetRequestStatus.Error> [val] + TYPE_OP type=.NetRequestStatus.Error.NetRequestStatus.Error> origin=CAST typeOperand=.NetRequestStatus.Error.NetRequestStatus.Error> + GET_VAR 'other: kotlin.Any? declared in .NetRequestStatus.Error.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:error type:kotlin.Throwable visibility:private [final]' type=kotlin.Throwable origin=null + receiver: GET_VAR ': .NetRequestStatus.Error.NetRequestStatus.Error> declared in .NetRequestStatus.Error.equals' type=.NetRequestStatus.Error.NetRequestStatus.Error> origin=null + arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:error type:kotlin.Throwable visibility:private [final]' type=kotlin.Throwable origin=null + receiver: GET_VAR 'val tmp_0: .NetRequestStatus.Error.NetRequestStatus.Error> [val] declared in .NetRequestStatus.Error.equals' type=.NetRequestStatus.Error.NetRequestStatus.Error> origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .NetRequestStatus.Error' + CONST Boolean type=kotlin.Boolean value=false + 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:value type:T of .NetRequestStatus.Error? visibility:private [final]' type=T of .NetRequestStatus.Error? origin=null + receiver: GET_VAR ': .NetRequestStatus.Error.NetRequestStatus.Error> declared in .NetRequestStatus.Error.equals' type=.NetRequestStatus.Error.NetRequestStatus.Error> origin=null + arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:value type:T of .NetRequestStatus.Error? visibility:private [final]' type=T of .NetRequestStatus.Error? origin=null + receiver: GET_VAR 'val tmp_0: .NetRequestStatus.Error.NetRequestStatus.Error> [val] declared in .NetRequestStatus.Error.equals' type=.NetRequestStatus.Error.NetRequestStatus.Error> origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .NetRequestStatus.Error' + CONST Boolean type=kotlin.Boolean value=false + RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean declared in .NetRequestStatus.Error' + CONST Boolean type=kotlin.Boolean value=true + FUN GENERATED_DATA_CLASS_MEMBER name:hashCode visibility:public modality:OPEN <> ($this:.NetRequestStatus.Error.NetRequestStatus.Error>) returnType:kotlin.Int + overridden: + public open fun hashCode (): kotlin.Int declared in kotlin.Any + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.NetRequestStatus.Error.NetRequestStatus.Error> + BLOCK_BODY + VAR name:result type:kotlin.Int [var] + CALL 'public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.Throwable' type=kotlin.Int origin=null + $this: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:error type:kotlin.Throwable visibility:private [final]' type=kotlin.Throwable origin=null + receiver: GET_VAR ': .NetRequestStatus.Error.NetRequestStatus.Error> declared in .NetRequestStatus.Error.hashCode' type=.NetRequestStatus.Error.NetRequestStatus.Error> origin=null + SET_VAR 'var result: kotlin.Int [var] declared in .NetRequestStatus.Error.hashCode' type=kotlin.Unit origin=EQ + CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: GET_VAR 'var result: kotlin.Int [var] declared in .NetRequestStatus.Error.hashCode' type=kotlin.Int origin=null + other: CONST Int type=kotlin.Int value=31 + other: WHEN type=kotlin.Int origin=null + BRANCH + if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ + arg0: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:value type:T of .NetRequestStatus.Error? visibility:private [final]' type=T of .NetRequestStatus.Error? origin=null + receiver: GET_VAR ': .NetRequestStatus.Error.NetRequestStatus.Error> declared in .NetRequestStatus.Error.hashCode' type=.NetRequestStatus.Error.NetRequestStatus.Error> origin=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: CONST Int type=kotlin.Int value=0 + BRANCH + if: CONST Boolean type=kotlin.Boolean value=true + then: CALL 'public open fun hashCode (): kotlin.Int declared in kotlin.Any' type=kotlin.Int origin=null + $this: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:value type:T of .NetRequestStatus.Error? visibility:private [final]' type=T of .NetRequestStatus.Error? origin=null + receiver: GET_VAR ': .NetRequestStatus.Error.NetRequestStatus.Error> declared in .NetRequestStatus.Error.hashCode' type=.NetRequestStatus.Error.NetRequestStatus.Error> origin=null + RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in .NetRequestStatus.Error' + GET_VAR 'var result: kotlin.Int [var] declared in .NetRequestStatus.Error.hashCode' type=kotlin.Int origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:toString visibility:public modality:OPEN <> ($this:.NetRequestStatus.Error.NetRequestStatus.Error>) returnType:kotlin.String + overridden: + public open fun toString (): kotlin.String declared in kotlin.Any + $this: VALUE_PARAMETER GENERATED_DATA_CLASS_MEMBER name: type:.NetRequestStatus.Error.NetRequestStatus.Error> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in .NetRequestStatus.Error' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="Error(" + CONST String type=kotlin.String value="error=" + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:error type:kotlin.Throwable visibility:private [final]' type=kotlin.Throwable origin=null + receiver: GET_VAR ': .NetRequestStatus.Error.NetRequestStatus.Error> declared in .NetRequestStatus.Error.toString' type=.NetRequestStatus.Error.NetRequestStatus.Error> origin=null + CONST String type=kotlin.String value=", " + CONST String type=kotlin.String value="value=" + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:value type:T of .NetRequestStatus.Error? visibility:private [final]' type=T of .NetRequestStatus.Error? origin=null + receiver: GET_VAR ': .NetRequestStatus.Error.NetRequestStatus.Error> declared in .NetRequestStatus.Error.toString' type=.NetRequestStatus.Error.NetRequestStatus.Error> origin=null + CONST String type=kotlin.String value=")" + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: 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: 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: type:kotlin.Any + FUN name:isError visibility:public modality:FINAL ($receiver:.NetRequestStatus.isError>) returnType:kotlin.Boolean + annotations: + OptIn(markerClass = [CLASS_REFERENCE 'CLASS IR_EXTERNAL_DECLARATION_STUB ANNOTATION_CLASS name:ExperimentalContracts modality:FINAL visibility:public superTypes:[kotlin.Annotation]' type=kotlin.reflect.KClass]) + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any] + $receiver: VALUE_PARAMETER name: type:.NetRequestStatus.isError> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun isError (): kotlin.Boolean declared in ' + TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=.NetRequestStatus.Error.isError> + GET_VAR ': .NetRequestStatus.isError> declared in .isError' type=.NetRequestStatus.isError> origin=null + FUN name:successOrThrow visibility:public modality:FINAL () returnType:kotlin.Unit + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any] + BLOCK_BODY + VAR name:nextTerminal type:.NetRequestStatus.successOrThrow> [val] + CONSTRUCTOR_CALL 'public constructor (error: kotlin.Throwable, value: T of .NetRequestStatus.Error?) [primary] declared in .NetRequestStatus.Error' type=.NetRequestStatus.Error.successOrThrow> origin=null + : T of .successOrThrow + error: CONSTRUCTOR_CALL 'public constructor () declared in java.lang.Exception' type=java.lang.Exception origin=null + WHEN type=kotlin.Unit origin=IF + BRANCH + if: CALL 'public final fun isError (): kotlin.Boolean declared in ' type=kotlin.Boolean origin=null + : T of .successOrThrow + $receiver: GET_VAR 'val nextTerminal: .NetRequestStatus.successOrThrow> [val] declared in .successOrThrow' type=.NetRequestStatus.successOrThrow> origin=null + then: THROW type=kotlin.Nothing + CALL 'public final fun (): kotlin.Throwable declared in .NetRequestStatus.Error' type=kotlin.Throwable origin=GET_PROPERTY + $this: TYPE_OP type=.NetRequestStatus.Error.successOrThrow> origin=IMPLICIT_CAST typeOperand=.NetRequestStatus.Error.successOrThrow> + GET_VAR 'val nextTerminal: .NetRequestStatus.successOrThrow> [val] declared in .successOrThrow' type=.NetRequestStatus.successOrThrow> origin=null diff --git a/compiler/testData/ir/irText/regressions/kt45236.kt b/compiler/testData/ir/irText/regressions/kt45236.kt new file mode 100644 index 00000000000..61c7c6fc0d3 --- /dev/null +++ b/compiler/testData/ir/irText/regressions/kt45236.kt @@ -0,0 +1,24 @@ +// WITH_RUNTIME +// SKIP_KT_DUMP + +import kotlin.contracts.ExperimentalContracts +import kotlin.contracts.contract + +sealed class NetRequestStatus { + abstract val value: T? + data class Error( + val error: Throwable, + override val value: T? = null, + ) : NetRequestStatus() +} + +@OptIn(ExperimentalContracts::class) +fun NetRequestStatus.isError(): Boolean { + contract { returns(true) implies (this@isError is NetRequestStatus.Error) } + return (this is NetRequestStatus.Error) +} + +fun successOrThrow() { + val nextTerminal: NetRequestStatus = NetRequestStatus.Error(Exception()) + if (nextTerminal.isError()) throw nextTerminal.error +} diff --git a/compiler/testData/ir/irText/regressions/kt45236.txt b/compiler/testData/ir/irText/regressions/kt45236.txt new file mode 100644 index 00000000000..845c794200d --- /dev/null +++ b/compiler/testData/ir/irText/regressions/kt45236.txt @@ -0,0 +1,214 @@ +FILE fqName: fileName:/kt45236.kt + CLASS CLASS name:NetRequestStatus modality:SEALED visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.NetRequestStatus.NetRequestStatus> + TYPE_PARAMETER name:T index:0 variance:out superTypes:[kotlin.Any] + CONSTRUCTOR visibility:protected <> () returnType:.NetRequestStatus.NetRequestStatus> [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:NetRequestStatus modality:SEALED visibility:public superTypes:[kotlin.Any]' + PROPERTY name:value visibility:public modality:ABSTRACT [val] + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:ABSTRACT <> ($this:.NetRequestStatus.NetRequestStatus>) returnType:T of .NetRequestStatus? + correspondingProperty: PROPERTY name:value visibility:public modality:ABSTRACT [val] + $this: VALUE_PARAMETER name: type:.NetRequestStatus.NetRequestStatus> + CLASS CLASS name:Error modality:FINAL visibility:public [data] superTypes:[.NetRequestStatus.NetRequestStatus.Error>] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.NetRequestStatus.Error.NetRequestStatus.Error> + TYPE_PARAMETER name:T index:0 variance:out superTypes:[kotlin.Any] + CONSTRUCTOR visibility:public <> (error:kotlin.Throwable, value:T of .NetRequestStatus.Error?) returnType:.NetRequestStatus.Error.NetRequestStatus.Error> [primary] + VALUE_PARAMETER name:error index:0 type:kotlin.Throwable + VALUE_PARAMETER name:value index:1 type:T of .NetRequestStatus.Error? + EXPRESSION_BODY + CONST Null type=kotlin.Nothing? value=null + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'protected constructor () [primary] declared in .NetRequestStatus' + : T of .NetRequestStatus.Error + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Error modality:FINAL visibility:public [data] superTypes:[.NetRequestStatus.NetRequestStatus.Error>]' + PROPERTY name:error visibility:public modality:FINAL [val] + FIELD PROPERTY_BACKING_FIELD name:error type:kotlin.Throwable visibility:private [final] + EXPRESSION_BODY + GET_VAR 'error: kotlin.Throwable declared in .NetRequestStatus.Error.' type=kotlin.Throwable origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:.NetRequestStatus.Error.NetRequestStatus.Error>) returnType:kotlin.Throwable + correspondingProperty: PROPERTY name:error visibility:public modality:FINAL [val] + $this: VALUE_PARAMETER name: type:.NetRequestStatus.Error.NetRequestStatus.Error> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.Throwable declared in .NetRequestStatus.Error' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:error type:kotlin.Throwable visibility:private [final]' type=kotlin.Throwable origin=null + receiver: GET_VAR ': .NetRequestStatus.Error.NetRequestStatus.Error> declared in .NetRequestStatus.Error.' type=.NetRequestStatus.Error.NetRequestStatus.Error> origin=null + PROPERTY name:value visibility:public modality:OPEN [val] + FIELD PROPERTY_BACKING_FIELD name:value type:T of .NetRequestStatus.Error? visibility:private [final] + EXPRESSION_BODY + GET_VAR 'value: T of .NetRequestStatus.Error? declared in .NetRequestStatus.Error.' type=T of .NetRequestStatus.Error? origin=INITIALIZE_PROPERTY_FROM_PARAMETER + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:OPEN <> ($this:.NetRequestStatus.Error.NetRequestStatus.Error>) returnType:T of .NetRequestStatus.Error? + correspondingProperty: PROPERTY name:value visibility:public modality:OPEN [val] + overridden: + public abstract fun (): T of .NetRequestStatus? declared in .NetRequestStatus + $this: VALUE_PARAMETER name: type:.NetRequestStatus.Error.NetRequestStatus.Error> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun (): T of .NetRequestStatus.Error? declared in .NetRequestStatus.Error' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:value type:T of .NetRequestStatus.Error? visibility:private [final]' type=T of .NetRequestStatus.Error? origin=null + receiver: GET_VAR ': .NetRequestStatus.Error.NetRequestStatus.Error> declared in .NetRequestStatus.Error.' type=.NetRequestStatus.Error.NetRequestStatus.Error> origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:component1 visibility:public modality:FINAL <> ($this:.NetRequestStatus.Error.NetRequestStatus.Error>) returnType:kotlin.Throwable [operator] + $this: VALUE_PARAMETER name: type:.NetRequestStatus.Error.NetRequestStatus.Error> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun component1 (): kotlin.Throwable [operator] declared in .NetRequestStatus.Error' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:error type:kotlin.Throwable visibility:private [final]' type=kotlin.Throwable origin=null + receiver: GET_VAR ': .NetRequestStatus.Error.NetRequestStatus.Error> declared in .NetRequestStatus.Error.component1' type=.NetRequestStatus.Error.NetRequestStatus.Error> origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:component2 visibility:public modality:FINAL <> ($this:.NetRequestStatus.Error.NetRequestStatus.Error>) returnType:T of .NetRequestStatus.Error? [operator] + $this: VALUE_PARAMETER name: type:.NetRequestStatus.Error.NetRequestStatus.Error> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun component2 (): T of .NetRequestStatus.Error? [operator] declared in .NetRequestStatus.Error' + CALL 'public open fun (): T of .NetRequestStatus.Error? declared in .NetRequestStatus.Error' type=T of .NetRequestStatus.Error? origin=null + $this: GET_VAR ': .NetRequestStatus.Error.NetRequestStatus.Error> declared in .NetRequestStatus.Error.component2' type=.NetRequestStatus.Error.NetRequestStatus.Error> origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:copy visibility:public modality:FINAL <> ($this:.NetRequestStatus.Error.NetRequestStatus.Error>, error:kotlin.Throwable, value:T of .NetRequestStatus.Error?) returnType:.NetRequestStatus.Error.NetRequestStatus.Error> + $this: VALUE_PARAMETER name: type:.NetRequestStatus.Error.NetRequestStatus.Error> + VALUE_PARAMETER name:error index:0 type:kotlin.Throwable + EXPRESSION_BODY + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:error type:kotlin.Throwable visibility:private [final]' type=kotlin.Throwable origin=null + receiver: GET_VAR ': .NetRequestStatus.Error.NetRequestStatus.Error> declared in .NetRequestStatus.Error.copy' type=.NetRequestStatus.Error.NetRequestStatus.Error> origin=null + VALUE_PARAMETER name:value index:1 type:T of .NetRequestStatus.Error? + EXPRESSION_BODY + CALL 'public open fun (): T of .NetRequestStatus.Error? declared in .NetRequestStatus.Error' type=T of .NetRequestStatus.Error? origin=null + $this: GET_VAR ': .NetRequestStatus.Error.NetRequestStatus.Error> declared in .NetRequestStatus.Error.copy' type=.NetRequestStatus.Error.NetRequestStatus.Error> origin=null + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun copy (error: kotlin.Throwable, value: T of .NetRequestStatus.Error?): .NetRequestStatus.Error.NetRequestStatus.Error> declared in .NetRequestStatus.Error' + CONSTRUCTOR_CALL 'public constructor (error: kotlin.Throwable, value: T of .NetRequestStatus.Error?) [primary] declared in .NetRequestStatus.Error' type=.NetRequestStatus.Error.NetRequestStatus.Error> origin=null + : T of .NetRequestStatus.Error + error: GET_VAR 'error: kotlin.Throwable declared in .NetRequestStatus.Error.copy' type=kotlin.Throwable origin=null + value: GET_VAR 'value: T of .NetRequestStatus.Error? declared in .NetRequestStatus.Error.copy' type=T of .NetRequestStatus.Error? origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:toString visibility:public modality:OPEN <> ($this:.NetRequestStatus.Error.NetRequestStatus.Error>) returnType:kotlin.String + overridden: + public open fun toString (): kotlin.String [fake_override] declared in .NetRequestStatus + $this: VALUE_PARAMETER name: type:.NetRequestStatus.Error.NetRequestStatus.Error> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun toString (): kotlin.String declared in .NetRequestStatus.Error' + STRING_CONCATENATION type=kotlin.String + CONST String type=kotlin.String value="Error(" + CONST String type=kotlin.String value="error=" + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:error type:kotlin.Throwable visibility:private [final]' type=kotlin.Throwable origin=null + receiver: GET_VAR ': .NetRequestStatus.Error.NetRequestStatus.Error> declared in .NetRequestStatus.Error.toString' type=.NetRequestStatus.Error.NetRequestStatus.Error> origin=null + CONST String type=kotlin.String value=", " + CONST String type=kotlin.String value="value=" + CALL 'public open fun (): T of .NetRequestStatus.Error? declared in .NetRequestStatus.Error' type=T of .NetRequestStatus.Error? origin=null + $this: GET_VAR ': .NetRequestStatus.Error.NetRequestStatus.Error> declared in .NetRequestStatus.Error.toString' type=.NetRequestStatus.Error.NetRequestStatus.Error> origin=null + CONST String type=kotlin.String value=")" + FUN GENERATED_DATA_CLASS_MEMBER name:hashCode visibility:public modality:OPEN <> ($this:.NetRequestStatus.Error.NetRequestStatus.Error>) returnType:kotlin.Int + overridden: + public open fun hashCode (): kotlin.Int [fake_override] declared in .NetRequestStatus + $this: VALUE_PARAMETER name: type:.NetRequestStatus.Error.NetRequestStatus.Error> + BLOCK_BODY + VAR name:result type:kotlin.Int [var] + CALL 'public open fun hashCode (): kotlin.Int [fake_override] declared in kotlin.Throwable' type=kotlin.Int origin=null + $this: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:error type:kotlin.Throwable visibility:private [final]' type=kotlin.Throwable origin=null + receiver: GET_VAR ': .NetRequestStatus.Error.NetRequestStatus.Error> declared in .NetRequestStatus.Error.hashCode' type=.NetRequestStatus.Error.NetRequestStatus.Error> origin=null + SET_VAR 'var result: kotlin.Int [var] declared in .NetRequestStatus.Error.hashCode' type=kotlin.Unit origin=EQ + CALL 'public final fun plus (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: CALL 'public final fun times (other: kotlin.Int): kotlin.Int [operator] declared in kotlin.Int' type=kotlin.Int origin=null + $this: GET_VAR 'var result: kotlin.Int [var] declared in .NetRequestStatus.Error.hashCode' type=kotlin.Int origin=null + other: CONST Int type=kotlin.Int value=31 + other: WHEN type=kotlin.Int origin=null + BRANCH + if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ + arg0: CALL 'public open fun (): T of .NetRequestStatus.Error? declared in .NetRequestStatus.Error' type=T of .NetRequestStatus.Error? origin=null + $this: GET_VAR ': .NetRequestStatus.Error.NetRequestStatus.Error> declared in .NetRequestStatus.Error.hashCode' type=.NetRequestStatus.Error.NetRequestStatus.Error> origin=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: CONST Int type=kotlin.Int value=0 + BRANCH + if: CONST Boolean type=kotlin.Boolean value=true + then: CALL 'public open fun hashCode (): kotlin.Int declared in kotlin.Any' type=kotlin.Int origin=null + $this: CALL 'public open fun (): T of .NetRequestStatus.Error? declared in .NetRequestStatus.Error' type=T of .NetRequestStatus.Error? origin=null + $this: GET_VAR ': .NetRequestStatus.Error.NetRequestStatus.Error> declared in .NetRequestStatus.Error.hashCode' type=.NetRequestStatus.Error.NetRequestStatus.Error> origin=null + RETURN type=kotlin.Nothing from='public open fun hashCode (): kotlin.Int declared in .NetRequestStatus.Error' + GET_VAR 'var result: kotlin.Int [var] declared in .NetRequestStatus.Error.hashCode' type=kotlin.Int origin=null + FUN GENERATED_DATA_CLASS_MEMBER name:equals visibility:public modality:OPEN <> ($this:.NetRequestStatus.Error.NetRequestStatus.Error>, other:kotlin.Any?) returnType:kotlin.Boolean [operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in .NetRequestStatus + $this: VALUE_PARAMETER name: type:.NetRequestStatus.Error.NetRequestStatus.Error> + 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 ': .NetRequestStatus.Error.NetRequestStatus.Error> declared in .NetRequestStatus.Error.equals' type=.NetRequestStatus.Error.NetRequestStatus.Error> origin=null + arg1: GET_VAR 'other: kotlin.Any? declared in .NetRequestStatus.Error.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .NetRequestStatus.Error' + CONST Boolean type=kotlin.Boolean value=true + WHEN type=kotlin.Unit origin=null + BRANCH + if: TYPE_OP type=kotlin.Boolean origin=NOT_INSTANCEOF typeOperand=.NetRequestStatus.Error.NetRequestStatus.Error> + GET_VAR 'other: kotlin.Any? declared in .NetRequestStatus.Error.equals' type=kotlin.Any? origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .NetRequestStatus.Error' + CONST Boolean type=kotlin.Boolean value=false + VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:.NetRequestStatus.Error.NetRequestStatus.Error> [val] + TYPE_OP type=.NetRequestStatus.Error.NetRequestStatus.Error> origin=CAST typeOperand=.NetRequestStatus.Error.NetRequestStatus.Error> + GET_VAR 'other: kotlin.Any? declared in .NetRequestStatus.Error.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:error type:kotlin.Throwable visibility:private [final]' type=kotlin.Throwable origin=null + receiver: GET_VAR ': .NetRequestStatus.Error.NetRequestStatus.Error> declared in .NetRequestStatus.Error.equals' type=.NetRequestStatus.Error.NetRequestStatus.Error> origin=null + arg1: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:error type:kotlin.Throwable visibility:private [final]' type=kotlin.Throwable origin=null + receiver: GET_VAR 'val tmp_0: .NetRequestStatus.Error.NetRequestStatus.Error> [val] declared in .NetRequestStatus.Error.equals' type=.NetRequestStatus.Error.NetRequestStatus.Error> origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .NetRequestStatus.Error' + CONST Boolean type=kotlin.Boolean value=false + 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: CALL 'public open fun (): T of .NetRequestStatus.Error? declared in .NetRequestStatus.Error' type=T of .NetRequestStatus.Error? origin=null + $this: GET_VAR ': .NetRequestStatus.Error.NetRequestStatus.Error> declared in .NetRequestStatus.Error.equals' type=.NetRequestStatus.Error.NetRequestStatus.Error> origin=null + arg1: CALL 'public open fun (): T of .NetRequestStatus.Error? declared in .NetRequestStatus.Error' type=T of .NetRequestStatus.Error? origin=null + $this: GET_VAR 'val tmp_0: .NetRequestStatus.Error.NetRequestStatus.Error> [val] declared in .NetRequestStatus.Error.equals' type=.NetRequestStatus.Error.NetRequestStatus.Error> origin=null + then: RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .NetRequestStatus.Error' + CONST Boolean type=kotlin.Boolean value=false + RETURN type=kotlin.Nothing from='public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in .NetRequestStatus.Error' + CONST Boolean type=kotlin.Boolean value=true + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any + $this: VALUE_PARAMETER name: 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: 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: type:kotlin.Any + FUN name:isError visibility:public modality:FINAL ($receiver:.NetRequestStatus.isError>) returnType:kotlin.Boolean + annotations: + OptIn(markerClass = [CLASS_REFERENCE 'CLASS IR_EXTERNAL_DECLARATION_STUB ANNOTATION_CLASS name:ExperimentalContracts modality:FINAL visibility:public superTypes:[kotlin.Annotation]' type=kotlin.reflect.KClass]) + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any] + $receiver: VALUE_PARAMETER name: type:.NetRequestStatus.isError> + BLOCK_BODY + CALL 'public final fun contract (builder: @[ExtensionFunctionType] kotlin.Function1): kotlin.Unit [inline] declared in kotlin.contracts.ContractBuilderKt' type=kotlin.Unit origin=null + builder: FUN_EXPR type=@[ExtensionFunctionType] kotlin.Function1 origin=LAMBDA + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> ($receiver:kotlin.contracts.ContractBuilder) returnType:kotlin.Unit + $receiver: VALUE_PARAMETER name:$this$contract type:kotlin.contracts.ContractBuilder + BLOCK_BODY + TYPE_OP type=kotlin.Unit origin=IMPLICIT_COERCION_TO_UNIT typeOperand=kotlin.Unit + CALL 'public abstract fun implies (booleanExpression: kotlin.Boolean): kotlin.contracts.ConditionalEffect [fake_override,infix] declared in kotlin.contracts.Returns' type=kotlin.contracts.ConditionalEffect origin=null + $this: CALL 'public abstract fun returns (value: kotlin.Any?): kotlin.contracts.Returns declared in kotlin.contracts.ContractBuilder' type=kotlin.contracts.Returns origin=null + $this: GET_VAR '$this$contract: kotlin.contracts.ContractBuilder declared in .isError.' type=kotlin.contracts.ContractBuilder origin=null + value: CONST Boolean type=kotlin.Boolean value=true + booleanExpression: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=.NetRequestStatus.Error.isError> + GET_VAR ': .NetRequestStatus.isError> declared in .isError' type=.NetRequestStatus.isError> origin=null + RETURN type=kotlin.Nothing from='public final fun isError (): kotlin.Boolean declared in ' + TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=.NetRequestStatus.Error.isError> + GET_VAR ': .NetRequestStatus.isError> declared in .isError' type=.NetRequestStatus.isError> origin=null + FUN name:successOrThrow visibility:public modality:FINAL () returnType:kotlin.Unit + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any] + BLOCK_BODY + VAR name:nextTerminal type:.NetRequestStatus.successOrThrow> [val] + CONSTRUCTOR_CALL 'public constructor (error: kotlin.Throwable, value: T of .NetRequestStatus.Error?) [primary] declared in .NetRequestStatus.Error' type=.NetRequestStatus.Error.successOrThrow> origin=null + : T of .successOrThrow + error: CONSTRUCTOR_CALL 'public constructor () declared in java.lang.Exception' type=java.lang.Exception origin=null + WHEN type=kotlin.Unit origin=IF + BRANCH + if: CALL 'public final fun isError (): kotlin.Boolean declared in ' type=kotlin.Boolean origin=null + : T of .successOrThrow + $receiver: GET_VAR 'val nextTerminal: .NetRequestStatus.successOrThrow> [val] declared in .successOrThrow' type=.NetRequestStatus.successOrThrow> origin=null + then: THROW type=kotlin.Nothing + CALL 'public final fun (): kotlin.Throwable declared in .NetRequestStatus.Error' type=kotlin.Throwable origin=GET_PROPERTY + $this: TYPE_OP type=.NetRequestStatus.Error.successOrThrow> origin=IMPLICIT_CAST typeOperand=.NetRequestStatus.Error.successOrThrow> + GET_VAR 'val nextTerminal: .NetRequestStatus.successOrThrow> [val] declared in .successOrThrow' type=.NetRequestStatus.successOrThrow> origin=null diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java index 3323c8d3015..312225903c1 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java @@ -7400,6 +7400,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/contracts/kt39374.kt"); } + @Test + @TestMetadata("kt45236.kt") + public void testKt45236() throws Exception { + runTest("compiler/testData/codegen/box/contracts/kt45236.kt"); + } + @Test @TestMetadata("lambdaParameter.kt") public void testLambdaParameter() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index 8926f4000d4..b8dcf997b47 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -7400,6 +7400,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/contracts/kt39374.kt"); } + @Test + @TestMetadata("kt45236.kt") + public void testKt45236() throws Exception { + runTest("compiler/testData/codegen/box/contracts/kt45236.kt"); + } + @Test @TestMetadata("lambdaParameter.kt") public void testLambdaParameter() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/IrTextTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/IrTextTestGenerated.java index 96f6cec71da..9f09a0771a0 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/IrTextTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/ir/IrTextTestGenerated.java @@ -2400,6 +2400,12 @@ public class IrTextTestGenerated extends AbstractIrTextTest { runTest("compiler/testData/ir/irText/regressions/kt24114.kt"); } + @Test + @TestMetadata("kt45236.kt") + public void testKt45236() throws Exception { + runTest("compiler/testData/ir/irText/regressions/kt45236.kt"); + } + @Test @TestMetadata("typeAliasCtorForGenericClass.kt") public void testTypeAliasCtorForGenericClass() throws Exception { diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index a222283b0f9..aecaff6d284 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -5639,6 +5639,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/contracts/kt39374.kt"); } + @TestMetadata("kt45236.kt") + public void testKt45236() throws Exception { + runTest("compiler/testData/codegen/box/contracts/kt45236.kt"); + } + @TestMetadata("lambdaParameter.kt") public void testLambdaParameter() throws Exception { runTest("compiler/testData/codegen/box/contracts/lambdaParameter.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index 878f67bf66e..173c9ba5659 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -4948,6 +4948,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/contracts/kt39374.kt"); } + @TestMetadata("kt45236.kt") + public void testKt45236() throws Exception { + runTest("compiler/testData/codegen/box/contracts/kt45236.kt"); + } + @TestMetadata("lambdaParameter.kt") public void testLambdaParameter() throws Exception { runTest("compiler/testData/codegen/box/contracts/lambdaParameter.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index f959d86aec8..fdf62ec6284 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -4359,6 +4359,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/contracts/kt39374.kt"); } + @TestMetadata("kt45236.kt") + public void testKt45236() throws Exception { + runTest("compiler/testData/codegen/box/contracts/kt45236.kt"); + } + @TestMetadata("lambdaParameter.kt") public void testLambdaParameter() throws Exception { runTest("compiler/testData/codegen/box/contracts/lambdaParameter.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index b745863f31b..c9d47fdc06b 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -4359,6 +4359,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/contracts/kt39374.kt"); } + @TestMetadata("kt45236.kt") + public void testKt45236() throws Exception { + runTest("compiler/testData/codegen/box/contracts/kt45236.kt"); + } + @TestMetadata("lambdaParameter.kt") public void testLambdaParameter() throws Exception { runTest("compiler/testData/codegen/box/contracts/lambdaParameter.kt");