diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/KotlinToResolvedCallTransformer.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/KotlinToResolvedCallTransformer.kt index bfa491d0828..795dc5ca040 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/KotlinToResolvedCallTransformer.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/KotlinToResolvedCallTransformer.kt @@ -845,7 +845,7 @@ private fun PropertyDescriptorImpl.hackSettersAccordingToCapturedOutTypes(): Pro TypeApproximatorConfiguration.CapturedAndIntegerLiteralsTypesApproximation ) ?: return this - val newProperty = newCopyBuilder().build() as PropertyDescriptorImpl + val newProperty = newCopyBuilder().setOriginal(original).build() as PropertyDescriptorImpl val newSetter = with(setter) { PropertySetterDescriptorImpl(newProperty, annotations, modality, visibility, isDefault, isExternal, isInline, kind, original, source) diff --git a/compiler/testData/codegen/box/inference/capturedStarProjection.kt b/compiler/testData/codegen/box/inference/capturedStarProjection.kt new file mode 100644 index 00000000000..02d0e872994 --- /dev/null +++ b/compiler/testData/codegen/box/inference/capturedStarProjection.kt @@ -0,0 +1,15 @@ +// !LANGUAGE: +NewInference +// IGNORE_BACKEND: JS_IR +// WITH_RUNTIME + +interface A { + var x: T +} + +fun test(a: A<*>) { + a.x +} + +fun box(): String { + return "OK" +} \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index eee4317ed14..e05b688ad9d 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -12030,6 +12030,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/inference"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true); } + @TestMetadata("capturedStarProjection.kt") + public void testCapturedStarProjection() throws Exception { + runTest("compiler/testData/codegen/box/inference/capturedStarProjection.kt"); + } + @TestMetadata("integerLiteralTypeInLamdaReturnType.kt") public void testIntegerLiteralTypeInLamdaReturnType() throws Exception { runTest("compiler/testData/codegen/box/inference/integerLiteralTypeInLamdaReturnType.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index e480ea3fd1e..337a44232ed 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -12030,6 +12030,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/inference"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true); } + @TestMetadata("capturedStarProjection.kt") + public void testCapturedStarProjection() throws Exception { + runTest("compiler/testData/codegen/box/inference/capturedStarProjection.kt"); + } + @TestMetadata("integerLiteralTypeInLamdaReturnType.kt") public void testIntegerLiteralTypeInLamdaReturnType() throws Exception { runTest("compiler/testData/codegen/box/inference/integerLiteralTypeInLamdaReturnType.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 466ed95966f..ab0b5efa667 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -12035,6 +12035,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/inference"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM_IR, true); } + @TestMetadata("capturedStarProjection.kt") + public void testCapturedStarProjection() throws Exception { + runTest("compiler/testData/codegen/box/inference/capturedStarProjection.kt"); + } + @TestMetadata("integerLiteralTypeInLamdaReturnType.kt") public void testIntegerLiteralTypeInLamdaReturnType() throws Exception { runTest("compiler/testData/codegen/box/inference/integerLiteralTypeInLamdaReturnType.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 1f6090925aa..c3acfa0ffc5 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -9460,6 +9460,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/inference"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS_IR, true); } + @TestMetadata("capturedStarProjection.kt") + public void testCapturedStarProjection() throws Exception { + runTest("compiler/testData/codegen/box/inference/capturedStarProjection.kt"); + } + @TestMetadata("integerLiteralTypeInLamdaReturnType.kt") public void testIntegerLiteralTypeInLamdaReturnType() throws Exception { runTest("compiler/testData/codegen/box/inference/integerLiteralTypeInLamdaReturnType.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 641b144d6b0..6da5baffb00 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -10615,6 +10615,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/inference"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS, true); } + @TestMetadata("capturedStarProjection.kt") + public void testCapturedStarProjection() throws Exception { + runTest("compiler/testData/codegen/box/inference/capturedStarProjection.kt"); + } + @TestMetadata("integerLiteralTypeInLamdaReturnType.kt") public void testIntegerLiteralTypeInLamdaReturnType() throws Exception { runTest("compiler/testData/codegen/box/inference/integerLiteralTypeInLamdaReturnType.kt");