Forward compatibility hacks for Result.{success, failure}
Don't mangled functions annotated with @JvmName.
Annotate 'Result.success' and 'Result.failure' with @JvmName and
@Suppress("INAPPLICABLE_JVM_NAME").
NB this would require bootstrap.
This commit is contained in:
+4
-2
@@ -24,8 +24,10 @@ fun shouldHideConstructorDueToInlineClassTypeValueParameters(descriptor: Callabl
|
||||
return constructorDescriptor.valueParameters.any { it.type.requiresFunctionNameManglingInParameterTypes() }
|
||||
}
|
||||
|
||||
fun requiresFunctionNameManglingForParameterTypes(valueParameterTypes: List<KotlinType>): Boolean {
|
||||
return valueParameterTypes.any { it.requiresFunctionNameManglingInParameterTypes() }
|
||||
fun requiresFunctionNameManglingForParameterTypes(descriptor: CallableMemberDescriptor): Boolean {
|
||||
val extensionReceiverType = descriptor.extensionReceiverParameter?.type
|
||||
return extensionReceiverType != null && extensionReceiverType.requiresFunctionNameManglingInParameterTypes() ||
|
||||
descriptor.valueParameters.any { it.type.requiresFunctionNameManglingInParameterTypes() }
|
||||
}
|
||||
|
||||
// NB functions returning all inline classes (including our special 'kotlin.Result') should be mangled.
|
||||
|
||||
@@ -569,6 +569,10 @@ public class DescriptorUtils {
|
||||
return annotated.getAnnotations().findAnnotation(JVM_NAME);
|
||||
}
|
||||
|
||||
public static boolean hasJvmNameAnnotation(@NotNull Annotated annotated) {
|
||||
return findJvmNameAnnotation(annotated) != null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static SourceFile getContainingSourceFile(@NotNull DeclarationDescriptor descriptor) {
|
||||
if (descriptor instanceof PropertySetterDescriptor) {
|
||||
|
||||
Reference in New Issue
Block a user