From d08567c2c726aa72f27162f189e2e5863540a572 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Mon, 6 Nov 2023 14:34:04 +0200 Subject: [PATCH] [FIR2IR] Approximate extension receiver type after type argument substitution Frontend may leak captured types into type arguments, so they should be approximated before using them in fir2ir cast inserter to determine a specific type from smartcast ^KT-62863 Fixed --- ...LFirBlackBoxCodegenBasedTestGenerated.java | 6 + ...rsedBlackBoxCodegenBasedTestGenerated.java | 6 + .../fir/backend/Fir2IrImplicitCastInserter.kt | 9 +- ...LightTreeBlackBoxCodegenTestGenerated.java | 6 + ...hIrFakeOverrideGeneratorTestGenerated.java | 6 + .../FirPsiBlackBoxCodegenTestGenerated.java | 6 + .../box/smartCasts/smartcastToStarType.ir.txt | 111 ++++++++++++++++++ .../box/smartCasts/smartcastToStarType.kt | 29 +++++ .../codegen/BlackBoxCodegenTestGenerated.java | 6 + .../IrBlackBoxCodegenTestGenerated.java | 6 + ...kBoxCodegenWithIrInlinerTestGenerated.java | 6 + .../LightAnalysisModeTestGenerated.java | 5 + .../fir/FirJsCodegenBoxTestGenerated.java | 6 + .../fir/FirJsES6CodegenBoxTestGenerated.java | 6 + .../test/ir/IrJsCodegenBoxTestGenerated.java | 6 + .../ir/IrJsES6CodegenBoxTestGenerated.java | 6 + .../FirNativeCodegenBoxTestGenerated.java | 6 + .../FirNativeCodegenBoxTestNoPLGenerated.java | 6 + .../NativeCodegenBoxTestGenerated.java | 6 + .../NativeCodegenBoxTestNoPLGenerated.java | 6 + .../test/FirWasmCodegenBoxTestGenerated.java | 6 + .../test/K1WasmCodegenBoxTestGenerated.java | 6 + 22 files changed, 261 insertions(+), 1 deletion(-) create mode 100644 compiler/testData/codegen/box/smartCasts/smartcastToStarType.ir.txt create mode 100644 compiler/testData/codegen/box/smartCasts/smartcastToStarType.kt diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirBlackBoxCodegenBasedTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirBlackBoxCodegenBasedTestGenerated.java index e5ae879c91c..f3a2a40684f 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirBlackBoxCodegenBasedTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirBlackBoxCodegenBasedTestGenerated.java @@ -51314,6 +51314,12 @@ public class LLFirBlackBoxCodegenBasedTestGenerated extends AbstractLLFirBlackBo runTest("compiler/testData/codegen/box/smartCasts/smartcastOnImplicitDispatchReceiver.kt"); } + @Test + @TestMetadata("smartcastToStarType.kt") + public void testSmartcastToStarType() throws Exception { + runTest("compiler/testData/codegen/box/smartCasts/smartcastToStarType.kt"); + } + @Test @TestMetadata("toStringOnReceiverWIthSmartcast.kt") public void testToStringOnReceiverWIthSmartcast() throws Exception { diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirReversedBlackBoxCodegenBasedTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirReversedBlackBoxCodegenBasedTestGenerated.java index 304a4065bc2..4d17dbcc17d 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirReversedBlackBoxCodegenBasedTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirReversedBlackBoxCodegenBasedTestGenerated.java @@ -51314,6 +51314,12 @@ public class LLFirReversedBlackBoxCodegenBasedTestGenerated extends AbstractLLFi runTest("compiler/testData/codegen/box/smartCasts/smartcastOnImplicitDispatchReceiver.kt"); } + @Test + @TestMetadata("smartcastToStarType.kt") + public void testSmartcastToStarType() throws Exception { + runTest("compiler/testData/codegen/box/smartCasts/smartcastToStarType.kt"); + } + @Test @TestMetadata("toStringOnReceiverWIthSmartcast.kt") public void testToStringOnReceiverWIthSmartcast() throws Exception { diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrImplicitCastInserter.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrImplicitCastInserter.kt index dad862c7419..62df68fd97e 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrImplicitCastInserter.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrImplicitCastInserter.kt @@ -27,6 +27,7 @@ import org.jetbrains.kotlin.ir.util.classId import org.jetbrains.kotlin.ir.util.parentAsClass import org.jetbrains.kotlin.name.StandardClassIds import org.jetbrains.kotlin.types.AbstractTypeChecker +import org.jetbrains.kotlin.types.TypeApproximatorConfiguration class Fir2IrImplicitCastInserter( private val components: Fir2IrComponents @@ -313,7 +314,13 @@ class Fir2IrImplicitCastInserter( receiver === extensionReceiver -> { val extensionReceiverType = referencedDeclaration?.receiverParameter?.typeRef?.coneType ?: return null val substitutor = createSubstitutorFromTypeArguments(selector, referencedDeclaration) - substitutor.substituteOrSelf(extensionReceiverType) + val substitutedType = substitutor.substituteOrSelf(extensionReceiverType) + // Frontend may write captured types as type arguments (by design), so we need to approximate receiver type after substitution + val approximatedType = session.typeApproximator.approximateToSuperType( + substitutedType, + TypeApproximatorConfiguration.InternalTypesApproximation + ) + approximatedType ?: substitutedType } else -> return null } diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java index f570ebce432..12c6f0677d7 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java @@ -50733,6 +50733,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr runTest("compiler/testData/codegen/box/smartCasts/smartcastOnImplicitDispatchReceiver.kt"); } + @Test + @TestMetadata("smartcastToStarType.kt") + public void testSmartcastToStarType() throws Exception { + runTest("compiler/testData/codegen/box/smartCasts/smartcastToStarType.kt"); + } + @Test @TestMetadata("toStringOnReceiverWIthSmartcast.kt") public void testToStringOnReceiverWIthSmartcast() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated.java index 0c8869694b3..67d34609528 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated.java @@ -50733,6 +50733,12 @@ public class FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated runTest("compiler/testData/codegen/box/smartCasts/smartcastOnImplicitDispatchReceiver.kt"); } + @Test + @TestMetadata("smartcastToStarType.kt") + public void testSmartcastToStarType() throws Exception { + runTest("compiler/testData/codegen/box/smartCasts/smartcastToStarType.kt"); + } + @Test @TestMetadata("toStringOnReceiverWIthSmartcast.kt") public void testToStringOnReceiverWIthSmartcast() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java index 8ee0e974f01..f63bccd46ca 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java @@ -50733,6 +50733,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo runTest("compiler/testData/codegen/box/smartCasts/smartcastOnImplicitDispatchReceiver.kt"); } + @Test + @TestMetadata("smartcastToStarType.kt") + public void testSmartcastToStarType() throws Exception { + runTest("compiler/testData/codegen/box/smartCasts/smartcastToStarType.kt"); + } + @Test @TestMetadata("toStringOnReceiverWIthSmartcast.kt") public void testToStringOnReceiverWIthSmartcast() throws Exception { diff --git a/compiler/testData/codegen/box/smartCasts/smartcastToStarType.ir.txt b/compiler/testData/codegen/box/smartCasts/smartcastToStarType.ir.txt new file mode 100644 index 00000000000..a591c3c7fe7 --- /dev/null +++ b/compiler/testData/codegen/box/smartCasts/smartcastToStarType.ir.txt @@ -0,0 +1,111 @@ +FILE fqName: fileName:/smartcastToStarType.kt + CLASS INTERFACE name:Base modality:ABSTRACT visibility:public superTypes:[kotlin.Any] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Base.Base> + TYPE_PARAMETER name:T index:0 variance:out superTypes:[kotlin.Any?] reified:false + FUN name:foo visibility:public modality:ABSTRACT <> ($this:.Base.Base>) returnType:T of .Base + $this: VALUE_PARAMETER name: type:.Base.Base> + 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: 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 + CLASS CLASS name:Derived modality:FINAL visibility:public superTypes:[.Base.Derived>] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Derived.Derived> + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false + CONSTRUCTOR visibility:public <> () returnType:.Derived.Derived> [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Derived modality:FINAL visibility:public superTypes:[.Base.Derived>]' + FUN name:foo visibility:public modality:OPEN <> ($this:.Derived.Derived>) returnType:T of .Derived + overridden: + public abstract fun foo (): T of .Base declared in .Base + $this: VALUE_PARAMETER name: type:.Derived.Derived> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun foo (): T of .Derived declared in .Derived' + TYPE_OP type=T of .Derived origin=CAST typeOperand=T of .Derived + CONST String type=kotlin.String value="error" + 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 .Base + $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 .Base + $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 .Base + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN name:bar visibility:public modality:FINAL ($receiver:.Derived.bar>) returnType:.Base.bar> + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false + $receiver: VALUE_PARAMETER name: type:.Derived.bar> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun bar (): .Base.bar> declared in ' + BLOCK type=.bar..bar> origin=OBJECT_LITERAL + CLASS CLASS name: modality:FINAL visibility:local superTypes:[.Base.bar>] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.bar..bar> + CONSTRUCTOR visibility:public <> () returnType:.bar..bar> [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name: modality:FINAL visibility:local superTypes:[.Base.bar>]' + FUN name:foo visibility:public modality:OPEN <> ($this:.bar..bar>) returnType:T of .bar + overridden: + public abstract fun foo (): T of .Base declared in .Base + $this: VALUE_PARAMETER name: type:.bar..bar> + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun foo (): T of .bar declared in .bar.' + TYPE_OP type=T of .bar origin=CAST typeOperand=T of .bar + CONST String type=kotlin.String value="OK" + 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 .Base + $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 .Base + $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 .Base + $this: VALUE_PARAMETER name: type:kotlin.Any + CONSTRUCTOR_CALL 'public constructor () declared in .bar.' type=.bar..bar> origin=OBJECT_LITERAL + FUN name:test visibility:public modality:FINAL (x:.Base.test>) returnType:T of .test + TYPE_PARAMETER name:T index:0 variance: superTypes:[kotlin.Any?] reified:false + VALUE_PARAMETER name:x index:0 type:.Base.test> + BLOCK_BODY + WHEN type=kotlin.Unit origin=IF + BRANCH + if: TYPE_OP type=kotlin.Boolean origin=INSTANCEOF typeOperand=.Derived<*> + GET_VAR 'x: .Base.test> declared in .test' type=.Base.test> origin=null + then: BLOCK type=kotlin.Unit origin=null + VAR name:y type:.Base [val] + CALL 'public final fun bar (): .Base.bar> declared in ' type=.Base origin=null + : kotlin.Any? + $receiver: TYPE_OP type=.Derived<*> origin=IMPLICIT_CAST typeOperand=.Derived<*> + GET_VAR 'x: .Base.test> declared in .test' type=.Base.test> origin=null + RETURN type=kotlin.Nothing from='public final fun test (x: .Base.test>): T of .test declared in ' + TYPE_OP type=T of .test origin=CAST typeOperand=T of .test + CALL 'public abstract fun foo (): T of .Base declared in .Base' type=kotlin.Any? origin=null + $this: GET_VAR 'val y: .Base declared in .test' type=.Base origin=null + RETURN type=kotlin.Nothing from='public final fun test (x: .Base.test>): T of .test declared in ' + CALL 'public abstract fun foo (): T of .Base declared in .Base' type=T of .test origin=null + $this: GET_VAR 'x: .Base.test> declared in .test' type=.Base.test> origin=null + FUN name:box visibility:public modality:FINAL <> () returnType:kotlin.String + BLOCK_BODY + VAR name:x type:.Derived [val] + CONSTRUCTOR_CALL 'public constructor () declared in .Derived' type=.Derived origin=null + : kotlin.String + RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' + CALL 'public final fun test (x: .Base.test>): T of .test declared in ' type=kotlin.String origin=null + : kotlin.String + x: GET_VAR 'val x: .Derived declared in .box' type=.Derived origin=null diff --git a/compiler/testData/codegen/box/smartCasts/smartcastToStarType.kt b/compiler/testData/codegen/box/smartCasts/smartcastToStarType.kt new file mode 100644 index 00000000000..5586f92150a --- /dev/null +++ b/compiler/testData/codegen/box/smartCasts/smartcastToStarType.kt @@ -0,0 +1,29 @@ +// ISSUE: KT-62863 +// FIR_IDENTICAL +// DUMP_IR + +interface Base { + fun foo(): T +} + +class Derived : Base { + override fun foo(): T = "error" as T +} + +fun Derived.bar(): Base = object : Base { + override fun foo(): T = "OK" as T +} + +fun test(x: Base): T { + if (x is Derived<*>) { + val y: Base = x.bar() + return y.foo() as T + } + + return x.foo() +} + +fun box(): String { + val x = Derived() + return test(x) +} 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 3fd7642f24f..3a55705cb47 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 @@ -47739,6 +47739,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/smartCasts/smartcastOnImplicitDispatchReceiver.kt"); } + @Test + @TestMetadata("smartcastToStarType.kt") + public void testSmartcastToStarType() throws Exception { + runTest("compiler/testData/codegen/box/smartCasts/smartcastToStarType.kt"); + } + @Test @TestMetadata("whenSmartCast.kt") public void testWhenSmartCast() 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 39280d75bf2..48e86a541a0 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 @@ -50733,6 +50733,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/smartCasts/smartcastOnImplicitDispatchReceiver.kt"); } + @Test + @TestMetadata("smartcastToStarType.kt") + public void testSmartcastToStarType() throws Exception { + runTest("compiler/testData/codegen/box/smartCasts/smartcastToStarType.kt"); + } + @Test @TestMetadata("toStringOnReceiverWIthSmartcast.kt") public void testToStringOnReceiverWIthSmartcast() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java index 21e26eb2a4f..952c55a7473 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java @@ -50733,6 +50733,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack runTest("compiler/testData/codegen/box/smartCasts/smartcastOnImplicitDispatchReceiver.kt"); } + @Test + @TestMetadata("smartcastToStarType.kt") + public void testSmartcastToStarType() throws Exception { + runTest("compiler/testData/codegen/box/smartCasts/smartcastToStarType.kt"); + } + @Test @TestMetadata("toStringOnReceiverWIthSmartcast.kt") public void testToStringOnReceiverWIthSmartcast() 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 067cb4b667e..e7da840a5fb 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -40816,6 +40816,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/smartCasts/smartcastOnImplicitDispatchReceiver.kt"); } + @TestMetadata("smartcastToStarType.kt") + public void testSmartcastToStarType() throws Exception { + runTest("compiler/testData/codegen/box/smartCasts/smartcastToStarType.kt"); + } + @TestMetadata("toStringOnReceiverWIthSmartcast.kt") public void testToStringOnReceiverWIthSmartcast() throws Exception { runTest("compiler/testData/codegen/box/smartCasts/toStringOnReceiverWIthSmartcast.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java index 4a9ef08d7b3..b945056b2a0 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java @@ -35109,6 +35109,12 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest { runTest("compiler/testData/codegen/box/smartCasts/smartcastOnDynamic.kt"); } + @Test + @TestMetadata("smartcastToStarType.kt") + public void testSmartcastToStarType() throws Exception { + runTest("compiler/testData/codegen/box/smartCasts/smartcastToStarType.kt"); + } + @Test @TestMetadata("whenSmartCast.kt") public void testWhenSmartCast() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsES6CodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsES6CodegenBoxTestGenerated.java index 5002c668473..9dd5638107d 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsES6CodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsES6CodegenBoxTestGenerated.java @@ -35109,6 +35109,12 @@ public class FirJsES6CodegenBoxTestGenerated extends AbstractFirJsES6CodegenBoxT runTest("compiler/testData/codegen/box/smartCasts/smartcastOnDynamic.kt"); } + @Test + @TestMetadata("smartcastToStarType.kt") + public void testSmartcastToStarType() throws Exception { + runTest("compiler/testData/codegen/box/smartCasts/smartcastToStarType.kt"); + } + @Test @TestMetadata("whenSmartCast.kt") public void testWhenSmartCast() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java index 81af4c0edca..30908698eb6 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java @@ -35109,6 +35109,12 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/smartCasts/smartcastOnDynamic.kt"); } + @Test + @TestMetadata("smartcastToStarType.kt") + public void testSmartcastToStarType() throws Exception { + runTest("compiler/testData/codegen/box/smartCasts/smartcastToStarType.kt"); + } + @Test @TestMetadata("whenSmartCast.kt") public void testWhenSmartCast() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java index 6a330bcb662..733b2925ae9 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java @@ -35109,6 +35109,12 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes runTest("compiler/testData/codegen/box/smartCasts/smartcastOnDynamic.kt"); } + @Test + @TestMetadata("smartcastToStarType.kt") + public void testSmartcastToStarType() throws Exception { + runTest("compiler/testData/codegen/box/smartCasts/smartcastToStarType.kt"); + } + @Test @TestMetadata("whenSmartCast.kt") public void testWhenSmartCast() throws Exception { diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestGenerated.java index d95dcb99264..5794bc08cb2 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestGenerated.java @@ -38789,6 +38789,12 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe runTest("compiler/testData/codegen/box/smartCasts/smartCastInsideIf.kt"); } + @Test + @TestMetadata("smartcastToStarType.kt") + public void testSmartcastToStarType() throws Exception { + runTest("compiler/testData/codegen/box/smartCasts/smartcastToStarType.kt"); + } + @Test @TestMetadata("whenSmartCast.kt") public void testWhenSmartCast() throws Exception { diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestNoPLGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestNoPLGenerated.java index f846c988baa..f3ec4abf5ef 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestNoPLGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestNoPLGenerated.java @@ -39787,6 +39787,12 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB runTest("compiler/testData/codegen/box/smartCasts/smartCastInsideIf.kt"); } + @Test + @TestMetadata("smartcastToStarType.kt") + public void testSmartcastToStarType() throws Exception { + runTest("compiler/testData/codegen/box/smartCasts/smartcastToStarType.kt"); + } + @Test @TestMetadata("whenSmartCast.kt") public void testWhenSmartCast() throws Exception { diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestGenerated.java index c2ef3cb2843..1267ebc1aea 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestGenerated.java @@ -38291,6 +38291,12 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest runTest("compiler/testData/codegen/box/smartCasts/smartCastInsideIf.kt"); } + @Test + @TestMetadata("smartcastToStarType.kt") + public void testSmartcastToStarType() throws Exception { + runTest("compiler/testData/codegen/box/smartCasts/smartcastToStarType.kt"); + } + @Test @TestMetadata("whenSmartCast.kt") public void testWhenSmartCast() throws Exception { diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestNoPLGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestNoPLGenerated.java index 904188f47ac..b846db6413a 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestNoPLGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestNoPLGenerated.java @@ -38790,6 +38790,12 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT runTest("compiler/testData/codegen/box/smartCasts/smartCastInsideIf.kt"); } + @Test + @TestMetadata("smartcastToStarType.kt") + public void testSmartcastToStarType() throws Exception { + runTest("compiler/testData/codegen/box/smartCasts/smartcastToStarType.kt"); + } + @Test @TestMetadata("whenSmartCast.kt") public void testWhenSmartCast() throws Exception { diff --git a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmCodegenBoxTestGenerated.java b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmCodegenBoxTestGenerated.java index 3c7263a4d9b..03aaaa5607c 100644 --- a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmCodegenBoxTestGenerated.java +++ b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmCodegenBoxTestGenerated.java @@ -34779,6 +34779,12 @@ public class FirWasmCodegenBoxTestGenerated extends AbstractFirWasmCodegenBoxTes runTest("compiler/testData/codegen/box/smartCasts/smartCastInsideIf.kt"); } + @Test + @TestMetadata("smartcastToStarType.kt") + public void testSmartcastToStarType() throws Exception { + runTest("compiler/testData/codegen/box/smartCasts/smartcastToStarType.kt"); + } + @Test @TestMetadata("whenSmartCast.kt") public void testWhenSmartCast() throws Exception { diff --git a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/K1WasmCodegenBoxTestGenerated.java b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/K1WasmCodegenBoxTestGenerated.java index 3427709752d..755c5bb9a79 100644 --- a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/K1WasmCodegenBoxTestGenerated.java +++ b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/K1WasmCodegenBoxTestGenerated.java @@ -34779,6 +34779,12 @@ public class K1WasmCodegenBoxTestGenerated extends AbstractK1WasmCodegenBoxTest runTest("compiler/testData/codegen/box/smartCasts/smartCastInsideIf.kt"); } + @Test + @TestMetadata("smartcastToStarType.kt") + public void testSmartcastToStarType() throws Exception { + runTest("compiler/testData/codegen/box/smartCasts/smartcastToStarType.kt"); + } + @Test @TestMetadata("whenSmartCast.kt") public void testWhenSmartCast() throws Exception {