Rename platform to header.

This commit is contained in:
Stanislav Erokhin
2016-12-13 17:59:59 +03:00
parent facee84020
commit 59efedf610
134 changed files with 500 additions and 499 deletions
@@ -78,7 +78,7 @@ public class AccessorForPropertyDescriptor extends PropertyDescriptorImpl implem
super(containingDeclaration, null, Annotations.Companion.getEMPTY(), Modality.FINAL, Visibilities.LOCAL,
original.isVar(), Name.identifier("access$" + nameSuffix),
Kind.DECLARATION, SourceElement.NO_SOURCE, /* lateInit = */ false, /* isConst = */ false,
/* isPlatform = */ false, /* isImpl = */ false, /* isExternal = */ false);
/* isHeader = */ false, /* isImpl = */ false, /* isExternal = */ false);
this.calleeDescriptor = original;
this.superCallTarget = superCallTarget;
@@ -112,7 +112,7 @@ public class MutableClassDescriptor extends ClassDescriptorBase implements Class
}
@Override
public boolean isPlatform() {
public boolean isHeader() {
return false;
}
@@ -101,7 +101,7 @@ public class PackageCodegenImpl implements PackageCodegen {
List<KtClassOrObject> classOrObjects = new ArrayList<KtClassOrObject>();
for (KtDeclaration declaration : file.getDeclarations()) {
if (declaration.hasModifier(KtTokens.PLATFORM_KEYWORD)) continue;
if (declaration.hasModifier(KtTokens.HEADER_KEYWORD)) continue;
if (declaration instanceof KtProperty || declaration instanceof KtNamedFunction || declaration instanceof KtTypeAlias) {
generatePackagePart = true;
@@ -92,7 +92,7 @@ public class PackagePartCodegen extends MemberCodegen<KtFile> {
@Override
protected void generateBody() {
for (KtDeclaration declaration : element.getDeclarations()) {
if (declaration.hasModifier(KtTokens.PLATFORM_KEYWORD)) continue;
if (declaration.hasModifier(KtTokens.HEADER_KEYWORD)) continue;
if (declaration instanceof KtNamedFunction || declaration instanceof KtProperty || declaration instanceof KtTypeAlias) {
genSimpleMember(declaration);
@@ -73,7 +73,7 @@ object PackagePartClassUtils {
(it is KtProperty ||
it is KtNamedFunction ||
it is KtScript ||
it is KtTypeAlias) && !it.hasModifier(KtTokens.PLATFORM_KEYWORD)
it is KtTypeAlias) && !it.hasModifier(KtTokens.HEADER_KEYWORD)
}
@JvmStatic fun getFilePartShortName(fileName: String): String =
@@ -23,7 +23,7 @@ import org.jetbrains.kotlin.platform.JavaToKotlinClassMap
import org.jetbrains.kotlin.resolve.PlatformConfigurator
import org.jetbrains.kotlin.resolve.calls.checkers.ReifiedTypeParameterSubstitutionChecker
import org.jetbrains.kotlin.resolve.checkers.MissingDependencyClassChecker
import org.jetbrains.kotlin.resolve.checkers.PlatformImplDeclarationChecker
import org.jetbrains.kotlin.resolve.checkers.HeaderImplDeclarationChecker
import org.jetbrains.kotlin.resolve.jvm.JvmOverloadFilter
import org.jetbrains.kotlin.resolve.jvm.JvmTypeSpecificityComparator
import org.jetbrains.kotlin.resolve.jvm.RuntimeAssertionsTypeChecker
@@ -47,7 +47,7 @@ object JvmPlatformConfigurator : PlatformConfigurator(
JvmSyntheticApplicabilityChecker(),
StrictfpApplicabilityChecker(),
AdditionalBuiltInsMemberOverrideDeclarationChecker,
PlatformImplDeclarationChecker()
HeaderImplDeclarationChecker()
),
additionalCallCheckers = listOf(
@@ -280,7 +280,7 @@ class JavaSyntheticPropertiesScope(storageManager: StorageManager, private val l
source: SourceElement
) : SyntheticJavaPropertyDescriptor, PropertyDescriptorImpl(
containingDeclaration, original, annotations, modality, visibility, isVar, name, kind, source,
/* lateInit = */ false, /* isConst = */ false, /* isPlatform = */ false, /* isImpl = */ false, /* isExternal = */ false
/* lateInit = */ false, /* isConst = */ false, /* isHeader = */ false, /* isImpl = */ false, /* isExternal = */ false
) {
override var getMethod: FunctionDescriptor by Delegates.notNull()
@@ -637,7 +637,7 @@ class ControlFlowInformationProvider private constructor(
is KtPrimaryConstructor -> if (!element.hasValOrVar()) {
val containingClass = owner.getContainingClassOrObject()
val containingClassDescriptor = trace.get(DECLARATION_TO_DESCRIPTOR, containingClass) as? ClassDescriptor
if (!DescriptorUtils.isAnnotationClass(containingClassDescriptor) && containingClassDescriptor?.isPlatform == false &&
if (!DescriptorUtils.isAnnotationClass(containingClassDescriptor) && containingClassDescriptor?.isHeader == false &&
!DescriptorUtils.isEffectivelyExternal(containingClassDescriptor)
) {
report(UNUSED_PARAMETER.on(element, variableDescriptor), ctxt)
@@ -653,7 +653,7 @@ class ControlFlowInformationProvider private constructor(
if (isMain
|| functionDescriptor.isOverridableOrOverrides
|| owner.hasModifier(KtTokens.OVERRIDE_KEYWORD)
|| functionDescriptor.isPlatform || functionDescriptor.isImpl
|| functionDescriptor.isHeader || functionDescriptor.isImpl
|| DescriptorUtils.isEffectivelyExternal(functionDescriptor)
|| OperatorNameConventions.GET_VALUE == functionName
|| OperatorNameConventions.SET_VALUE == functionName
@@ -34,7 +34,7 @@ import org.jetbrains.kotlin.resolve.VarianceConflictDiagnosticData;
import org.jetbrains.kotlin.resolve.calls.inference.InferenceErrorData;
import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall;
import org.jetbrains.kotlin.resolve.calls.tower.WrongResolutionToClassifier;
import org.jetbrains.kotlin.resolve.checkers.PlatformImplDeclarationChecker;
import org.jetbrains.kotlin.resolve.checkers.HeaderImplDeclarationChecker;
import org.jetbrains.kotlin.serialization.deserialization.IncompatibleVersionErrorData;
import org.jetbrains.kotlin.types.KotlinType;
@@ -499,11 +499,11 @@ public interface Errors {
// Multi-platform projects
DiagnosticFactory0<KtDeclaration> PLATFORM_DECLARATION_WITH_BODY = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
DiagnosticFactory0<KtParameter> PLATFORM_DECLARATION_WITH_DEFAULT_PARAMETER = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<KtConstructorDelegationCall> PLATFORM_CLASS_CONSTRUCTOR_DELEGATION_CALL = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<KtParameter> PLATFORM_CLASS_CONSTRUCTOR_PROPERTY_PARAMETER = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<KtExpression> PLATFORM_PROPERTY_INITIALIZER = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<KtDeclaration> HEADER_DECLARATION_WITH_BODY = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
DiagnosticFactory0<KtParameter> HEADER_DECLARATION_WITH_DEFAULT_PARAMETER = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<KtConstructorDelegationCall> HEADER_CLASS_CONSTRUCTOR_DELEGATION_CALL = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<KtParameter> HEADER_CLASS_CONSTRUCTOR_PROPERTY_PARAMETER = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<KtExpression> HEADER_PROPERTY_INITIALIZER = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<KtTypeAlias> IMPL_TYPE_ALIAS_NOT_TO_CLASS = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
DiagnosticFactory0<KtTypeAlias> IMPL_TYPE_ALIAS_TO_CLASS_WITH_DECLARATION_SITE_VARIANCE = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
@@ -511,9 +511,9 @@ public interface Errors {
DiagnosticFactory0<KtTypeAlias> IMPL_TYPE_ALIAS_WITH_COMPLEX_SUBSTITUTION = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE);
DiagnosticFactory2<KtDeclaration, MemberDescriptor,
Map<PlatformImplDeclarationChecker.Compatibility.Incompatible, Collection<MemberDescriptor>>> PLATFORM_DECLARATION_WITHOUT_DEFINITION =
Map<HeaderImplDeclarationChecker.Compatibility.Incompatible, Collection<MemberDescriptor>>> HEADER_WITHOUT_IMPLEMENTATION =
DiagnosticFactory2.create(ERROR, DECLARATION_SIGNATURE);
DiagnosticFactory0<PsiElement> PLATFORM_DEFINITION_WITHOUT_DECLARATION = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<PsiElement> IMPLEMENTATION_WITHOUT_HEADER = DiagnosticFactory0.create(ERROR);
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -259,19 +259,19 @@ public class DefaultErrorMessages {
MAP.put(USELESS_VARARG_ON_PARAMETER, "Vararg on this parameter is useless");
MAP.put(MULTIPLE_VARARG_PARAMETERS, "Multiple vararg-parameters are prohibited");
MAP.put(PLATFORM_DECLARATION_WITH_BODY, "Platform declaration must not have a body");
MAP.put(PLATFORM_DECLARATION_WITH_DEFAULT_PARAMETER, "Platform declaration cannot have parameters with default values");
MAP.put(PLATFORM_CLASS_CONSTRUCTOR_DELEGATION_CALL, "Explicit delegation call for constructor of a platform class is not allowed");
MAP.put(PLATFORM_CLASS_CONSTRUCTOR_PROPERTY_PARAMETER, "Platform class constructor cannot have a property parameter");
MAP.put(PLATFORM_PROPERTY_INITIALIZER, "Platform property cannot have an initializer");
MAP.put(HEADER_DECLARATION_WITH_BODY, "Header declaration must not have a body");
MAP.put(HEADER_DECLARATION_WITH_DEFAULT_PARAMETER, "Header declaration cannot have parameters with default values");
MAP.put(HEADER_CLASS_CONSTRUCTOR_DELEGATION_CALL, "Explicit delegation call for constructor of a header class is not allowed");
MAP.put(HEADER_CLASS_CONSTRUCTOR_PROPERTY_PARAMETER, "Header class constructor cannot have a property parameter");
MAP.put(HEADER_PROPERTY_INITIALIZER, "Header property cannot have an initializer");
MAP.put(IMPL_TYPE_ALIAS_NOT_TO_CLASS, "Right-hand side of 'impl' type alias should be a class, not another type alias");
MAP.put(IMPL_TYPE_ALIAS_TO_CLASS_WITH_DECLARATION_SITE_VARIANCE, "Aliased class should not have type parameters with declaration-site variance");
MAP.put(IMPL_TYPE_ALIAS_WITH_USE_SITE_VARIANCE, "Right-hand side of 'impl' type alias cannot contain use-site variance or star projections");
MAP.put(IMPL_TYPE_ALIAS_WITH_COMPLEX_SUBSTITUTION, "Type arguments in the right-hand side of 'impl' type alias should be its type parameters in the same order, e.g. 'impl typealias Foo<A, B> = Bar<A, B>'");
MAP.put(PLATFORM_DECLARATION_WITHOUT_DEFINITION, "No definition is found for platform declaration ''{0}''{1}", NAME, PlatformIncompatibilityDiagnosticRenderer.INSTANCE);
MAP.put(PLATFORM_DEFINITION_WITHOUT_DECLARATION, "Modifier 'impl' is only applicable to members that are initially declared in platform-independent code");
MAP.put(HEADER_WITHOUT_IMPLEMENTATION, "No implementation is found for header declaration ''{0}''{1}", NAME, PlatformIncompatibilityDiagnosticRenderer.INSTANCE);
MAP.put(IMPLEMENTATION_WITHOUT_HEADER, "Modifier 'impl' is only applicable to members that are initially declared in platform-independent code");
MAP.put(PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT, "Projections are not allowed on type arguments of functions and properties");
MAP.put(SUPERTYPE_NOT_INITIALIZED, "This type has a constructor, and thus must be initialized here");
@@ -18,14 +18,14 @@ package org.jetbrains.kotlin.diagnostics.rendering
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.descriptors.MemberDescriptor
import org.jetbrains.kotlin.resolve.checkers.PlatformImplDeclarationChecker
import org.jetbrains.kotlin.resolve.checkers.HeaderImplDeclarationChecker
object PlatformIncompatibilityDiagnosticRenderer :
DiagnosticParameterRenderer<Map<PlatformImplDeclarationChecker.Compatibility.Incompatible, Collection<MemberDescriptor>>> {
DiagnosticParameterRenderer<Map<HeaderImplDeclarationChecker.Compatibility.Incompatible, Collection<MemberDescriptor>>> {
private val INDENTATION_UNIT = " "
override fun render(
obj: Map<PlatformImplDeclarationChecker.Compatibility.Incompatible, Collection<MemberDescriptor>>,
obj: Map<HeaderImplDeclarationChecker.Compatibility.Incompatible, Collection<MemberDescriptor>>,
renderingContext: RenderingContext
): String {
if (obj.isEmpty()) return ""
@@ -39,7 +39,7 @@ object PlatformIncompatibilityDiagnosticRenderer :
}
private fun StringBuilder.render(
map: Map<PlatformImplDeclarationChecker.Compatibility.Incompatible, Collection<MemberDescriptor>>,
map: Map<HeaderImplDeclarationChecker.Compatibility.Incompatible, Collection<MemberDescriptor>>,
indent: String,
renderDescriptor: (DeclarationDescriptor) -> String
) {
@@ -189,7 +189,7 @@ public interface KtTokens {
KtModifierKeywordToken COROUTINE_KEYWORD = KtModifierKeywordToken.softKeywordModifier("coroutine");
KtModifierKeywordToken SUSPEND_KEYWORD = KtModifierKeywordToken.softKeywordModifier("suspend");
KtModifierKeywordToken PLATFORM_KEYWORD = KtModifierKeywordToken.softKeywordModifier("platform");
KtModifierKeywordToken HEADER_KEYWORD = KtModifierKeywordToken.softKeywordModifier("header");
KtModifierKeywordToken IMPL_KEYWORD = KtModifierKeywordToken.softKeywordModifier("impl");
TokenSet KEYWORDS = TokenSet.create(PACKAGE_KEYWORD, AS_KEYWORD, TYPE_ALIAS_KEYWORD, CLASS_KEYWORD, INTERFACE_KEYWORD,
@@ -212,7 +212,7 @@ public interface KtTokens {
LATEINIT_KEYWORD,
DATA_KEYWORD, INLINE_KEYWORD, NOINLINE_KEYWORD, TAILREC_KEYWORD, EXTERNAL_KEYWORD,
ANNOTATION_KEYWORD, CROSSINLINE_KEYWORD, CONST_KEYWORD, OPERATOR_KEYWORD, INFIX_KEYWORD,
COROUTINE_KEYWORD, SUSPEND_KEYWORD, PLATFORM_KEYWORD, IMPL_KEYWORD
COROUTINE_KEYWORD, SUSPEND_KEYWORD, HEADER_KEYWORD, IMPL_KEYWORD
);
/*
@@ -226,7 +226,7 @@ public interface KtTokens {
PUBLIC_KEYWORD, INTERNAL_KEYWORD, PROTECTED_KEYWORD, OUT_KEYWORD, IN_KEYWORD, FINAL_KEYWORD, VARARG_KEYWORD,
REIFIED_KEYWORD, COMPANION_KEYWORD, SEALED_KEYWORD, LATEINIT_KEYWORD,
DATA_KEYWORD, INLINE_KEYWORD, NOINLINE_KEYWORD, TAILREC_KEYWORD, EXTERNAL_KEYWORD, ANNOTATION_KEYWORD, CROSSINLINE_KEYWORD,
CONST_KEYWORD, OPERATOR_KEYWORD, INFIX_KEYWORD, COROUTINE_KEYWORD, SUSPEND_KEYWORD, PLATFORM_KEYWORD, IMPL_KEYWORD
CONST_KEYWORD, OPERATOR_KEYWORD, INFIX_KEYWORD, COROUTINE_KEYWORD, SUSPEND_KEYWORD, HEADER_KEYWORD, IMPL_KEYWORD
};
TokenSet MODIFIER_KEYWORDS = TokenSet.create(MODIFIER_KEYWORDS_ARRAY);
@@ -73,7 +73,7 @@ class SyntheticClassOrObjectDescriptor(
override fun isCompanionObject() = isCompanionObject
override fun isInner() = false
override fun isData() = false
override fun isPlatform() = false
override fun isHeader() = false
override fun isImpl() = false
override fun getCompanionObjectDescriptor() = null
@@ -169,8 +169,8 @@ public class BodyResolver {
@NotNull KtSecondaryConstructor constructor,
@NotNull ClassConstructorDescriptor descriptor
) {
if (descriptor.isPlatform()) {
// For platform classes, we do not resolve constructor delegation calls because they are prohibited
if (descriptor.isHeader()) {
// For header classes, we do not resolve constructor delegation calls because they are prohibited
return DataFlowInfo.Companion.getEMPTY();
}
@@ -367,7 +367,7 @@ public class BodyResolver {
descriptor.getUnsubstitutedPrimaryConstructor() != null &&
superClass.getKind() != ClassKind.INTERFACE &&
!superClass.getConstructors().isEmpty() &&
!descriptor.isPlatform() &&
!descriptor.isHeader() &&
!ErrorUtils.isError(superClass)
) {
trace.report(SUPERTYPE_NOT_INITIALIZED.on(specifier));
@@ -562,8 +562,8 @@ public class BodyResolver {
if (classDescriptor.getConstructors().isEmpty()) {
trace.report(ANONYMOUS_INITIALIZER_IN_INTERFACE.on(anonymousInitializer));
}
if (classDescriptor.isPlatform()) {
trace.report(PLATFORM_DECLARATION_WITH_BODY.on(anonymousInitializer));
if (classDescriptor.isHeader()) {
trace.report(HEADER_DECLARATION_WITH_BODY.on(anonymousInitializer));
}
}
@@ -78,12 +78,12 @@ class DeclarationResolver(
for ((fqName, declarationsOrPackageDirectives) in topLevelFqNames.asMap()) {
if (fqName.isRoot) continue
// TODO: report error on platform class and impl val, or vice versa
val (platform, impl) =
// TODO: report error on header class and impl val, or vice versa
val (header, impl) =
getTopLevelDescriptorsByFqName(topLevelDescriptorProvider, fqName, NoLookupLocation.WHEN_CHECK_REDECLARATIONS)
.partition { it is MemberDescriptor && it.isPlatform }
.partition { it is MemberDescriptor && it.isHeader }
for (descriptors in listOf(platform, impl)) {
for (descriptors in listOf(header, impl)) {
if (descriptors.size > 1) {
for (directive in declarationsOrPackageDirectives) {
val reportAt = (directive as? KtPackageDirective)?.nameIdentifier ?: directive
@@ -264,20 +264,20 @@ class DeclarationsChecker(
identifierChecker.checkDeclaration(declaration, trace)
checkVarargParameters(trace, constructorDescriptor)
checkConstructorVisibility(constructorDescriptor, declaration)
checkPlatformClassConstructor(constructorDescriptor, declaration)
checkHeaderClassConstructor(constructorDescriptor, declaration)
}
private fun checkPlatformClassConstructor(constructorDescriptor: ClassConstructorDescriptor, declaration: KtConstructor<*>) {
if (!constructorDescriptor.isPlatform) return
private fun checkHeaderClassConstructor(constructorDescriptor: ClassConstructorDescriptor, declaration: KtConstructor<*>) {
if (!constructorDescriptor.isHeader) return
if (declaration.hasBody()) {
trace.report(PLATFORM_DECLARATION_WITH_BODY.on(declaration))
trace.report(HEADER_DECLARATION_WITH_BODY.on(declaration))
}
if (declaration is KtPrimaryConstructor && !DescriptorUtils.isAnnotationClass(constructorDescriptor.constructedClass)) {
for (parameter in declaration.valueParameters) {
if (parameter.hasValOrVar()) {
trace.report(PLATFORM_CLASS_CONSTRUCTOR_PROPERTY_PARAMETER.on(parameter))
trace.report(HEADER_CLASS_CONSTRUCTOR_PROPERTY_PARAMETER.on(parameter))
}
}
}
@@ -285,7 +285,7 @@ class DeclarationsChecker(
if (declaration is KtSecondaryConstructor) {
val delegationCall = declaration.getDelegationCall()
if (!delegationCall.isImplicit) {
trace.report(PLATFORM_CLASS_CONSTRUCTOR_DELEGATION_CALL.on(delegationCall))
trace.report(HEADER_CLASS_CONSTRUCTOR_DELEGATION_CALL.on(delegationCall))
}
}
}
@@ -703,13 +703,13 @@ class DeclarationsChecker(
val initializer = property.initializer
val delegate = property.delegate
val isPlatform = propertyDescriptor.isPlatform
val isHeader = propertyDescriptor.isHeader
if (initializer != null) {
if (inTrait) {
trace.report(PROPERTY_INITIALIZER_IN_INTERFACE.on(initializer))
}
else if (isPlatform) {
trace.report(PLATFORM_PROPERTY_INITIALIZER.on(initializer))
else if (isHeader) {
trace.report(HEADER_PROPERTY_INITIALIZER.on(initializer))
}
else if (!backingFieldRequired) {
trace.report(PROPERTY_INITIALIZER_NO_BACKING_FIELD.on(initializer))
@@ -726,7 +726,7 @@ class DeclarationsChecker(
else {
val isUninitialized = trace.bindingContext.get(BindingContext.IS_UNINITIALIZED, propertyDescriptor) ?: false
val isExternal = DescriptorUtils.isEffectivelyExternal(propertyDescriptor)
if (backingFieldRequired && !inTrait && !propertyDescriptor.isLateInit && !isPlatform && isUninitialized && !isExternal) {
if (backingFieldRequired && !inTrait && !propertyDescriptor.isLateInit && !isHeader && isUninitialized && !isExternal) {
if (containingDeclaration !is ClassDescriptor || hasAccessorImplementation) {
trace.report(MUST_BE_INITIALIZED.on(property))
}
@@ -766,7 +766,7 @@ class DeclarationsChecker(
if (containingDescriptor is ClassDescriptor) {
val inInterface = containingDescriptor.kind == ClassKind.INTERFACE
val isPlatformClass = containingDescriptor.isPlatform
val isHeaderClass = containingDescriptor.isHeader
if (hasAbstractModifier && !classCanHaveAbstractMembers(containingDescriptor)) {
trace.report(ABSTRACT_FUNCTION_IN_NON_ABSTRACT_CLASS.on(function, functionDescriptor.name.asString(), containingDescriptor))
}
@@ -782,29 +782,29 @@ class DeclarationsChecker(
trace.report(REDUNDANT_OPEN_IN_INTERFACE.on(function))
}
}
if (!hasBody && !hasAbstractModifier && !hasExternalModifier && !inInterface && !isPlatformClass) {
if (!hasBody && !hasAbstractModifier && !hasExternalModifier && !inInterface && !isHeaderClass) {
trace.report(NON_ABSTRACT_FUNCTION_WITH_NO_BODY.on(function, functionDescriptor))
}
}
else /* top-level only */ {
if (!function.hasBody() && !hasAbstractModifier && !hasExternalModifier && !functionDescriptor.isPlatform) {
if (!function.hasBody() && !hasAbstractModifier && !hasExternalModifier && !functionDescriptor.isHeader) {
trace.report(NON_MEMBER_FUNCTION_NO_BODY.on(function, functionDescriptor))
}
}
if (functionDescriptor.isPlatform) {
checkPlatformFunction(function)
if (functionDescriptor.isHeader) {
checkHeaderFunction(function)
}
}
private fun checkPlatformFunction(function: KtNamedFunction) {
private fun checkHeaderFunction(function: KtNamedFunction) {
if (function.hasBody()) {
trace.report(PLATFORM_DECLARATION_WITH_BODY.on(function))
trace.report(HEADER_DECLARATION_WITH_BODY.on(function))
}
for (parameter in function.valueParameters) {
if (parameter.hasDefaultValue()) {
trace.report(PLATFORM_DECLARATION_WITH_DEFAULT_PARAMETER.on(parameter))
trace.report(HEADER_DECLARATION_WITH_DEFAULT_PARAMETER.on(parameter))
}
}
}
@@ -858,8 +858,8 @@ class DeclarationsChecker(
accessorDescriptor: PropertyAccessorDescriptor?
) {
if (accessor == null || accessorDescriptor == null) return
if (propertyDescriptor.isPlatform && accessor.hasBody()) {
trace.report(PLATFORM_DECLARATION_WITH_BODY.on(accessor))
if (propertyDescriptor.isHeader && accessor.hasBody()) {
trace.report(HEADER_DECLARATION_WITH_BODY.on(accessor))
}
val accessorModifierList = accessor.modifierList ?: return
@@ -820,8 +820,8 @@ public class DescriptorResolver {
KotlinSourceElementKt.toSourceElement(property),
modifierList != null && modifierList.hasModifier(KtTokens.LATEINIT_KEYWORD),
modifierList != null && modifierList.hasModifier(KtTokens.CONST_KEYWORD),
modifierList != null && modifierList.hasModifier(KtTokens.PLATFORM_KEYWORD) ||
containingDeclaration instanceof ClassDescriptor && ((ClassDescriptor) containingDeclaration).isPlatform(),
modifierList != null && modifierList.hasModifier(KtTokens.HEADER_KEYWORD) ||
containingDeclaration instanceof ClassDescriptor && ((ClassDescriptor) containingDeclaration).isHeader(),
modifierList != null && modifierList.hasModifier(KtTokens.IMPL_KEYWORD),
modifierList != null && modifierList.hasModifier(KtTokens.EXTERNAL_KEYWORD)
);
@@ -1141,7 +1141,7 @@ public class DescriptorResolver {
KotlinSourceElementKt.toSourceElement(parameter),
/* lateInit = */ false,
/* isConst = */ false,
/* isPlatform = */ false,
/* isHeader = */ false,
/* isImpl = */ false,
/* isExternal = */ false
);
@@ -186,8 +186,8 @@ class FunctionDescriptorResolver(
functionDescriptor.isInline = function.hasModifier(KtTokens.INLINE_KEYWORD)
functionDescriptor.isTailrec = function.hasModifier(KtTokens.TAILREC_KEYWORD)
functionDescriptor.isSuspend = function.hasModifier(KtTokens.SUSPEND_KEYWORD)
functionDescriptor.isPlatform = function.hasModifier(KtTokens.PLATFORM_KEYWORD) ||
containingDescriptor is ClassDescriptor && containingDescriptor.isPlatform
functionDescriptor.isHeader = function.hasModifier(KtTokens.HEADER_KEYWORD) ||
containingDescriptor is ClassDescriptor && containingDescriptor.isHeader
functionDescriptor.isImpl = function.hasModifier(KtTokens.IMPL_KEYWORD)
receiverType?.let { ForceResolveUtil.forceResolveAllContents(it.annotations) }
@@ -299,8 +299,8 @@ class FunctionDescriptorResolver(
isPrimary,
declarationToTrace.toSourceElement()
)
if (classDescriptor.isPlatform) {
constructorDescriptor.isPlatform = true
if (classDescriptor.isHeader) {
constructorDescriptor.isHeader = true
}
if (classDescriptor.isImpl) {
constructorDescriptor.isImpl = true
@@ -147,7 +147,7 @@ class LocalVariableResolver(
variable.toSourceElement(),
/* lateInit = */ false,
/* isConst = */ false,
/* isPlatform = */ false,
/* isHeader = */ false,
/* isImpl = */ false,
/* isExternal = */ false
)
@@ -90,7 +90,7 @@ object ModifierCheckerCore {
CONST_KEYWORD to EnumSet.of(MEMBER_PROPERTY, TOP_LEVEL_PROPERTY),
OPERATOR_KEYWORD to EnumSet.of(FUNCTION),
INFIX_KEYWORD to EnumSet.of(FUNCTION),
PLATFORM_KEYWORD to EnumSet.of(TOP_LEVEL_FUNCTION, TOP_LEVEL_PROPERTY_WITHOUT_FIELD_OR_DELEGATE, CLASS_ONLY, OBJECT, INTERFACE, INNER_CLASS, ENUM_CLASS, ANNOTATION_CLASS),
HEADER_KEYWORD to EnumSet.of(TOP_LEVEL_FUNCTION, TOP_LEVEL_PROPERTY_WITHOUT_FIELD_OR_DELEGATE, CLASS_ONLY, OBJECT, INTERFACE, INNER_CLASS, ENUM_CLASS, ANNOTATION_CLASS),
IMPL_KEYWORD to EnumSet.of(TOP_LEVEL_FUNCTION, MEMBER_FUNCTION, TOP_LEVEL_PROPERTY, MEMBER_PROPERTY, CONSTRUCTOR, CLASS_ONLY, OBJECT, INTERFACE, INNER_CLASS, ENUM_CLASS, ANNOTATION_CLASS, TYPEALIAS)
)
@@ -98,7 +98,7 @@ object ModifierCheckerCore {
COROUTINE_KEYWORD to LanguageFeature.Coroutines,
SUSPEND_KEYWORD to LanguageFeature.Coroutines,
INLINE_KEYWORD to LanguageFeature.InlineProperties,
PLATFORM_KEYWORD to LanguageFeature.MultiPlatformProjects,
HEADER_KEYWORD to LanguageFeature.MultiPlatformProjects,
IMPL_KEYWORD to LanguageFeature.MultiPlatformProjects
)
@@ -253,7 +253,7 @@ class OverloadResolver(
if (isConstructorsOfDifferentRedeclaredClasses(member1, member2)) continue
if (isTopLevelMainInDifferentFiles(member1, member2)) continue
if (isDefinitionsForDifferentPlatforms(member1, member2)) continue
if (isPlatformDeclarationAndDefinition(member1, member2) || isPlatformDeclarationAndDefinition(member2, member1)) continue
if (isHeaderDeclarationAndDefinition(member1, member2) || isHeaderDeclarationAndDefinition(member2, member1)) continue
if (!overloadChecker.isOverloadable(member1, member2)) {
redeclarations.add(member1)
@@ -283,9 +283,9 @@ class OverloadResolver(
return file1 == null || file2 == null || file1 !== file2
}
private fun isPlatformDeclarationAndDefinition(declaration: DeclarationDescriptor, definition: DeclarationDescriptor): Boolean {
return declaration is MemberDescriptor && declaration.isPlatform &&
definition is MemberDescriptor && !definition.isPlatform
private fun isHeaderDeclarationAndDefinition(declaration: DeclarationDescriptor, definition: DeclarationDescriptor): Boolean {
return declaration is MemberDescriptor && declaration.isHeader &&
definition is MemberDescriptor && !definition.isHeader
}
private fun isDefinitionsForDifferentPlatforms(member1: DeclarationDescriptorNonRoot, member2: DeclarationDescriptorNonRoot): Boolean {
@@ -98,7 +98,7 @@ class DynamicCallableDescriptors(storageManager: StorageManager, builtIns: Kotli
SourceElement.NO_SOURCE,
/* lateInit = */ false,
/* isConst = */ false,
/* isPlatform = */ false,
/* isHeader = */ false,
/* isImpl = */ false,
/* isExternal = */ false
)
@@ -28,8 +28,8 @@ import org.jetbrains.kotlin.psi.KtDeclaration
import org.jetbrains.kotlin.psi.KtElement
import org.jetbrains.kotlin.resolve.BindingContext
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
import org.jetbrains.kotlin.resolve.checkers.PlatformImplDeclarationChecker.Compatibility.Compatible
import org.jetbrains.kotlin.resolve.checkers.PlatformImplDeclarationChecker.Compatibility.Incompatible
import org.jetbrains.kotlin.resolve.checkers.HeaderImplDeclarationChecker.Compatibility.Compatible
import org.jetbrains.kotlin.resolve.checkers.HeaderImplDeclarationChecker.Compatibility.Incompatible
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameUnsafe
import org.jetbrains.kotlin.resolve.descriptorUtil.module
@@ -43,7 +43,7 @@ import org.jetbrains.kotlin.types.typeUtil.asTypeProjection
import org.jetbrains.kotlin.utils.SmartList
import org.jetbrains.kotlin.utils.keysToMap
class PlatformImplDeclarationChecker : DeclarationChecker {
class HeaderImplDeclarationChecker : DeclarationChecker {
override fun check(
declaration: KtDeclaration,
descriptor: DeclarationDescriptor,
@@ -55,16 +55,16 @@ class PlatformImplDeclarationChecker : DeclarationChecker {
if (descriptor !is MemberDescriptor) return
if (descriptor.isPlatform && declaration.hasModifier(KtTokens.PLATFORM_KEYWORD)) {
if (descriptor.isHeader && declaration.hasModifier(KtTokens.HEADER_KEYWORD)) {
val checkImpl = !languageVersionSettings.supportsFeature(LanguageFeature.MultiPlatformDoNotCheckImpl)
checkPlatformDeclarationHasDefinition(declaration, descriptor, diagnosticHolder, checkImpl)
checkHeaderDeclarationHasImplementation(declaration, descriptor, diagnosticHolder, checkImpl)
}
else if (descriptor.isImpl && declaration.hasModifier(KtTokens.IMPL_KEYWORD)) {
checkImplementationHasPlatformDeclaration(declaration, descriptor, diagnosticHolder)
checkImplementationHasHeaderDeclaration(declaration, descriptor, diagnosticHolder)
}
}
private fun checkPlatformDeclarationHasDefinition(
private fun checkHeaderDeclarationHasImplementation(
reportOn: KtDeclaration, descriptor: MemberDescriptor, diagnosticHolder: DiagnosticSink, checkImpl: Boolean
) {
val compatibility = when (descriptor) {
@@ -92,17 +92,17 @@ class PlatformImplDeclarationChecker : DeclarationChecker {
assert(compatibility.keys.all { it is Incompatible })
@Suppress("UNCHECKED_CAST")
val incompatibility = compatibility as Map<Incompatible, Collection<MemberDescriptor>>
diagnosticHolder.report(Errors.PLATFORM_DECLARATION_WITHOUT_DEFINITION.on(reportOn, descriptor, incompatibility))
diagnosticHolder.report(Errors.HEADER_WITHOUT_IMPLEMENTATION.on(reportOn, descriptor, incompatibility))
}
}
private fun checkImplementationHasPlatformDeclaration(
private fun checkImplementationHasHeaderDeclaration(
reportOn: KtDeclaration, descriptor: MemberDescriptor, diagnosticHolder: DiagnosticSink
) {
fun ClassifierDescriptor.findDeclarationForClass(): ClassDescriptor? =
findClassifiersFromTheSameModule().firstOrNull { declaration ->
this != declaration &&
declaration is ClassDescriptor && declaration.isPlatform &&
declaration is ClassDescriptor && declaration.isHeader &&
areCompatibleClassifiers(declaration, this, checkImpl = false) == Compatible
} as? ClassDescriptor
@@ -116,7 +116,7 @@ class PlatformImplDeclarationChecker : DeclarationChecker {
}
candidates.any { declaration ->
descriptor != declaration &&
declaration.isPlatform &&
declaration.isHeader &&
areCompatibleCallables(declaration, descriptor, checkImpl = false) == Compatible
}
}
@@ -125,8 +125,8 @@ class PlatformImplDeclarationChecker : DeclarationChecker {
}
if (!hasDeclaration) {
// TODO: do not report this error for members which are "almost compatible" with some platform declarations
diagnosticHolder.report(Errors.PLATFORM_DEFINITION_WITHOUT_DECLARATION.on(reportOn.modifierList!!.getModifier(KtTokens.IMPL_KEYWORD)!!))
// TODO: do not report this error for members which are "almost compatible" with some header declarations
diagnosticHolder.report(Errors.IMPLEMENTATION_WITHOUT_HEADER.on(reportOn.modifierList!!.getModifier(KtTokens.IMPL_KEYWORD)!!))
}
}
@@ -141,7 +141,7 @@ object InlineAnalyzerExtension : AnalyzerExtensions.AnalyzerExtension {
if (InlineUtil.containsReifiedTypeParameters(functionDescriptor) ||
functionDescriptor.isInlineOnlyOrReified() ||
functionDescriptor.isPlatform) return
functionDescriptor.isHeader) return
val reportOn = function.modifierList?.getModifier(KtTokens.INLINE_KEYWORD) ?: function
trace.report(Errors.NOTHING_TO_INLINE.on(reportOn, functionDescriptor))
@@ -93,7 +93,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
private final ClassKind kind;
private final boolean isInner;
private final boolean isData;
private final boolean isPlatform;
private final boolean isHeader;
private final boolean isImpl;
private final Annotations annotations;
@@ -177,7 +177,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
this.isInner = isInnerClass(modifierList) && !ModifiersChecker.isIllegalInner(this);
this.isData = modifierList != null && modifierList.hasModifier(KtTokens.DATA_KEYWORD);
this.isPlatform = modifierList != null && modifierList.hasModifier(KtTokens.PLATFORM_KEYWORD);
this.isHeader = modifierList != null && modifierList.hasModifier(KtTokens.HEADER_KEYWORD);
this.isImpl = modifierList != null && modifierList.hasModifier(KtTokens.IMPL_KEYWORD);
// Annotation entries are taken from both own annotations (if any) and object literal annotations (if any)
@@ -529,8 +529,8 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
}
@Override
public boolean isPlatform() {
return isPlatform;
public boolean isHeader() {
return isHeader;
}
@Override
@@ -40,11 +40,11 @@ class JvmPropertyDescriptorImpl(
source: SourceElement,
isLateInit: Boolean,
isConst: Boolean,
isPlatform: Boolean,
isHeader: Boolean,
isImpl: Boolean
) : JvmDescriptorWithExtraFlags, PropertyDescriptorImpl(
containingDeclaration, original, annotations, modality, visibility, isVar,
name, kind, source, isLateInit, isConst, isPlatform, isImpl, /* isExternal = */ false
name, kind, source, isLateInit, isConst, isHeader, isImpl, /* isExternal = */ false
) {
override fun createSubstitutedCopy(
newOwner: DeclarationDescriptor,
@@ -55,7 +55,7 @@ class JvmPropertyDescriptorImpl(
): PropertyDescriptorImpl =
JvmPropertyDescriptorImpl(
newOwner, original, annotations, newModality, newVisibility, extraFlags, isVar, name, kind,
SourceElement.NO_SOURCE, isLateInit, isConst, isPlatform, isImpl
SourceElement.NO_SOURCE, isLateInit, isConst, isHeader, isImpl
)
companion object {
@@ -138,7 +138,7 @@ open class KnownClassDescriptor(
override fun isCompanionObject(): Boolean = false
override fun isData(): Boolean = false
override fun isInner(): Boolean = false
override fun isPlatform(): Boolean = false
override fun isHeader(): Boolean = false
override fun isImpl(): Boolean = false
override fun isExternal(): Boolean = false
@@ -59,7 +59,7 @@ class JvmSharedVariablesManager(val builtIns: KotlinBuiltIns) : SharedVariablesM
PropertyDescriptorImpl.create(
refClass, Annotations.EMPTY, Modality.FINAL, Visibilities.PUBLIC, true,
Name.identifier("element"), CallableMemberDescriptor.Kind.DECLARATION, SourceElement.NO_SOURCE,
/* lateInit = */ false, /* isConst = */ false, /* isPlatform = */ false, /* isImpl = */ false,
/* lateInit = */ false, /* isConst = */ false, /* isHeader = */ false, /* isImpl = */ false,
/* isExternal = */ false
).initialize(type, dispatchReceiverParameter = refClass.thisAsReceiverParameter)
}
@@ -100,7 +100,7 @@ class JvmSharedVariablesManager(val builtIns: KotlinBuiltIns) : SharedVariablesM
PropertyDescriptorImpl.create(
genericRefClass, Annotations.EMPTY, Modality.FINAL, Visibilities.PUBLIC, true,
Name.identifier("element"), CallableMemberDescriptor.Kind.DECLARATION, SourceElement.NO_SOURCE,
/* lateInit = */ false, /* isConst = */ false, /* isPlatform = */ false, /* isImpl = */ false,
/* lateInit = */ false, /* isConst = */ false, /* isHeader = */ false, /* isImpl = */ false,
/* isExternal = */ false
).initialize(
type = builtIns.anyType,
@@ -129,7 +129,7 @@ class SpecialDescriptorsFactory(
Annotations.EMPTY, Modality.FINAL, Visibilities.PUBLIC, false,
Name.identifier("INSTANCE"),
CallableMemberDescriptor.Kind.SYNTHESIZED, SourceElement.NO_SOURCE, /* lateInit = */ false, /* isConst = */ false,
/* isPlatform = */ false, /* isImpl = */ false, /* isExternal = */ false
/* isHeader = */ false, /* isImpl = */ false, /* isExternal = */ false
).initialize(objectDescriptor.defaultType)
return instanceFieldDescriptor
@@ -54,7 +54,7 @@ abstract class IrBuiltinOperatorDescriptorBase(containingDeclaration: Declaratio
override fun isOperator(): Boolean = false
override fun isSuspend(): Boolean = false
override fun isTailrec(): Boolean = false
override fun isPlatform(): Boolean = false
override fun isHeader(): Boolean = false
override fun isImpl(): Boolean = false
override fun hasStableParameterNames(): Boolean = true
override fun hasSynthesizedParameterNames(): Boolean = false
@@ -60,7 +60,7 @@ abstract class IrDelegateDescriptorBase(
SourceElement.NO_SOURCE,
/* lateInit = */ false,
/* isConst = */ false,
/* isPlatform = */ false,
/* isHeader = */ false,
/* isImpl = */ false,
/* isExternal = */ false
) {
@@ -352,7 +352,7 @@ abstract class KtLightClassForSourceDeclaration(protected val classOrObject: KtC
fun create(classOrObject: KtClassOrObject): KtLightClassForSourceDeclaration? {
if (classOrObject.getContainingKtFile().isScript || classOrObject.hasModifier(KtTokens.PLATFORM_KEYWORD)) {
if (classOrObject.getContainingKtFile().isScript || classOrObject.hasModifier(KtTokens.HEADER_KEYWORD)) {
return null
}
@@ -44,7 +44,7 @@ class FlatSignature<out T> private constructor(
val hasExtensionReceiver: Boolean,
val hasVarargs: Boolean,
val numDefaults: Int,
val isPlatform: Boolean,
val isHeader: Boolean,
val isSyntheticMember: Boolean
) {
val isGeneric = typeParameters.isNotEmpty()
@@ -65,7 +65,7 @@ class FlatSignature<out T> private constructor(
hasExtensionReceiver = extensionReceiverType != null,
hasVarargs = descriptor.valueParameters.any { it.varargElementType != null },
numDefaults = numDefaults,
isPlatform = descriptor is MemberDescriptor && descriptor.isPlatform,
isHeader = descriptor is MemberDescriptor && descriptor.isHeader,
isSyntheticMember = descriptor is SyntheticMemberDescriptor<*>
)
}
@@ -241,8 +241,8 @@ class OverloadingConflictResolver<C : Any>(
if (isGeneric1 && isGeneric2) return false
}
if (!call1.isPlatform && call2.isPlatform) return true
if (call1.isPlatform && !call2.isPlatform) return false
if (!call1.isHeader && call2.isHeader) return true
if (call1.isHeader && !call2.isHeader) return false
return createEmptyConstraintSystem().isSignatureNotLessSpecific(call1, call2, SpecificityComparisonWithNumerics, specificityComparator)
}
@@ -2,28 +2,28 @@
// MODULE: m1-common
// FILE: common.kt
<!WRONG_MODIFIER_TARGET!>platform<!> typealias Foo = String
<!WRONG_MODIFIER_TARGET!>header<!> typealias Foo = String
class Outer <!WRONG_MODIFIER_TARGET!>platform<!> constructor() {
platform class Nested
class Outer <!WRONG_MODIFIER_TARGET!>header<!> constructor() {
header class Nested
<!WRONG_MODIFIER_TARGET!>platform<!> init {}
<!WRONG_MODIFIER_TARGET!>header<!> init {}
<!NON_ABSTRACT_FUNCTION_WITH_NO_BODY!><!WRONG_MODIFIER_TARGET!>platform<!> fun foo()<!>
<!WRONG_MODIFIER_TARGET!>platform<!> val bar: Int
<!NON_ABSTRACT_FUNCTION_WITH_NO_BODY!><!WRONG_MODIFIER_TARGET!>header<!> fun foo()<!>
<!WRONG_MODIFIER_TARGET!>header<!> val bar: Int
}
fun foo() {
<!WRONG_MODIFIER_TARGET!>platform<!> fun localFun()
<!WRONG_MODIFIER_TARGET!>platform<!> var <!UNUSED_VARIABLE!>x<!> = 42
<!WRONG_MODIFIER_TARGET!>platform<!> class Bar
<!WRONG_MODIFIER_TARGET!>header<!> fun localFun()
<!WRONG_MODIFIER_TARGET!>header<!> var <!UNUSED_VARIABLE!>x<!> = 42
<!WRONG_MODIFIER_TARGET!>header<!> class Bar
}
// MODULE: m2-jvm
// FILE: jvm.kt
class Outer impl constructor() {
<!PLATFORM_DEFINITION_WITHOUT_DECLARATION!>impl<!> class Nested
<!IMPLEMENTATION_WITHOUT_HEADER!>impl<!> class Nested
<!WRONG_MODIFIER_TARGET!>impl<!> init {}
}
@@ -31,5 +31,5 @@ class Outer impl constructor() {
fun foo() {
<!WRONG_MODIFIER_TARGET!>impl<!> fun localFun() {}
<!WRONG_MODIFIER_TARGET!>impl<!> var <!UNUSED_VARIABLE!>x<!> = 42
<!PLATFORM_DEFINITION_WITHOUT_DECLARATION, WRONG_MODIFIER_TARGET!>impl<!> class Bar
<!IMPLEMENTATION_WITHOUT_HEADER, WRONG_MODIFIER_TARGET!>impl<!> class Bar
}
@@ -7,11 +7,11 @@ public final class Outer {
public constructor Outer()
public final val bar: kotlin.Int
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final platform fun foo(): kotlin.Unit
public final header fun foo(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public final platform class Nested {
public final header class Nested {
public constructor Nested()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -2,15 +2,15 @@
// MODULE: m1-common
// FILE: common.kt
platform interface Interface
header interface Interface
platform annotation class Anno(val prop: String)
header annotation class Anno(val prop: String)
platform object Object
header object Object
platform class Class
header class Class
platform enum class En { ENTRY }
header enum class En { ENTRY }
// MODULE: m2-jvm(m1-common)
// FILE: jvm.kt
@@ -1,7 +1,7 @@
// -- Module: <m1-common> --
package
public final platform annotation class Anno : kotlin.Annotation {
public final header annotation class Anno : kotlin.Annotation {
public constructor Anno(/*0*/ prop: kotlin.String)
public final val prop: kotlin.String
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
@@ -9,14 +9,14 @@ public final platform annotation class Anno : kotlin.Annotation {
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final platform class Class {
public final header class Class {
public constructor Class()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final platform enum class En : kotlin.Enum<En> {
public final header enum class En : kotlin.Enum<En> {
enum entry ENTRY
private constructor En()
@@ -33,13 +33,13 @@ public final platform enum class En : kotlin.Enum<En> {
public final /*synthesized*/ fun values(): kotlin.Array<En>
}
public platform interface Interface {
public header interface Interface {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public platform object Object {
public header object Object {
private constructor Object()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -1,14 +1,14 @@
// !LANGUAGE: +MultiPlatformProjects
// MODULE: m1-common
// FILE: common.kt
platform open class A {
header open class A {
constructor(s: String)
constructor(n: Number) : <!PLATFORM_CLASS_CONSTRUCTOR_DELEGATION_CALL!>this<!>("A")
constructor(n: Number) : <!HEADER_CLASS_CONSTRUCTOR_DELEGATION_CALL!>this<!>("A")
}
platform class B : A {
header class B : A {
constructor(i: Int)
constructor() : <!PLATFORM_CLASS_CONSTRUCTOR_DELEGATION_CALL!>super<!>("B")
constructor() : <!HEADER_CLASS_CONSTRUCTOR_DELEGATION_CALL!>super<!>("B")
}
@@ -1,6 +1,6 @@
package
public open platform class A {
public open header class A {
public constructor A(/*0*/ n: kotlin.Number)
public constructor A(/*0*/ s: kotlin.String)
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
@@ -8,7 +8,7 @@ public open platform class A {
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final platform class B : A {
public final header class B : A {
public constructor B()
public constructor B(/*0*/ i: kotlin.Int)
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
@@ -1,18 +1,18 @@
// !DIAGNOSTICS: -PLATFORM_DEFINITION_WITHOUT_DECLARATION
// !DIAGNOSTICS: -IMPLEMENTATION_WITHOUT_HEADER
// !LANGUAGE: +MultiPlatformProjects
// MODULE: m1-common
// FILE: common.kt
platform class C1
platform class C2<A>
platform class C3<B>
platform class C4<D, E>
platform class C5<F, G>
platform class C6<H>
platform class C7<I>
platform class C8<J>
platform class C9<K>
platform class C10<L>
header class C1
header class C2<A>
header class C3<B>
header class C4<D, E>
header class C5<F, G>
header class C6<H>
header class C7<I>
header class C8<J>
header class C9<K>
header class C10<L>
// MODULE: m2-jvm(m1-common)
// FILE: jvm.kt
@@ -1,70 +1,70 @@
// -- Module: <m1-common> --
package
public final platform class C1 {
public final header class C1 {
public constructor C1()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final platform class C10</*0*/ L> {
public final header class C10</*0*/ L> {
public constructor C10</*0*/ L>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final platform class C2</*0*/ A> {
public final header class C2</*0*/ A> {
public constructor C2</*0*/ A>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final platform class C3</*0*/ B> {
public final header class C3</*0*/ B> {
public constructor C3</*0*/ B>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final platform class C4</*0*/ D, /*1*/ E> {
public final header class C4</*0*/ D, /*1*/ E> {
public constructor C4</*0*/ D, /*1*/ E>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final platform class C5</*0*/ F, /*1*/ G> {
public final header class C5</*0*/ F, /*1*/ G> {
public constructor C5</*0*/ F, /*1*/ G>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final platform class C6</*0*/ H> {
public final header class C6</*0*/ H> {
public constructor C6</*0*/ H>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final platform class C7</*0*/ I> {
public final header class C7</*0*/ I> {
public constructor C7</*0*/ I>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final platform class C8</*0*/ J> {
public final header class C8</*0*/ J> {
public constructor C8</*0*/ J>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final platform class C9</*0*/ K> {
public final header class C9</*0*/ K> {
public constructor C9</*0*/ K>()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -1,7 +1,7 @@
// !LANGUAGE: +MultiPlatformProjects
// MODULE: m1-common
// FILE: common.kt
platform class Foo {
header class Foo {
val foo: String
fun bar(x: Int): Int
@@ -1,10 +1,10 @@
// -- Module: <m1-common> --
package
public final platform class Foo {
public final header class Foo {
public constructor Foo()
public final val foo: kotlin.String
public final platform fun bar(/*0*/ x: kotlin.Int): kotlin.Int
public final header fun bar(/*0*/ x: kotlin.Int): kotlin.Int
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
@@ -1,29 +1,29 @@
// !LANGUAGE: +MultiPlatformProjects
// MODULE: m1-common
// FILE: common.kt
platform class Foo(
<!PLATFORM_CLASS_CONSTRUCTOR_PROPERTY_PARAMETER!>val constructorProperty: String<!>,
header class Foo(
<!HEADER_CLASS_CONSTRUCTOR_PROPERTY_PARAMETER!>val constructorProperty: String<!>,
constructorParameter: String
) {
<!PLATFORM_DECLARATION_WITH_BODY!>init<!> {
<!HEADER_DECLARATION_WITH_BODY!>init<!> {
<!UNUSED_EXPRESSION, UNUSED_EXPRESSION!>"no"<!>
}
<!PLATFORM_DECLARATION_WITH_BODY!>constructor(s: String)<!> {
<!HEADER_DECLARATION_WITH_BODY!>constructor(s: String)<!> {
<!UNUSED_EXPRESSION!>"no"<!>
}
constructor() : <!PLATFORM_CLASS_CONSTRUCTOR_DELEGATION_CALL!>this<!>("no")
constructor() : <!HEADER_CLASS_CONSTRUCTOR_DELEGATION_CALL!>this<!>("no")
val prop: String = <!PLATFORM_PROPERTY_INITIALIZER!>"no"<!>
val prop: String = <!HEADER_PROPERTY_INITIALIZER!>"no"<!>
var getSet: String
<!PLATFORM_DECLARATION_WITH_BODY!>get()<!> = "no"
<!PLATFORM_DECLARATION_WITH_BODY!>set(value)<!> {}
<!HEADER_DECLARATION_WITH_BODY!>get()<!> = "no"
<!HEADER_DECLARATION_WITH_BODY!>set(value)<!> {}
fun defaultArg(<!PLATFORM_DECLARATION_WITH_DEFAULT_PARAMETER!>value: String = "no"<!>)
fun defaultArg(<!HEADER_DECLARATION_WITH_DEFAULT_PARAMETER!>value: String = "no"<!>)
<!PLATFORM_DECLARATION_WITH_BODY!>fun functionWithBody(x: Int): Int<!> {
<!HEADER_DECLARATION_WITH_BODY!>fun functionWithBody(x: Int): Int<!> {
return x + 1
}
}
@@ -1,15 +1,15 @@
package
public final platform class Foo {
public final header class Foo {
public constructor Foo()
public constructor Foo(/*0*/ s: kotlin.String)
public constructor Foo(/*0*/ constructorProperty: kotlin.String, /*1*/ constructorParameter: kotlin.String)
public final val constructorProperty: kotlin.String
public final var getSet: kotlin.String
public final val prop: kotlin.String = "no"
public final platform fun defaultArg(/*0*/ value: kotlin.String = ...): kotlin.Unit
public final header fun defaultArg(/*0*/ value: kotlin.String = ...): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final platform fun functionWithBody(/*0*/ x: kotlin.Int): kotlin.Int
public final header fun functionWithBody(/*0*/ x: kotlin.Int): kotlin.Int
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -1,7 +1,7 @@
// !LANGUAGE: +MultiPlatformProjects
// MODULE: m1-common
// FILE: common.kt
platform class Foo
header class Foo
// MODULE: m2-jvm(m1-common)
// FILE: jvm.kt
@@ -1,7 +1,7 @@
// -- Module: <m1-common> --
package
public final platform class Foo {
public final header class Foo {
public constructor Foo()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -6,7 +6,7 @@ interface I
open class C
interface J
platform class Foo : I, C, J
header class Foo : I, C, J
// MODULE: m2-jvm(m1-common)
// FILE: jvm.kt
@@ -8,7 +8,7 @@ public open class C {
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final platform class Foo : I, C, J {
public final header class Foo : I, C, J {
public constructor Foo()
public open override /*3*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*3*/ /*fake_override*/ fun hashCode(): kotlin.Int
@@ -2,7 +2,7 @@
// MODULE: m1-common
// FILE: common.kt
platform fun foo(x: Int): Int
header fun foo(x: Int): Int
fun callFromCommonCode(x: Int) = foo(x)
@@ -2,7 +2,7 @@
package
public fun callFromCommonCode(/*0*/ x: kotlin.Int): kotlin.Int
public platform fun foo(/*0*/ x: kotlin.Int): kotlin.Int
public header fun foo(/*0*/ x: kotlin.Int): kotlin.Int
// -- Module: <m2-jvm> --
@@ -2,7 +2,7 @@
// MODULE: m1-common
// FILE: common.kt
<!CONFLICTING_OVERLOADS!>platform fun foo()<!>
<!CONFLICTING_OVERLOADS!>platform fun foo()<!>
<!CONFLICTING_OVERLOADS!>header fun foo()<!>
<!CONFLICTING_OVERLOADS!>header fun foo()<!>
platform fun foo(x: Int)
header fun foo(x: Int)
@@ -1,5 +1,5 @@
package
public platform fun foo(): kotlin.Unit
public platform fun foo(): kotlin.Unit
public platform fun foo(/*0*/ x: kotlin.Int): kotlin.Unit
public header fun foo(): kotlin.Unit
public header fun foo(): kotlin.Unit
public header fun foo(/*0*/ x: kotlin.Int): kotlin.Unit
@@ -2,7 +2,7 @@
// MODULE: m1-common
// FILE: common.kt
platform fun foo()
header fun foo()
// MODULE: m2-jvm(m1-common)
// FILE: jvm.kt
@@ -1,7 +1,7 @@
// -- Module: <m1-common> --
package
public platform fun foo(): kotlin.Unit
public header fun foo(): kotlin.Unit
// -- Module: <m2-jvm> --
@@ -3,16 +3,16 @@
// FILE: common.kt
package common
platform fun foo()
header fun foo()
// MODULE: m2-jvm(m1-common)
// FILE: jvm.kt
package jvm
<!PLATFORM_DEFINITION_WITHOUT_DECLARATION!>impl<!> fun foo() {}
<!IMPLEMENTATION_WITHOUT_HEADER!>impl<!> fun foo() {}
// MODULE: m3-js(m1-common)
// FILE: js.kt
package js
<!PLATFORM_DEFINITION_WITHOUT_DECLARATION!>impl<!> fun foo() {}
<!IMPLEMENTATION_WITHOUT_HEADER!>impl<!> fun foo() {}
@@ -2,7 +2,7 @@
package
package common {
public platform fun foo(): kotlin.Unit
public header fun foo(): kotlin.Unit
}
@@ -2,4 +2,4 @@
// MODULE: m1-common
// FILE: common.kt
platform fun foo()
header fun foo()
@@ -1,3 +1,3 @@
package
public platform fun foo(): kotlin.Unit
public header fun foo(): kotlin.Unit
@@ -2,4 +2,4 @@
// MODULE: m1-common
// FILE: common.kt
platform fun foo(x: Int, <!PLATFORM_DECLARATION_WITH_DEFAULT_PARAMETER!>y: String = ""<!>)
header fun foo(x: Int, <!HEADER_DECLARATION_WITH_DEFAULT_PARAMETER!>y: String = ""<!>)
@@ -1,3 +1,3 @@
package
public platform fun foo(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.String = ...): kotlin.Unit
public header fun foo(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.String = ...): kotlin.Unit
@@ -2,4 +2,4 @@
// MODULE: m1-jvm
// FILE: jvm.kt
<!PLATFORM_DEFINITION_WITHOUT_DECLARATION!>impl<!> fun foo() { }
<!IMPLEMENTATION_WITHOUT_HEADER!>impl<!> fun foo() { }
@@ -2,17 +2,17 @@
// MODULE: m1-common
// FILE: common.kt
inline platform fun inlineFun()
platform fun nonInlineFun()
inline header fun inlineFun()
header fun nonInlineFun()
// MODULE: m2-jvm(m1-common)
// FILE: jvm.kt
<!PLATFORM_DEFINITION_WITHOUT_DECLARATION!>impl<!> fun inlineFun() { }
<!IMPLEMENTATION_WITHOUT_HEADER!>impl<!> fun inlineFun() { }
impl fun nonInlineFun() { }
// MODULE: m3-js(m1-common)
// FILE: js.kt
impl <!NOTHING_TO_INLINE!>inline<!> fun inlineFun() { }
<!PLATFORM_DEFINITION_WITHOUT_DECLARATION!>impl<!> <!NOTHING_TO_INLINE!>inline<!> fun nonInlineFun() { }
<!IMPLEMENTATION_WITHOUT_HEADER!>impl<!> <!NOTHING_TO_INLINE!>inline<!> fun nonInlineFun() { }
@@ -1,8 +1,8 @@
// -- Module: <m1-common> --
package
public inline platform fun inlineFun(): kotlin.Unit
public platform fun nonInlineFun(): kotlin.Unit
public inline header fun inlineFun(): kotlin.Unit
public header fun nonInlineFun(): kotlin.Unit
// -- Module: <m2-jvm> --
@@ -2,8 +2,8 @@
// MODULE: m1-common
// FILE: common.kt
<!CONFLICTING_OVERLOADS!>platform fun foo()<!>
<!CONFLICTING_OVERLOADS!>header fun foo()<!>
<!CONFLICTING_OVERLOADS, PLATFORM_DECLARATION_WITH_BODY!>platform fun foo()<!> {}
<!CONFLICTING_OVERLOADS, HEADER_DECLARATION_WITH_BODY!>header fun foo()<!> {}
<!PLATFORM_DECLARATION_WITH_BODY!>platform fun bar()<!> {}
<!HEADER_DECLARATION_WITH_BODY!>header fun bar()<!> {}
@@ -1,5 +1,5 @@
package
public platform fun bar(): kotlin.Unit
public platform fun foo(): kotlin.Unit
public platform fun foo(): kotlin.Unit
public header fun bar(): kotlin.Unit
public header fun foo(): kotlin.Unit
public header fun foo(): kotlin.Unit
@@ -2,11 +2,11 @@
// MODULE: m1-common
// FILE: common.kt
platform fun foo()
header fun foo()
// MODULE: m2-jvm(m1-common)
// FILE: jvm.kt
<!NON_MEMBER_FUNCTION_NO_BODY!>impl fun foo()<!>
<!NON_MEMBER_FUNCTION_NO_BODY!><!PLATFORM_DEFINITION_WITHOUT_DECLARATION!>impl<!> fun bar()<!>
<!NON_MEMBER_FUNCTION_NO_BODY!><!IMPLEMENTATION_WITHOUT_HEADER!>impl<!> fun bar()<!>
@@ -1,7 +1,7 @@
// -- Module: <m1-common> --
package
public platform fun foo(): kotlin.Unit
public header fun foo(): kotlin.Unit
// -- Module: <m2-jvm> --
@@ -1,7 +1,7 @@
// !LANGUAGE: +MultiPlatformProjects
// MODULE: m1-common
// FILE: common.kt
platform fun foo()
header fun foo()
// MODULE: m2-jvm(m1-common)
// FILE: jvm.kt
@@ -1,7 +1,7 @@
// -- Module: <m1-common> --
package
public platform fun foo(): kotlin.Unit
public header fun foo(): kotlin.Unit
// -- Module: <m2-jvm> --
@@ -2,39 +2,39 @@
// MODULE: m1-common
// FILE: common.kt
platform val justVal: String
platform var justVar: String
header val justVal: String
header var justVar: String
platform val String.extensionVal: Unit
platform var <T> T.genericExtensionVar: T
header val String.extensionVal: Unit
header var <T> T.genericExtensionVar: T
platform val valWithGet: String
header val valWithGet: String
get
platform var varWithGetSet: String
header var varWithGetSet: String
get set
platform var varWithPlatformGetSet: String
<!WRONG_MODIFIER_TARGET!>platform<!> get
<!WRONG_MODIFIER_TARGET!>platform<!> set
header var varWithPlatformGetSet: String
<!WRONG_MODIFIER_TARGET!>header<!> get
<!WRONG_MODIFIER_TARGET!>header<!> set
platform val backingFieldVal: String = <!PLATFORM_PROPERTY_INITIALIZER!>"no"<!>
platform var backingFieldVar: String = <!PLATFORM_PROPERTY_INITIALIZER!>"no"<!>
header val backingFieldVal: String = <!HEADER_PROPERTY_INITIALIZER!>"no"<!>
header var backingFieldVar: String = <!HEADER_PROPERTY_INITIALIZER!>"no"<!>
platform val customAccessorVal: String
<!PLATFORM_DECLARATION_WITH_BODY!>get()<!> = "no"
platform var customAccessorVar: String
<!PLATFORM_DECLARATION_WITH_BODY!>get()<!> = "no"
<!PLATFORM_DECLARATION_WITH_BODY!>set(value)<!> {}
header val customAccessorVal: String
<!HEADER_DECLARATION_WITH_BODY!>get()<!> = "no"
header var customAccessorVar: String
<!HEADER_DECLARATION_WITH_BODY!>get()<!> = "no"
<!HEADER_DECLARATION_WITH_BODY!>set(value)<!> {}
platform <!CONST_VAL_WITHOUT_INITIALIZER!>const<!> val constVal: Int
header <!CONST_VAL_WITHOUT_INITIALIZER!>const<!> val constVal: Int
platform <!WRONG_MODIFIER_TARGET!>lateinit<!> var lateinitVar: String
header <!WRONG_MODIFIER_TARGET!>lateinit<!> var lateinitVar: String
<!WRONG_MODIFIER_TARGET!>platform<!> val delegated: String by Delegate
<!WRONG_MODIFIER_TARGET!>header<!> val delegated: String by Delegate
object Delegate { operator fun getValue(x: Any?, y: Any?): String = "" }
fun test(): String {
<!WRONG_MODIFIER_TARGET!>platform<!> val localVariable: String
<!WRONG_MODIFIER_TARGET!>header<!> val localVariable: String
localVariable = "no"
return localVariable
}
@@ -1,7 +1,7 @@
// !LANGUAGE: +MultiPlatformProjects
// MODULE: m1-common
// FILE: common.kt
platform var foo: String
header var foo: String
// MODULE: m2-jvm(m1-common)
// FILE: jvm.kt
@@ -1,6 +1,6 @@
<!UNSUPPORTED_FEATURE!>platform<!> fun foo1()
<!UNSUPPORTED_FEATURE!>platform<!> val bar1 = <!PLATFORM_PROPERTY_INITIALIZER!>42<!>
<!UNSUPPORTED_FEATURE!>platform<!> class Baz1
<!UNSUPPORTED_FEATURE!>header<!> fun foo1()
<!UNSUPPORTED_FEATURE!>header<!> val bar1 = <!HEADER_PROPERTY_INITIALIZER!>42<!>
<!UNSUPPORTED_FEATURE!>header<!> class Baz1
<!UNSUPPORTED_FEATURE!>impl<!> fun foo2() = 42
<!MUST_BE_INITIALIZED!><!UNSUPPORTED_FEATURE!>impl<!> val bar2: Int<!>
@@ -1,3 +1,3 @@
platform class Foo {
header class Foo {
constructor(s: String)
}
@@ -5,7 +5,7 @@ Output:
-- JVM --
Exit code: COMPILATION_ERROR
Output:
compiler/testData/multiplatform/classScopes/constructorIncorrectSignature/common.kt:1:16: error: no definition is found for platform declaration 'Foo'
compiler/testData/multiplatform/classScopes/constructorIncorrectSignature/common.kt:1:14: error: no implementation is found for header declaration 'Foo'
The following declaration is incompatible because some members are not implemented.
No implementations are found for members listed below:
@@ -14,8 +14,8 @@ No implementations are found for members listed below:
The following declaration is incompatible because parameter types are different:
public constructor Foo(s: Array<String>)
platform class Foo {
^
header class Foo {
^
compiler/testData/multiplatform/classScopes/constructorIncorrectSignature/jvm.kt:1:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code
impl class Foo {
^
@@ -1,7 +1,7 @@
platform open class Base {
header open class Base {
fun base()
}
platform class Derived : Base {
header class Derived : Base {
fun derived()
}
@@ -1,3 +1,3 @@
platform class Foo {
header class Foo {
fun function(b: ByteArray): Int
}
@@ -5,17 +5,17 @@ Output:
-- JVM --
Exit code: COMPILATION_ERROR
Output:
compiler/testData/multiplatform/classScopes/functionIncorrectSignature/common.kt:1:16: error: no definition is found for platform declaration 'Foo'
compiler/testData/multiplatform/classScopes/functionIncorrectSignature/common.kt:1:14: error: no implementation is found for header declaration 'Foo'
The following declaration is incompatible because some members are not implemented.
No implementations are found for members listed below:
public final platform fun function(b: ByteArray): Int
public final header fun function(b: ByteArray): Int
The following declaration is incompatible because return type is different:
public final impl fun function(b: ByteArray): Long
platform class Foo {
^
header class Foo {
^
compiler/testData/multiplatform/classScopes/functionIncorrectSignature/jvm.kt:1:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code
impl class Foo {
^
@@ -1,3 +1,3 @@
platform class Foo {
header class Foo {
constructor(s: String)
}
@@ -5,7 +5,7 @@ Output:
-- JVM --
Exit code: COMPILATION_ERROR
Output:
compiler/testData/multiplatform/classScopes/missingConstructor/common.kt:1:16: error: no definition is found for platform declaration 'Foo'
compiler/testData/multiplatform/classScopes/missingConstructor/common.kt:1:14: error: no implementation is found for header declaration 'Foo'
The following declaration is incompatible because some members are not implemented.
No implementations are found for members listed below:
@@ -14,8 +14,8 @@ No implementations are found for members listed below:
The following declaration is incompatible because number of value parameters is different:
public constructor Foo()
platform class Foo {
^
header class Foo {
^
compiler/testData/multiplatform/classScopes/missingConstructor/jvm.kt:1:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code
impl class Foo
^
@@ -1,3 +1,3 @@
platform class Foo {
header class Foo {
fun function(s: String)
}
@@ -5,14 +5,14 @@ Output:
-- JVM --
Exit code: COMPILATION_ERROR
Output:
compiler/testData/multiplatform/classScopes/missingFunction/common.kt:1:16: error: no definition is found for platform declaration 'Foo'
compiler/testData/multiplatform/classScopes/missingFunction/common.kt:1:14: error: no implementation is found for header declaration 'Foo'
The following declaration is incompatible because some members are not implemented.
No implementations are found for members listed below:
public final platform fun function(s: String): Unit
public final header fun function(s: String): Unit
platform class Foo {
^
header class Foo {
^
compiler/testData/multiplatform/classScopes/missingFunction/jvm.kt:1:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code
impl class Foo
^
@@ -1,4 +1,4 @@
platform class Foo(param: String) {
header class Foo(param: String) {
var property: Int
fun <T> function(p: List<T>): T
@@ -1,13 +1,13 @@
platform fun <T> f1(): T
header fun <T> f1(): T
platform fun <T> f2(t: T)
header fun <T> f2(t: T)
platform fun <K : Enum<K>, V : MutableList<out K>> f3(v: Map<V, Enum<in K>>, w: Comparable<*>)
header fun <K : Enum<K>, V : MutableList<out K>> f3(v: Map<V, Enum<in K>>, w: Comparable<*>)
platform fun <T: Comparable<T>> Array<out T>.sort(): Unit
header fun <T: Comparable<T>> Array<out T>.sort(): Unit
platform class C1<A>
platform class C2<B : C2<B>>
platform class C3<D, E : MutableList<in D>>
header class C1<A>
header class C2<B : C2<B>>
header class C3<D, E : MutableList<in D>>
platform abstract class AbstractList<F> : MutableList<F>
header abstract class AbstractList<F> : MutableList<F>
@@ -1,3 +1,3 @@
platform class C1<A> {
header class C1<A> {
fun foo(a: A): List<A>?
}
@@ -1,36 +1,36 @@
platform fun f1()
header fun f1()
platform fun f2(name: String)
header fun f2(name: String)
platform fun f3(name: String)
platform fun String.f3ext()
header fun f3(name: String)
header fun String.f3ext()
platform fun f4(name: String)
header fun f4(name: String)
platform fun String.f5()
header fun String.f5()
platform fun f6(p1: String, p2: Int)
header fun f6(p1: String, p2: Int)
platform fun <T> f7()
header fun <T> f7()
internal platform fun f8()
private platform fun f9()
public platform fun f10()
internal header fun f8()
private header fun f9()
public header fun f10()
platform fun <T : Number> f11()
platform fun <U : MutableList<String>> f12()
platform fun <A, B : Continuation<A>> f13()
header fun <T : Number> f11()
header fun <U : MutableList<String>> f12()
header fun <A, B : Continuation<A>> f13()
platform inline fun <X> f14()
platform inline fun <reified Y> f15()
header inline fun <X> f14()
header inline fun <reified Y> f15()
platform fun f16(s: String)
header fun f16(s: String)
platform fun f17(vararg s: String)
platform fun f18(s: Array<out String>)
platform inline fun f19(crossinline s: () -> Unit)
platform inline fun f20(s: () -> Unit)
platform inline fun f21(noinline s: () -> Unit)
platform inline fun f22(s: () -> Unit)
platform fun f23(coroutine c: Unit.() -> Continuation<Unit>)
platform fun f24(c: Unit.() -> Continuation<Unit>)
header fun f17(vararg s: String)
header fun f18(s: Array<out String>)
header inline fun f19(crossinline s: () -> Unit)
header inline fun f20(s: () -> Unit)
header inline fun f21(noinline s: () -> Unit)
header inline fun f22(s: () -> Unit)
header fun f23(coroutine c: Unit.() -> Continuation<Unit>)
header fun f24(c: Unit.() -> Continuation<Unit>)
@@ -5,137 +5,137 @@ Output:
-- JVM --
Exit code: COMPILATION_ERROR
Output:
compiler/testData/multiplatform/incompatibleCallables/common.kt:1:1: error: no definition is found for platform declaration 'f1'
compiler/testData/multiplatform/incompatibleCallables/common.kt:1:1: error: no implementation is found for header declaration 'f1'
The following declaration is incompatible because return type is different:
public impl fun f1(): String
platform fun f1()
header fun f1()
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:3:1: error: no definition is found for platform declaration 'f2'
compiler/testData/multiplatform/incompatibleCallables/common.kt:3:1: error: no implementation is found for header declaration 'f2'
The following declaration is incompatible because parameter names are different:
public impl fun f2(otherName: String): Unit
platform fun f2(name: String)
header fun f2(name: String)
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:5:1: error: no definition is found for platform declaration 'f3'
compiler/testData/multiplatform/incompatibleCallables/common.kt:5:1: error: no implementation is found for header declaration 'f3'
The following declaration is incompatible because parameter types are different:
public impl fun f3(name: Double): Unit
platform fun f3(name: String)
header fun f3(name: String)
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:6:1: error: no definition is found for platform declaration 'f3ext'
compiler/testData/multiplatform/incompatibleCallables/common.kt:6:1: error: no implementation is found for header declaration 'f3ext'
The following declaration is incompatible because parameter types are different:
public impl fun Double.f3ext(): Unit
platform fun String.f3ext()
header fun String.f3ext()
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:8:1: error: no definition is found for platform declaration 'f4'
compiler/testData/multiplatform/incompatibleCallables/common.kt:8:1: error: no implementation is found for header declaration 'f4'
The following declaration is incompatible because parameter shapes are different (extension vs non-extension):
public impl fun String.f4(): Unit
platform fun f4(name: String)
header fun f4(name: String)
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:10:1: error: no definition is found for platform declaration 'f5'
compiler/testData/multiplatform/incompatibleCallables/common.kt:10:1: error: no implementation is found for header declaration 'f5'
The following declaration is incompatible because parameter shapes are different (extension vs non-extension):
public impl fun f5(name: String): Unit
platform fun String.f5()
header fun String.f5()
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:12:1: error: no definition is found for platform declaration 'f6'
compiler/testData/multiplatform/incompatibleCallables/common.kt:12:1: error: no implementation is found for header declaration 'f6'
The following declaration is incompatible because number of value parameters is different:
public impl fun f6(p2: Int): Unit
platform fun f6(p1: String, p2: Int)
header fun f6(p1: String, p2: Int)
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:14:1: error: no definition is found for platform declaration 'f7'
compiler/testData/multiplatform/incompatibleCallables/common.kt:14:1: error: no implementation is found for header declaration 'f7'
The following declaration is incompatible because number of type parameters is different:
public impl fun <K, V> f7(): Unit
platform fun <T> f7()
header fun <T> f7()
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:16:1: error: no definition is found for platform declaration 'f8'
compiler/testData/multiplatform/incompatibleCallables/common.kt:16:1: error: no implementation is found for header declaration 'f8'
The following declaration is incompatible because visibility is different:
public impl fun f8(): Unit
internal platform fun f8()
internal header fun f8()
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:17:1: error: no definition is found for platform declaration 'f9'
compiler/testData/multiplatform/incompatibleCallables/common.kt:17:1: error: no implementation is found for header declaration 'f9'
The following declaration is incompatible because visibility is different:
internal impl fun f9(): Unit
private platform fun f9()
private header fun f9()
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:18:1: error: no definition is found for platform declaration 'f10'
compiler/testData/multiplatform/incompatibleCallables/common.kt:18:1: error: no implementation is found for header declaration 'f10'
The following declaration is incompatible because visibility is different:
private impl fun f10(): Unit
public platform fun f10()
public header fun f10()
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:24:1: error: no definition is found for platform declaration 'f14'
compiler/testData/multiplatform/incompatibleCallables/common.kt:24:1: error: no implementation is found for header declaration 'f14'
The following declaration is incompatible because some type parameter is reified in one declaration and non-reified in the other:
public inline impl fun <reified X> f14(): Unit
platform inline fun <X> f14()
header inline fun <X> f14()
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:25:1: error: no definition is found for platform declaration 'f15'
compiler/testData/multiplatform/incompatibleCallables/common.kt:25:1: error: no implementation is found for header declaration 'f15'
The following declaration is incompatible because some type parameter is reified in one declaration and non-reified in the other:
public inline impl fun <Y> f15(): Unit
platform inline fun <reified Y> f15()
header inline fun <reified Y> f15()
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:27:1: error: no definition is found for platform declaration 'f16'
compiler/testData/multiplatform/incompatibleCallables/common.kt:27:1: error: no implementation is found for header declaration 'f16'
The following declaration is incompatible because some parameters have default values:
public impl fun f16(s: String = ...): Unit
platform fun f16(s: String)
header fun f16(s: String)
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:29:1: error: no definition is found for platform declaration 'f17'
compiler/testData/multiplatform/incompatibleCallables/common.kt:29:1: error: no implementation is found for header declaration 'f17'
The following declaration is incompatible because parameter modifiers are different (vararg, coroutine, crossinline, noinline):
public impl fun f17(s: Array<out String>): Unit
platform fun f17(vararg s: String)
header fun f17(vararg s: String)
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:30:1: error: no definition is found for platform declaration 'f18'
compiler/testData/multiplatform/incompatibleCallables/common.kt:30:1: error: no implementation is found for header declaration 'f18'
The following declaration is incompatible because parameter modifiers are different (vararg, coroutine, crossinline, noinline):
public impl fun f18(vararg s: String): Unit
platform fun f18(s: Array<out String>)
header fun f18(s: Array<out String>)
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:31:1: error: no definition is found for platform declaration 'f19'
compiler/testData/multiplatform/incompatibleCallables/common.kt:31:1: error: no implementation is found for header declaration 'f19'
The following declaration is incompatible because parameter modifiers are different (vararg, coroutine, crossinline, noinline):
public inline impl fun f19(s: () -> Unit): Unit
platform inline fun f19(crossinline s: () -> Unit)
header inline fun f19(crossinline s: () -> Unit)
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:32:1: error: no definition is found for platform declaration 'f20'
compiler/testData/multiplatform/incompatibleCallables/common.kt:32:1: error: no implementation is found for header declaration 'f20'
The following declaration is incompatible because parameter modifiers are different (vararg, coroutine, crossinline, noinline):
public inline impl fun f20(crossinline s: () -> Unit): Unit
platform inline fun f20(s: () -> Unit)
header inline fun f20(s: () -> Unit)
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:33:1: error: no definition is found for platform declaration 'f21'
compiler/testData/multiplatform/incompatibleCallables/common.kt:33:1: error: no implementation is found for header declaration 'f21'
The following declaration is incompatible because parameter modifiers are different (vararg, coroutine, crossinline, noinline):
public inline impl fun f21(s: () -> Unit): Unit
platform inline fun f21(noinline s: () -> Unit)
header inline fun f21(noinline s: () -> Unit)
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:34:1: error: no definition is found for platform declaration 'f22'
compiler/testData/multiplatform/incompatibleCallables/common.kt:34:1: error: no implementation is found for header declaration 'f22'
The following declaration is incompatible because parameter modifiers are different (vararg, coroutine, crossinline, noinline):
public inline impl fun f22(noinline s: () -> Unit): Unit
platform inline fun f22(s: () -> Unit)
header inline fun f22(s: () -> Unit)
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:35:1: error: no definition is found for platform declaration 'f23'
compiler/testData/multiplatform/incompatibleCallables/common.kt:35:1: error: no implementation is found for header declaration 'f23'
The following declaration is incompatible because parameter modifiers are different (vararg, coroutine, crossinline, noinline):
public impl fun f23(c: Unit.() -> Continuation<Unit>): Unit
platform fun f23(coroutine c: Unit.() -> Continuation<Unit>)
header fun f23(coroutine c: Unit.() -> Continuation<Unit>)
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:36:1: error: no definition is found for platform declaration 'f24'
compiler/testData/multiplatform/incompatibleCallables/common.kt:36:1: error: no implementation is found for header declaration 'f24'
The following declaration is incompatible because parameter modifiers are different (vararg, coroutine, crossinline, noinline):
public impl fun f24(coroutine c: Unit.() -> Continuation<Unit>): Unit
platform fun f24(c: Unit.() -> Continuation<Unit>)
header fun f24(c: Unit.() -> Continuation<Unit>)
^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:1:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code
impl fun f1(): String = ""
+18 -18
View File
@@ -1,25 +1,25 @@
platform class PClass
platform interface PInterface
platform object PObject
platform enum class PEnumClass
platform annotation class PAnnotationClass
header class PClass
header interface PInterface
header object PObject
header enum class PEnumClass
header annotation class PAnnotationClass
internal platform object InternalObject
public platform object PublicObject
private platform object PrivateObject
internal header object InternalObject
public header object PublicObject
private header object PrivateObject
open platform class OpenClass
abstract platform class AbstractClass
final platform class FinalClass
open header class OpenClass
abstract header class AbstractClass
final header class FinalClass
// platform data class DataClass(val x: Int)
platform class NonDataClass(x: Int)
// header data class DataClass(val x: Int)
header class NonDataClass(x: Int)
platform class C1<A>
platform class C2<B>
platform class C3<D, E : D>
header class C1<A>
header class C2<B>
header class C3<D, E : D>
platform class C4<F>
header class C4<F>
platform abstract class ExtendsNumber : Number
header abstract class ExtendsNumber : Number
@@ -5,96 +5,96 @@ Output:
-- JVM --
Exit code: COMPILATION_ERROR
Output:
compiler/testData/multiplatform/incompatibleClasses/common.kt:1:16: error: no definition is found for platform declaration 'PClass'
compiler/testData/multiplatform/incompatibleClasses/common.kt:1:14: error: no implementation is found for header declaration 'PClass'
The following declaration is incompatible because class kinds are different (class, interface, object, enum, annotation):
public impl interface PClass
platform class PClass
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:2:20: error: no definition is found for platform declaration 'PInterface'
header class PClass
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:2:18: error: no implementation is found for header declaration 'PInterface'
The following declaration is incompatible because class kinds are different (class, interface, object, enum, annotation):
public impl object PInterface
platform interface PInterface
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:3:10: error: no definition is found for platform declaration 'PObject'
header interface PInterface
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:3:8: error: no implementation is found for header declaration 'PObject'
The following declaration is incompatible because class kinds are different (class, interface, object, enum, annotation):
public final impl enum class PObject : Enum<PObject>
platform object PObject
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:4:21: error: no definition is found for platform declaration 'PEnumClass'
header object PObject
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:4:19: error: no implementation is found for header declaration 'PEnumClass'
The following declaration is incompatible because class kinds are different (class, interface, object, enum, annotation):
public final impl annotation class PEnumClass : Annotation
platform enum class PEnumClass
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:5:27: error: no definition is found for platform declaration 'PAnnotationClass'
header enum class PEnumClass
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:5:25: error: no implementation is found for header declaration 'PAnnotationClass'
The following declaration is incompatible because class kinds are different (class, interface, object, enum, annotation):
public final impl class PAnnotationClass
platform annotation class PAnnotationClass
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:7:19: error: no definition is found for platform declaration 'InternalObject'
header annotation class PAnnotationClass
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:7:17: error: no implementation is found for header declaration 'InternalObject'
The following declaration is incompatible because visibility is different:
private impl object InternalObject
internal platform object InternalObject
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:8:17: error: no definition is found for platform declaration 'PublicObject'
internal header object InternalObject
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:8:15: error: no implementation is found for header declaration 'PublicObject'
The following declaration is incompatible because visibility is different:
internal impl object PublicObject
public platform object PublicObject
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:9:18: error: no definition is found for platform declaration 'PrivateObject'
public header object PublicObject
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:9:16: error: no implementation is found for header declaration 'PrivateObject'
The following declaration is incompatible because visibility is different:
public impl object PrivateObject
private platform object PrivateObject
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:11:21: error: no definition is found for platform declaration 'OpenClass'
private header object PrivateObject
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:11:19: error: no implementation is found for header declaration 'OpenClass'
The following declaration is incompatible because modality is different:
public final impl class OpenClass
open platform class OpenClass
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:12:25: error: no definition is found for platform declaration 'AbstractClass'
open header class OpenClass
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:12:23: error: no implementation is found for header declaration 'AbstractClass'
The following declaration is incompatible because modality is different:
public open impl class AbstractClass
abstract platform class AbstractClass
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:13:22: error: no definition is found for platform declaration 'FinalClass'
abstract header class AbstractClass
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:13:20: error: no implementation is found for header declaration 'FinalClass'
The following declaration is incompatible because modality is different:
public abstract impl class FinalClass
final platform class FinalClass
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:16:16: error: no definition is found for platform declaration 'NonDataClass'
final header class FinalClass
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:16:14: error: no implementation is found for header declaration 'NonDataClass'
The following declaration is incompatible because modifiers are different (data):
public final impl data class NonDataClass
platform class NonDataClass(x: Int)
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:18:16: error: no definition is found for platform declaration 'C1'
header class NonDataClass(x: Int)
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:18:14: error: no implementation is found for header declaration 'C1'
The following declaration is incompatible because number of type parameters is different:
public final impl class C1<A, Extra>
platform class C1<A>
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:19:16: error: no definition is found for platform declaration 'C2'
header class C1<A>
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:19:14: error: no implementation is found for header declaration 'C2'
The following declaration is incompatible because declaration-site variances of type parameters are different:
public final impl class C2<out B>
platform class C2<B>
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:25:25: error: no definition is found for platform declaration 'ExtendsNumber'
header class C2<B>
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:25:23: error: no implementation is found for header declaration 'ExtendsNumber'
The following declaration is incompatible because some supertypes are missing in the implementation:
public abstract impl class ExtendsNumber
platform abstract class ExtendsNumber : Number
^
header abstract class ExtendsNumber : Number
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:1:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code
impl interface PClass
^
@@ -1,14 +1,14 @@
platform infix fun Int.plus(s: CharSequence): Int
platform fun Int.minus(s: String): Int
header infix fun Int.plus(s: CharSequence): Int
header fun Int.minus(s: String): Int
platform operator fun Double.times(x: CharArray)
platform fun Double.divide(x: ByteArray)
header operator fun Double.times(x: CharArray)
header fun Double.divide(x: ByteArray)
platform external fun f1()
platform fun g1()
header external fun f1()
header fun g1()
platform inline fun f2()
platform fun g2()
header inline fun f2()
header fun g2()
platform tailrec fun f3()
platform fun g3()
header tailrec fun f3()
header fun g3()
@@ -5,65 +5,65 @@ Output:
-- JVM --
Exit code: COMPILATION_ERROR
Output:
compiler/testData/multiplatform/incompatibleFunctions/common.kt:1:1: error: no definition is found for platform declaration 'plus'
compiler/testData/multiplatform/incompatibleFunctions/common.kt:1:1: error: no implementation is found for header declaration 'plus'
The following declaration is incompatible because modifiers are different (external, infix, inline, operator, suspend, tailrec):
public impl fun Int.plus(s: CharSequence): Int
platform infix fun Int.plus(s: CharSequence): Int
header infix fun Int.plus(s: CharSequence): Int
^
compiler/testData/multiplatform/incompatibleFunctions/common.kt:2:1: error: no definition is found for platform declaration 'minus'
compiler/testData/multiplatform/incompatibleFunctions/common.kt:2:1: error: no implementation is found for header declaration 'minus'
The following declaration is incompatible because modifiers are different (external, infix, inline, operator, suspend, tailrec):
public infix impl fun Int.minus(s: String): Int
platform fun Int.minus(s: String): Int
header fun Int.minus(s: String): Int
^
compiler/testData/multiplatform/incompatibleFunctions/common.kt:4:1: error: no definition is found for platform declaration 'times'
compiler/testData/multiplatform/incompatibleFunctions/common.kt:4:1: error: no implementation is found for header declaration 'times'
The following declaration is incompatible because modifiers are different (external, infix, inline, operator, suspend, tailrec):
public impl fun Double.times(x: CharArray): Unit
platform operator fun Double.times(x: CharArray)
header operator fun Double.times(x: CharArray)
^
compiler/testData/multiplatform/incompatibleFunctions/common.kt:5:1: error: no definition is found for platform declaration 'divide'
compiler/testData/multiplatform/incompatibleFunctions/common.kt:5:1: error: no implementation is found for header declaration 'divide'
The following declaration is incompatible because modifiers are different (external, infix, inline, operator, suspend, tailrec):
public operator impl fun Double.divide(x: ByteArray): Unit
platform fun Double.divide(x: ByteArray)
header fun Double.divide(x: ByteArray)
^
compiler/testData/multiplatform/incompatibleFunctions/common.kt:7:1: error: no definition is found for platform declaration 'f1'
compiler/testData/multiplatform/incompatibleFunctions/common.kt:7:1: error: no implementation is found for header declaration 'f1'
The following declaration is incompatible because modifiers are different (external, infix, inline, operator, suspend, tailrec):
public impl fun f1(): Unit
platform external fun f1()
header external fun f1()
^
compiler/testData/multiplatform/incompatibleFunctions/common.kt:8:1: error: no definition is found for platform declaration 'g1'
compiler/testData/multiplatform/incompatibleFunctions/common.kt:8:1: error: no implementation is found for header declaration 'g1'
The following declaration is incompatible because modifiers are different (external, infix, inline, operator, suspend, tailrec):
public external impl fun g1(): Unit
platform fun g1()
header fun g1()
^
compiler/testData/multiplatform/incompatibleFunctions/common.kt:10:1: error: no definition is found for platform declaration 'f2'
compiler/testData/multiplatform/incompatibleFunctions/common.kt:10:1: error: no implementation is found for header declaration 'f2'
The following declaration is incompatible because modifiers are different (external, infix, inline, operator, suspend, tailrec):
public impl fun f2(): Unit
platform inline fun f2()
header inline fun f2()
^
compiler/testData/multiplatform/incompatibleFunctions/common.kt:11:1: error: no definition is found for platform declaration 'g2'
compiler/testData/multiplatform/incompatibleFunctions/common.kt:11:1: error: no implementation is found for header declaration 'g2'
The following declaration is incompatible because modifiers are different (external, infix, inline, operator, suspend, tailrec):
public inline impl fun g2(): Unit
platform fun g2()
header fun g2()
^
compiler/testData/multiplatform/incompatibleFunctions/common.kt:13:1: error: no definition is found for platform declaration 'f3'
compiler/testData/multiplatform/incompatibleFunctions/common.kt:13:1: error: no implementation is found for header declaration 'f3'
The following declaration is incompatible because modifiers are different (external, infix, inline, operator, suspend, tailrec):
public impl fun f3(): Unit
platform tailrec fun f3()
header tailrec fun f3()
^
compiler/testData/multiplatform/incompatibleFunctions/common.kt:14:1: error: no definition is found for platform declaration 'g3'
compiler/testData/multiplatform/incompatibleFunctions/common.kt:14:1: error: no implementation is found for header declaration 'g3'
The following declaration is incompatible because modifiers are different (external, infix, inline, operator, suspend, tailrec):
public tailrec impl fun g3(): Unit
platform fun g3()
header fun g3()
^
compiler/testData/multiplatform/incompatibleFunctions/jvm.kt:1:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code
impl fun Int.plus(s: CharSequence): Int = 0
@@ -1,2 +1,2 @@
platform val pval: String
platform var pvar: String
header val pval: String
header var pvar: String
@@ -5,17 +5,17 @@ Output:
-- JVM --
Exit code: COMPILATION_ERROR
Output:
compiler/testData/multiplatform/incompatibleProperties/common.kt:1:1: error: no definition is found for platform declaration 'pval'
compiler/testData/multiplatform/incompatibleProperties/common.kt:1:1: error: no implementation is found for header declaration 'pval'
The following declaration is incompatible because property kinds are different (val vs var):
public var pval: String
platform val pval: String
header val pval: String
^
compiler/testData/multiplatform/incompatibleProperties/common.kt:2:1: error: no definition is found for platform declaration 'pvar'
compiler/testData/multiplatform/incompatibleProperties/common.kt:2:1: error: no implementation is found for header declaration 'pvar'
The following declaration is incompatible because property kinds are different (val vs var):
public val pvar: String
platform var pvar: String
header var pvar: String
^
compiler/testData/multiplatform/incompatibleProperties/jvm.kt:1:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code
impl var pval: String = ""
@@ -1 +1 @@
platform class Foo
header class Foo
+1 -1
View File
@@ -1,4 +1,4 @@
platform class Printer {
header class Printer {
fun print(message: String)
}
@@ -417,7 +417,7 @@ public abstract class AbstractDiagnosticsTest extends BaseDiagnosticsTest {
List<ModuleDescriptorImpl> dependencies = moduleDescriptor.getTestOnly_AllDependentModules();
// TODO: diagnostics on common code reported during the platform module analysis should be distinguished somehow
// E.g. "<!JVM:PLATFORM_DEFINITION_WITHOUT_DECLARATION!>...<!>
// E.g. "<!JVM:IMPLEMENTATION_WITHOUT_HEADER!>...<!>
List<KtFile> result = new ArrayList<KtFile>(0);
for (ModuleDescriptorImpl dependency : dependencies) {
if (dependency.getCapability(MultiTargetPlatform.CAPABILITY) == MultiTargetPlatform.Common.INSTANCE) {
@@ -205,8 +205,8 @@ public class RecursiveDescriptorComparator {
}
}
// 'platform' declarations do not belong to the platform-specific module, even though they participate in the analysis
if (descriptor instanceof MemberDescriptor && ((MemberDescriptor) descriptor).isPlatform() &&
// 'header' declarations do not belong to the platform-specific module, even though they participate in the analysis
if (descriptor instanceof MemberDescriptor && ((MemberDescriptor) descriptor).isHeader() &&
module.getCapability(MultiTargetPlatform.CAPABILITY) != MultiTargetPlatform.Common.INSTANCE) return false;
return module.equals(DescriptorUtils.getContainingModule(descriptor));
@@ -46,7 +46,7 @@ public class JavaPropertyDescriptor extends PropertyDescriptorImpl implements Ja
boolean isStaticFinal
) {
super(containingDeclaration, original, annotations, modality, visibility, isVar, name, kind, source,
/* lateInit = */ false, /* isConst = */ false, /* isPlatform = */ false, /* isImpl = */ false, /* isExternal = */ false);
/* lateInit = */ false, /* isConst = */ false, /* isHeader = */ false, /* isImpl = */ false, /* isExternal = */ false);
this.isStaticFinal = isStaticFinal;
}
@@ -100,7 +100,7 @@ class LazyJavaClassDescriptor(
override fun isInner() = isInner
override fun isData() = false
override fun isCompanionObject() = false
override fun isPlatform() = false
override fun isHeader() = false
override fun isImpl() = false
private val typeConstructor = c.storageManager.createLazyValue { LazyJavaClassTypeConstructor() }

Some files were not shown because too many files have changed in this diff Show More