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:
Dmitry Petrov
2020-05-28 16:26:11 +03:00
parent ffdab473e2
commit 94509bdb4e
10 changed files with 113 additions and 29 deletions
@@ -151,7 +151,7 @@ class JvmNameAnnotationChecker : DeclarationChecker {
diagnosticHolder.report(ErrorsJvm.INAPPLICABLE_JVM_NAME.on(annotationEntry))
} else if (descriptor.containingDeclaration.isInlineClassThatRequiresMangling() ||
requiresFunctionNameManglingForParameterTypes(descriptor.valueParameters.map { it.type }) ||
descriptor.containingDeclaration is ClassDescriptor && requiresFunctionNameManglingForReturnType(descriptor.returnType)
requiresFunctionNameManglingForReturnType(descriptor)
) {
diagnosticHolder.report(ErrorsJvm.INAPPLICABLE_JVM_NAME.on(annotationEntry))
}