Only check language version in MemberDeserializer.loadAsSuspend
This is still not 100% foolproof because one may place such a requirement manually on a suspend function (with `@RequireKotlin`, for example), which will trick the compiler into thinking that this is a new suspend function, even if it was compiled with old coroutines. But it's still better than only checking the version number
This commit is contained in:
+4
-3
@@ -137,7 +137,9 @@ class MemberDeserializer(private val c: DeserializationContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun DeserializedMemberDescriptor.versionAndReleaseCoroutinesMismatch(): Boolean =
|
private fun DeserializedMemberDescriptor.versionAndReleaseCoroutinesMismatch(): Boolean =
|
||||||
c.components.configuration.releaseCoroutines && versionRequirements.none { it.version == VersionRequirement.Version(1, 3) }
|
c.components.configuration.releaseCoroutines && versionRequirements.none {
|
||||||
|
it.version == VersionRequirement.Version(1, 3) && it.kind == ProtoBuf.VersionRequirement.VersionKind.LANGUAGE_VERSION
|
||||||
|
}
|
||||||
|
|
||||||
private fun loadOldFlags(oldFlags: Int): Int {
|
private fun loadOldFlags(oldFlags: Int): Int {
|
||||||
val lowSixBits = oldFlags and 0x3f
|
val lowSixBits = oldFlags and 0x3f
|
||||||
@@ -229,8 +231,7 @@ class MemberDeserializer(private val c: DeserializationContext) {
|
|||||||
descriptor.typeParameters.forEach { it.upperBounds }
|
descriptor.typeParameters.forEach { it.upperBounds }
|
||||||
descriptor.isExperimentalCoroutineInReleaseEnvironment = local.typeDeserializer.experimentalSuspendFunctionTypeEncountered ||
|
descriptor.isExperimentalCoroutineInReleaseEnvironment = local.typeDeserializer.experimentalSuspendFunctionTypeEncountered ||
|
||||||
((c.containingDeclaration as? DeserializedClassDescriptor)?.c?.typeDeserializer?.experimentalSuspendFunctionTypeEncountered == true &&
|
((c.containingDeclaration as? DeserializedClassDescriptor)?.c?.typeDeserializer?.experimentalSuspendFunctionTypeEncountered == true &&
|
||||||
c.components.configuration.releaseCoroutines &&
|
descriptor.versionAndReleaseCoroutinesMismatch())
|
||||||
descriptor.versionRequirements.none { it.version == VersionRequirement.Version(1, 3) })
|
|
||||||
|
|
||||||
return descriptor
|
return descriptor
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user