KT-39228 Fix inliner when latest 1.4 compiler used with 1.3 stdlib
Since 1.4.0-dev-8774, we mangle functions returning inline class values, including functions with return type 'kotlin.Result'. This causes incompatibility when 1.4 compiler is used with 1.3 (or just some pre-1.4.0-dev-8774) standard library. Also, write "message from the future" on functions returning inline class values indicating that they can be used since compiler version 1.4 (otherwise 1.3 compiler using 1.4 stdlib would fail to find some @InlineOnly functions such as 'Result.success' and 'Result.failure').
This commit is contained in:
+5
-2
@@ -29,8 +29,11 @@ fun requiresFunctionNameManglingForParameterTypes(valueParameterTypes: List<Kotl
|
||||
}
|
||||
|
||||
// NB functions returning all inline classes (including our special 'kotlin.Result') should be mangled.
|
||||
fun requiresFunctionNameManglingForReturnType(returnType: KotlinType?) =
|
||||
returnType != null && returnType.isInlineClassType()
|
||||
fun requiresFunctionNameManglingForReturnType(descriptor: CallableMemberDescriptor): Boolean {
|
||||
if (descriptor.containingDeclaration !is ClassDescriptor) return false
|
||||
val returnType = descriptor.returnType ?: return false
|
||||
return returnType.isInlineClassType()
|
||||
}
|
||||
|
||||
fun DeclarationDescriptor.isInlineClassThatRequiresMangling(): Boolean =
|
||||
isInlineClass() && !isDontMangleClass(this as ClassDescriptor)
|
||||
|
||||
Reference in New Issue
Block a user