[FIR] Fix deserialization of generic context receivers
We need to pass the local deserialization context so that generic type parameters can be referenced. #KT-62607 Fixed
This commit is contained in:
committed by
Space Team
parent
45a1cc1a4a
commit
ef78d4b95a
+5
-5
@@ -468,7 +468,7 @@ class FirMemberDeserializer(private val c: FirDeserializationContext) {
|
||||
else -> null
|
||||
}
|
||||
|
||||
proto.contextReceiverTypes(c.typeTable).mapTo(contextReceivers, ::loadContextReceiver)
|
||||
proto.contextReceiverTypes(c.typeTable).mapTo(contextReceivers) { loadContextReceiver(it, local) }
|
||||
}.apply {
|
||||
initializer?.replaceConeTypeOrNull(returnTypeRef.type)
|
||||
this.versionRequirements = versionRequirements
|
||||
@@ -479,8 +479,8 @@ class FirMemberDeserializer(private val c: FirDeserializationContext) {
|
||||
}
|
||||
}
|
||||
|
||||
private fun loadContextReceiver(proto: ProtoBuf.Type): FirContextReceiver {
|
||||
val typeRef = proto.toTypeRef(c)
|
||||
private fun loadContextReceiver(proto: ProtoBuf.Type, context: FirDeserializationContext): FirContextReceiver {
|
||||
val typeRef = proto.toTypeRef(context)
|
||||
return buildContextReceiver {
|
||||
val type = typeRef.coneType
|
||||
this.labelNameFromTypeRef = (type as? ConeLookupTagBasedType)?.lookupTag?.name
|
||||
@@ -489,7 +489,7 @@ class FirMemberDeserializer(private val c: FirDeserializationContext) {
|
||||
}
|
||||
|
||||
internal fun createContextReceiversForClass(classProto: ProtoBuf.Class): List<FirContextReceiver> =
|
||||
classProto.contextReceiverTypes(c.typeTable).map(::loadContextReceiver)
|
||||
classProto.contextReceiverTypes(c.typeTable).map { loadContextReceiver(it, c) }
|
||||
|
||||
fun loadFunction(
|
||||
proto: ProtoBuf.Function,
|
||||
@@ -559,7 +559,7 @@ class FirMemberDeserializer(private val c: FirDeserializationContext) {
|
||||
deprecationsProvider = annotations.getDeprecationsProviderFromAnnotations(c.session, fromJava = false, versionRequirements)
|
||||
this.containerSource = c.containerSource
|
||||
|
||||
proto.contextReceiverTypes(c.typeTable).mapTo(contextReceivers, ::loadContextReceiver)
|
||||
proto.contextReceiverTypes(c.typeTable).mapTo(contextReceivers) { loadContextReceiver(it, local) }
|
||||
}.apply {
|
||||
this.versionRequirements = versionRequirements
|
||||
setLazyPublishedVisibility(c.session)
|
||||
|
||||
+5
@@ -247,6 +247,11 @@ public class IncrementalFirICLightTreeJvmCompilerRunnerTestGenerated extends Abs
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/functionReferencingClass/");
|
||||
}
|
||||
|
||||
@TestMetadata("genericContextReceiver")
|
||||
public void testGenericContextReceiver() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/genericContextReceiver/");
|
||||
}
|
||||
|
||||
@TestMetadata("independentClasses")
|
||||
public void testIndependentClasses() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/independentClasses/");
|
||||
|
||||
+5
@@ -247,6 +247,11 @@ public class IncrementalFirLightTreeJvmCompilerRunnerTestGenerated extends Abstr
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/functionReferencingClass/");
|
||||
}
|
||||
|
||||
@TestMetadata("genericContextReceiver")
|
||||
public void testGenericContextReceiver() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/genericContextReceiver/");
|
||||
}
|
||||
|
||||
@TestMetadata("independentClasses")
|
||||
public void testIndependentClasses() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/independentClasses/");
|
||||
|
||||
+5
@@ -256,6 +256,11 @@ public class IncrementalK1JsKlibCompilerRunnerTestGenerated extends AbstractIncr
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/functionReferencingClass/");
|
||||
}
|
||||
|
||||
@TestMetadata("genericContextReceiver")
|
||||
public void testGenericContextReceiver() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/genericContextReceiver/");
|
||||
}
|
||||
|
||||
@TestMetadata("independentClasses")
|
||||
public void testIndependentClasses() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/independentClasses/");
|
||||
|
||||
+5
@@ -256,6 +256,11 @@ public class IncrementalK1JsKlibCompilerWithScopeExpansionRunnerTestGenerated ex
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/functionReferencingClass/");
|
||||
}
|
||||
|
||||
@TestMetadata("genericContextReceiver")
|
||||
public void testGenericContextReceiver() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/genericContextReceiver/");
|
||||
}
|
||||
|
||||
@TestMetadata("independentClasses")
|
||||
public void testIndependentClasses() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/independentClasses/");
|
||||
|
||||
+5
@@ -257,6 +257,11 @@ public class IncrementalK1JvmCompilerRunnerTestGenerated extends AbstractIncreme
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/functionReferencingClass/");
|
||||
}
|
||||
|
||||
@TestMetadata("genericContextReceiver")
|
||||
public void testGenericContextReceiver() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/genericContextReceiver/");
|
||||
}
|
||||
|
||||
@TestMetadata("independentClasses")
|
||||
public void testIndependentClasses() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/independentClasses/");
|
||||
|
||||
+5
@@ -241,6 +241,11 @@ public class IncrementalK2JsKlibCompilerWithScopeExpansionRunnerTestGenerated ex
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/functionReferencingClass/");
|
||||
}
|
||||
|
||||
@TestMetadata("genericContextReceiver")
|
||||
public void testGenericContextReceiver() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/genericContextReceiver/");
|
||||
}
|
||||
|
||||
@TestMetadata("independentClasses")
|
||||
public void testIndependentClasses() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/independentClasses/");
|
||||
|
||||
+5
@@ -247,6 +247,11 @@ public class IncrementalK2JvmCompilerRunnerTestGenerated extends AbstractIncreme
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/functionReferencingClass/");
|
||||
}
|
||||
|
||||
@TestMetadata("genericContextReceiver")
|
||||
public void testGenericContextReceiver() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/genericContextReceiver/");
|
||||
}
|
||||
|
||||
@TestMetadata("independentClasses")
|
||||
public void testIndependentClasses() throws Exception {
|
||||
runTest("jps/jps-plugin/testData/incremental/pureKotlin/independentClasses/");
|
||||
|
||||
Reference in New Issue
Block a user