[FIR] Serialize context receivers using the correct local serializer
This leads to type ref referring to generic type variables being serialized correctly. When the type variable is declared on the member itself, it's written to typeParameterName, otherwise it's written to typeParameter. This is required for deserialization to work correctly. #KT-63227 Fixed
This commit is contained in:
committed by
Space Team
parent
fe94876d9a
commit
7da271bab8
+6
@@ -18540,6 +18540,12 @@ public class LLFirBlackBoxCodegenBasedTestGenerated extends AbstractLLFirBlackBo
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionProperties"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericContextOverride.kt")
|
||||
public void testGenericContextOverride() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/extensionProperties/genericContextOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericValForPrimitiveType.kt")
|
||||
public void testGenericValForPrimitiveType() throws Exception {
|
||||
|
||||
+6
@@ -18540,6 +18540,12 @@ public class LLFirReversedBlackBoxCodegenBasedTestGenerated extends AbstractLLFi
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionProperties"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericContextOverride.kt")
|
||||
public void testGenericContextOverride() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/extensionProperties/genericContextOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericValForPrimitiveType.kt")
|
||||
public void testGenericValForPrimitiveType() throws Exception {
|
||||
|
||||
+4
-4
@@ -546,9 +546,9 @@ class FirElementSerializer private constructor(
|
||||
for (contextReceiver in property.contextReceivers) {
|
||||
val typeRef = contextReceiver.typeRef
|
||||
if (useTypeTable()) {
|
||||
builder.addContextReceiverTypeId(typeId(typeRef))
|
||||
builder.addContextReceiverTypeId(local.typeId(typeRef))
|
||||
} else {
|
||||
builder.addContextReceiverType(typeProto(contextReceiver.typeRef))
|
||||
builder.addContextReceiverType(local.typeProto(contextReceiver.typeRef))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -633,9 +633,9 @@ class FirElementSerializer private constructor(
|
||||
for (contextReceiver in function.contextReceivers) {
|
||||
val typeRef = contextReceiver.typeRef
|
||||
if (useTypeTable()) {
|
||||
builder.addContextReceiverTypeId(typeId(typeRef))
|
||||
builder.addContextReceiverTypeId(local.typeId(typeRef))
|
||||
} else {
|
||||
builder.addContextReceiverType(typeProto(contextReceiver.typeRef))
|
||||
builder.addContextReceiverType(local.typeProto(contextReceiver.typeRef))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
@@ -18469,6 +18469,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionProperties"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericContextOverride.kt")
|
||||
public void testGenericContextOverride() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/extensionProperties/genericContextOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericValForPrimitiveType.kt")
|
||||
public void testGenericValForPrimitiveType() throws Exception {
|
||||
|
||||
+6
@@ -18469,6 +18469,12 @@ public class FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionProperties"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericContextOverride.kt")
|
||||
public void testGenericContextOverride() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/extensionProperties/genericContextOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericValForPrimitiveType.kt")
|
||||
public void testGenericValForPrimitiveType() throws Exception {
|
||||
|
||||
+6
@@ -18469,6 +18469,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionProperties"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericContextOverride.kt")
|
||||
public void testGenericContextOverride() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/extensionProperties/genericContextOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericValForPrimitiveType.kt")
|
||||
public void testGenericValForPrimitiveType() throws Exception {
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
// !LANGUAGE: +ContextReceivers
|
||||
// MODULE: m1
|
||||
// FILE: Base.kt
|
||||
abstract class Base<T> {
|
||||
context(T)
|
||||
abstract val String.foo: Int?
|
||||
|
||||
context(T)
|
||||
abstract fun foo(): Int?
|
||||
}
|
||||
|
||||
// MODULE: box(m1)
|
||||
// FILE: box.kt
|
||||
class Child : Base<String>() {
|
||||
context(String)
|
||||
override val String.foo: Int? get() = 1
|
||||
|
||||
context(String)
|
||||
override fun foo(): Int? = 1
|
||||
}
|
||||
|
||||
fun box() = "OK"
|
||||
+6
@@ -17653,6 +17653,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionProperties"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericContextOverride.kt")
|
||||
public void testGenericContextOverride() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/extensionProperties/genericContextOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericValForPrimitiveType.kt")
|
||||
public void testGenericValForPrimitiveType() throws Exception {
|
||||
|
||||
+6
@@ -18469,6 +18469,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionProperties"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericContextOverride.kt")
|
||||
public void testGenericContextOverride() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/extensionProperties/genericContextOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericValForPrimitiveType.kt")
|
||||
public void testGenericValForPrimitiveType() throws Exception {
|
||||
|
||||
+6
@@ -18469,6 +18469,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionProperties"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericContextOverride.kt")
|
||||
public void testGenericContextOverride() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/extensionProperties/genericContextOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericValForPrimitiveType.kt")
|
||||
public void testGenericValForPrimitiveType() throws Exception {
|
||||
|
||||
+5
@@ -15336,6 +15336,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionProperties"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("genericContextOverride.kt")
|
||||
public void testGenericContextOverride() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/extensionProperties/genericContextOverride.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("genericValForPrimitiveType.kt")
|
||||
public void testGenericValForPrimitiveType() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/extensionProperties/genericValForPrimitiveType.kt");
|
||||
|
||||
+6
@@ -13699,6 +13699,12 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionProperties"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericContextOverride.kt")
|
||||
public void testGenericContextOverride() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/extensionProperties/genericContextOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericValForPrimitiveType.kt")
|
||||
public void testGenericValForPrimitiveType() throws Exception {
|
||||
|
||||
Generated
+6
@@ -13699,6 +13699,12 @@ public class FirJsES6CodegenBoxTestGenerated extends AbstractFirJsES6CodegenBoxT
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionProperties"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericContextOverride.kt")
|
||||
public void testGenericContextOverride() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/extensionProperties/genericContextOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericValForPrimitiveType.kt")
|
||||
public void testGenericValForPrimitiveType() throws Exception {
|
||||
|
||||
+6
@@ -13699,6 +13699,12 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionProperties"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericContextOverride.kt")
|
||||
public void testGenericContextOverride() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/extensionProperties/genericContextOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericValForPrimitiveType.kt")
|
||||
public void testGenericValForPrimitiveType() throws Exception {
|
||||
|
||||
+6
@@ -13699,6 +13699,12 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionProperties"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericContextOverride.kt")
|
||||
public void testGenericContextOverride() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/extensionProperties/genericContextOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericValForPrimitiveType.kt")
|
||||
public void testGenericValForPrimitiveType() throws Exception {
|
||||
|
||||
+6
@@ -14811,6 +14811,12 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionProperties"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericContextOverride.kt")
|
||||
public void testGenericContextOverride() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/extensionProperties/genericContextOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericValForPrimitiveType.kt")
|
||||
public void testGenericValForPrimitiveType() throws Exception {
|
||||
|
||||
+6
@@ -15163,6 +15163,12 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionProperties"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericContextOverride.kt")
|
||||
public void testGenericContextOverride() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/extensionProperties/genericContextOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericValForPrimitiveType.kt")
|
||||
public void testGenericValForPrimitiveType() throws Exception {
|
||||
|
||||
+6
@@ -14636,6 +14636,12 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionProperties"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericContextOverride.kt")
|
||||
public void testGenericContextOverride() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/extensionProperties/genericContextOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericValForPrimitiveType.kt")
|
||||
public void testGenericValForPrimitiveType() throws Exception {
|
||||
|
||||
+6
@@ -14812,6 +14812,12 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionProperties"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.NATIVE, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericContextOverride.kt")
|
||||
public void testGenericContextOverride() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/extensionProperties/genericContextOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericValForPrimitiveType.kt")
|
||||
public void testGenericValForPrimitiveType() throws Exception {
|
||||
|
||||
Generated
+6
@@ -13675,6 +13675,12 @@ public class FirWasmCodegenBoxTestGenerated extends AbstractFirWasmCodegenBoxTes
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionProperties"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericContextOverride.kt")
|
||||
public void testGenericContextOverride() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/extensionProperties/genericContextOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericValForPrimitiveType.kt")
|
||||
public void testGenericValForPrimitiveType() throws Exception {
|
||||
|
||||
Generated
+6
@@ -13675,6 +13675,12 @@ public class K1WasmCodegenBoxTestGenerated extends AbstractK1WasmCodegenBoxTest
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/extensionProperties"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericContextOverride.kt")
|
||||
public void testGenericContextOverride() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/extensionProperties/genericContextOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("genericValForPrimitiveType.kt")
|
||||
public void testGenericValForPrimitiveType() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user