diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java index b5b2076e73e..afb08e2ee47 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java @@ -554,30 +554,31 @@ public interface Errors { // Multi-platform projects - DiagnosticFactory0 HEADER_DECLARATION_WITH_BODY = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE); - DiagnosticFactory0 HEADER_DECLARATION_WITH_DEFAULT_PARAMETER = DiagnosticFactory0.create(ERROR); - DiagnosticFactory0 HEADER_CLASS_CONSTRUCTOR_DELEGATION_CALL = DiagnosticFactory0.create(ERROR); - DiagnosticFactory0 HEADER_CLASS_CONSTRUCTOR_PROPERTY_PARAMETER = DiagnosticFactory0.create(ERROR); - DiagnosticFactory0> HEADER_ENUM_CONSTRUCTOR = DiagnosticFactory0.create(ERROR); - DiagnosticFactory0 HEADER_ENUM_ENTRY_WITH_BODY = DiagnosticFactory0.create(ERROR); - DiagnosticFactory0 HEADER_PROPERTY_INITIALIZER = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 EXPECTED_DECLARATION_WITH_BODY = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE); + DiagnosticFactory0 EXPECTED_DECLARATION_WITH_DEFAULT_PARAMETER = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 EXPECTED_CLASS_CONSTRUCTOR_DELEGATION_CALL = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 EXPECTED_CLASS_CONSTRUCTOR_PROPERTY_PARAMETER = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0> EXPECTED_ENUM_CONSTRUCTOR = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 EXPECTED_ENUM_ENTRY_WITH_BODY = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 EXPECTED_PROPERTY_INITIALIZER = DiagnosticFactory0.create(ERROR); - DiagnosticFactory0 IMPL_TYPE_ALIAS_NOT_TO_CLASS = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE); - DiagnosticFactory0 IMPL_TYPE_ALIAS_TO_CLASS_WITH_DECLARATION_SITE_VARIANCE = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE); - DiagnosticFactory0 IMPL_TYPE_ALIAS_WITH_USE_SITE_VARIANCE = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE); - DiagnosticFactory0 IMPL_TYPE_ALIAS_WITH_COMPLEX_SUBSTITUTION = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE); + DiagnosticFactory0 ACTUAL_TYPE_ALIAS_NOT_TO_CLASS = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE); + DiagnosticFactory0 + ACTUAL_TYPE_ALIAS_TO_CLASS_WITH_DECLARATION_SITE_VARIANCE = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE); + DiagnosticFactory0 ACTUAL_TYPE_ALIAS_WITH_USE_SITE_VARIANCE = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE); + DiagnosticFactory0 ACTUAL_TYPE_ALIAS_WITH_COMPLEX_SUBSTITUTION = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE); DiagnosticFactory3>> HEADER_WITHOUT_IMPLEMENTATION = + Map>> NO_ACTUAL_FOR_EXPECT = DiagnosticFactory3.create(ERROR, DECLARATION_SIGNATURE); DiagnosticFactory2>> IMPLEMENTATION_WITHOUT_HEADER = + Map>> ACTUAL_WITHOUT_EXPECT = DiagnosticFactory2.create(ERROR, DECLARATION_SIGNATURE); DiagnosticFactory2>>>> HEADER_CLASS_MEMBERS_ARE_NOT_IMPLEMENTED = + List>>>> NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS = DiagnosticFactory2.create(ERROR, DECLARATION_SIGNATURE); - DiagnosticFactory0 IMPL_MISSING = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE); + DiagnosticFactory0 ACTUAL_MISSING = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -603,7 +604,7 @@ public interface Errors { enum BadNamedArgumentsTarget { NON_KOTLIN_FUNCTION, INVOKE_ON_FUNCTION_TYPE, - HEADER_CLASS_MEMBER, + EXPECTED_CLASS_MEMBER, } DiagnosticFactory0 VARARG_OUTSIDE_PARENTHESES = DiagnosticFactory0.create(ERROR); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java index 1015305dac2..378e886d921 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java @@ -194,7 +194,7 @@ public class DefaultErrorMessages { return "non-Kotlin functions"; case INVOKE_ON_FUNCTION_TYPE: return "function types"; - case HEADER_CLASS_MEMBER: + case EXPECTED_CLASS_MEMBER: return "members of header classes"; default: throw new AssertionError(target); @@ -262,27 +262,27 @@ public class DefaultErrorMessages { MAP.put(MULTIPLE_VARARG_PARAMETERS, "Multiple vararg-parameters are prohibited"); MAP.put(FORBIDDEN_VARARG_PARAMETER_TYPE, "Forbidden vararg parameter type: {0}", RENDER_TYPE); - 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_ENUM_CONSTRUCTOR, "Header enum class cannot have a constructor"); - MAP.put(HEADER_ENUM_ENTRY_WITH_BODY, "Header enum entry cannot have a body"); - MAP.put(HEADER_PROPERTY_INITIALIZER, "Header property cannot have an initializer"); + MAP.put(EXPECTED_DECLARATION_WITH_BODY, "Header declaration must not have a body"); + MAP.put(EXPECTED_DECLARATION_WITH_DEFAULT_PARAMETER, "Header declaration cannot have parameters with default values"); + MAP.put(EXPECTED_CLASS_CONSTRUCTOR_DELEGATION_CALL, "Explicit delegation call for constructor of a header class is not allowed"); + MAP.put(EXPECTED_CLASS_CONSTRUCTOR_PROPERTY_PARAMETER, "Header class constructor cannot have a property parameter"); + MAP.put(EXPECTED_ENUM_CONSTRUCTOR, "Header enum class cannot have a constructor"); + MAP.put(EXPECTED_ENUM_ENTRY_WITH_BODY, "Header enum entry cannot have a body"); + MAP.put(EXPECTED_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 = Bar'"); + MAP.put(ACTUAL_TYPE_ALIAS_NOT_TO_CLASS, "Right-hand side of 'impl' type alias should be a class, not another type alias"); + MAP.put(ACTUAL_TYPE_ALIAS_TO_CLASS_WITH_DECLARATION_SITE_VARIANCE, "Aliased class should not have type parameters with declaration-site variance"); + MAP.put(ACTUAL_TYPE_ALIAS_WITH_USE_SITE_VARIANCE, "Right-hand side of 'impl' type alias cannot contain use-site variance or star projections"); + MAP.put(ACTUAL_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 = Bar'"); - MAP.put(HEADER_WITHOUT_IMPLEMENTATION, "''header'' {0} has no implementation in module{1}{2}", DECLARATION_NAME_WITH_KIND, + MAP.put(NO_ACTUAL_FOR_EXPECT, "''header'' {0} has no implementation in module{1}{2}", DECLARATION_NAME_WITH_KIND, PLATFORM, PlatformIncompatibilityDiagnosticRenderer.TEXT); - MAP.put(IMPLEMENTATION_WITHOUT_HEADER, "''impl'' {0} has no corresponding ''header'' declaration{1}", DECLARATION_NAME_WITH_KIND, + MAP.put(ACTUAL_WITHOUT_EXPECT, "''impl'' {0} has no corresponding ''header'' declaration{1}", DECLARATION_NAME_WITH_KIND, PlatformIncompatibilityDiagnosticRenderer.TEXT); - MAP.put(HEADER_CLASS_MEMBERS_ARE_NOT_IMPLEMENTED, "''impl'' class ''{0}'' has no implementation of ''header'' class members:{1}", + MAP.put(NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS, "''impl'' class ''{0}'' has no implementation of ''header'' class members:{1}", NAME, IncompatibleHeaderImplClassScopesRenderer.TEXT); - MAP.put(IMPL_MISSING, "Declaration should be marked with 'impl' (suppress with -Xno-check-impl)"); + MAP.put(ACTUAL_MISSING, "Declaration should be marked with 'impl' (suppress with -Xno-check-impl)"); 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"); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/BodyResolver.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/BodyResolver.java index 604109a6eaf..5bd9ec9fdd9 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/BodyResolver.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/BodyResolver.java @@ -618,7 +618,7 @@ public class BodyResolver { trace.report(ANONYMOUS_INITIALIZER_IN_INTERFACE.on(anonymousInitializer)); } if (classDescriptor.isExpect()) { - trace.report(HEADER_DECLARATION_WITH_BODY.on(anonymousInitializer)); + trace.report(EXPECTED_DECLARATION_WITH_BODY.on(anonymousInitializer)); } } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationsChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationsChecker.kt index a8a79d3ce0f..7b32b2ee0eb 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationsChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DeclarationsChecker.kt @@ -175,23 +175,23 @@ class DeclarationsChecker( val rhs = typeAliasDescriptor.underlyingType val classDescriptor = rhs.constructor.declarationDescriptor if (classDescriptor !is ClassDescriptor) { - trace.report(IMPL_TYPE_ALIAS_NOT_TO_CLASS.on(declaration)) + trace.report(ACTUAL_TYPE_ALIAS_NOT_TO_CLASS.on(declaration)) return } if (classDescriptor.declaredTypeParameters.any { it.variance != Variance.INVARIANT }) { - trace.report(IMPL_TYPE_ALIAS_TO_CLASS_WITH_DECLARATION_SITE_VARIANCE.on(declaration)) + trace.report(ACTUAL_TYPE_ALIAS_TO_CLASS_WITH_DECLARATION_SITE_VARIANCE.on(declaration)) return } if (rhs.arguments.any { it.projectionKind != Variance.INVARIANT || it.isStarProjection }) { - trace.report(IMPL_TYPE_ALIAS_WITH_USE_SITE_VARIANCE.on(declaration)) + trace.report(ACTUAL_TYPE_ALIAS_WITH_USE_SITE_VARIANCE.on(declaration)) return } if (rhs.arguments.map { it.type.constructor.declarationDescriptor as? TypeParameterDescriptor } != typeAliasDescriptor.declaredTypeParameters) { - trace.report(IMPL_TYPE_ALIAS_WITH_COMPLEX_SUBSTITUTION.on(declaration)) + trace.report(ACTUAL_TYPE_ALIAS_WITH_COMPLEX_SUBSTITUTION.on(declaration)) return } } @@ -253,17 +253,17 @@ class DeclarationsChecker( if (!constructorDescriptor.isExpect) return if (declaration.hasBody()) { - trace.report(HEADER_DECLARATION_WITH_BODY.on(declaration)) + trace.report(EXPECTED_DECLARATION_WITH_BODY.on(declaration)) } if (constructorDescriptor.containingDeclaration.kind == ClassKind.ENUM_CLASS) { - trace.report(HEADER_ENUM_CONSTRUCTOR.on(declaration)) + trace.report(EXPECTED_ENUM_CONSTRUCTOR.on(declaration)) } if (declaration is KtPrimaryConstructor && !DescriptorUtils.isAnnotationClass(constructorDescriptor.constructedClass)) { for (parameter in declaration.valueParameters) { if (parameter.hasValOrVar()) { - trace.report(HEADER_CLASS_CONSTRUCTOR_PROPERTY_PARAMETER.on(parameter)) + trace.report(EXPECTED_CLASS_CONSTRUCTOR_PROPERTY_PARAMETER.on(parameter)) } } } @@ -271,7 +271,7 @@ class DeclarationsChecker( if (declaration is KtSecondaryConstructor) { val delegationCall = declaration.getDelegationCall() if (!delegationCall.isImplicit) { - trace.report(HEADER_CLASS_CONSTRUCTOR_DELEGATION_CALL.on(delegationCall)) + trace.report(EXPECTED_CLASS_CONSTRUCTOR_DELEGATION_CALL.on(delegationCall)) } } } @@ -637,7 +637,7 @@ class DeclarationsChecker( if (initializer != null) { when { inInterface -> trace.report(PROPERTY_INITIALIZER_IN_INTERFACE.on(initializer)) - isExpect -> trace.report(HEADER_PROPERTY_INITIALIZER.on(initializer)) + isExpect -> trace.report(EXPECTED_PROPERTY_INITIALIZER.on(initializer)) !backingFieldRequired -> trace.report(PROPERTY_INITIALIZER_NO_BACKING_FIELD.on(initializer)) property.receiverTypeReference != null -> trace.report(EXTENSION_PROPERTY_WITH_BACKING_FIELD.on(initializer)) } @@ -731,12 +731,12 @@ class DeclarationsChecker( private fun checkHeaderFunction(function: KtNamedFunction) { if (function.hasBody()) { - trace.report(HEADER_DECLARATION_WITH_BODY.on(function)) + trace.report(EXPECTED_DECLARATION_WITH_BODY.on(function)) } for (parameter in function.valueParameters) { if (parameter.hasDefaultValue()) { - trace.report(HEADER_DECLARATION_WITH_DEFAULT_PARAMETER.on(parameter)) + trace.report(EXPECTED_DECLARATION_WITH_DEFAULT_PARAMETER.on(parameter)) } } } @@ -790,7 +790,7 @@ class DeclarationsChecker( ) { if (accessor == null || accessorDescriptor == null) return if (propertyDescriptor.isExpect && accessor.hasBody()) { - trace.report(HEADER_DECLARATION_WITH_BODY.on(accessor)) + trace.report(EXPECTED_DECLARATION_WITH_BODY.on(accessor)) } val accessorModifierList = accessor.modifierList ?: return @@ -831,7 +831,7 @@ class DeclarationsChecker( if (DescriptorUtils.isEnumClass(enumClass)) { if (enumClass.isExpect) { if (enumEntry.getBody() != null) { - trace.report(HEADER_ENUM_ENTRY_WITH_BODY.on(enumEntry)) + trace.report(EXPECTED_ENUM_ENTRY_WITH_BODY.on(enumEntry)) } } } diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/ValueArgumentsToParametersMapper.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/ValueArgumentsToParametersMapper.java index 40a39900401..2338eef9dd6 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/ValueArgumentsToParametersMapper.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/ValueArgumentsToParametersMapper.java @@ -187,7 +187,7 @@ public class ValueArgumentsToParametersMapper { candidate.getContainingDeclaration() instanceof ClassDescriptor) { // We do not allow named arguments for members of header classes until we're able to use both // headers and platform definitions when compiling platform code - report(NAMED_ARGUMENTS_NOT_ALLOWED.on(nameReference, HEADER_CLASS_MEMBER)); + report(NAMED_ARGUMENTS_NOT_ALLOWED.on(nameReference, EXPECTED_CLASS_MEMBER)); } else if (!candidate.hasStableParameterNames()) { report(NAMED_ARGUMENTS_NOT_ALLOWED.on( diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/ExpectedActualDeclarationChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/ExpectedActualDeclarationChecker.kt index 1d2fbae94ca..ba50271b8ac 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/ExpectedActualDeclarationChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/ExpectedActualDeclarationChecker.kt @@ -92,7 +92,7 @@ object ExpectedActualDeclarationChecker : DeclarationChecker { assert(compatibility.keys.all { it is Incompatible }) @Suppress("UNCHECKED_CAST") val incompatibility = compatibility as Map> - diagnosticHolder.report(Errors.HEADER_WITHOUT_IMPLEMENTATION.on(reportOn, descriptor, platformModule, incompatibility)) + diagnosticHolder.report(Errors.NO_ACTUAL_FOR_EXPECT.on(reportOn, descriptor, platformModule, incompatibility)) } } @@ -132,7 +132,7 @@ object ExpectedActualDeclarationChecker : DeclarationChecker { if (Compatible !in compatibility) return if (checkExpected) { - diagnosticHolder.report(Errors.IMPL_MISSING.on(reportOn)) + diagnosticHolder.report(Errors.ACTUAL_MISSING.on(reportOn)) } } @@ -164,7 +164,7 @@ object ExpectedActualDeclarationChecker : DeclarationChecker { val classDescriptor = (descriptor as? TypeAliasDescriptor)?.expandedType?.constructor?.declarationDescriptor as? ClassDescriptor ?: (descriptor as ClassDescriptor) - diagnosticHolder.report(Errors.HEADER_CLASS_MEMBERS_ARE_NOT_IMPLEMENTED.on( + diagnosticHolder.report(Errors.NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS.on( reportOn, classDescriptor, nonTrivialUnimplemented )) } @@ -173,7 +173,7 @@ object ExpectedActualDeclarationChecker : DeclarationChecker { assert(compatibility.keys.all { it is Incompatible }) @Suppress("UNCHECKED_CAST") val incompatibility = compatibility as Map> - diagnosticHolder.report(Errors.IMPLEMENTATION_WITHOUT_HEADER.on(reportOn, descriptor, incompatibility)) + diagnosticHolder.report(Errors.ACTUAL_WITHOUT_EXPECT.on(reportOn, descriptor, incompatibility)) } } diff --git a/compiler/testData/diagnostics/tests/multiplatform/enum/constructorInHeaderEnum.kt b/compiler/testData/diagnostics/tests/multiplatform/enum/constructorInHeaderEnum.kt index a96f43e9f21..174d3d7af62 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/enum/constructorInHeaderEnum.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/enum/constructorInHeaderEnum.kt @@ -2,12 +2,12 @@ // MODULE: m1-common // FILE: common.kt -expect enum class En(x: Int) { +expect enum class En(x: Int) { E1, E2(42), ; - constructor(s: String) + constructor(s: String) } expect enum class En2 { diff --git a/compiler/testData/diagnostics/tests/multiplatform/enum/enumEntryWithBody.kt b/compiler/testData/diagnostics/tests/multiplatform/enum/enumEntryWithBody.kt index cf66d5cb060..5f06869f912 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/enum/enumEntryWithBody.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/enum/enumEntryWithBody.kt @@ -4,8 +4,8 @@ expect enum class En { E1, - E2 { - fun foo() = "" + E2 { + fun foo() = "" }, - E3 { }; + E3 { }; } diff --git a/compiler/testData/diagnostics/tests/multiplatform/headerClass/explicitConstructorDelegation.kt b/compiler/testData/diagnostics/tests/multiplatform/headerClass/explicitConstructorDelegation.kt index 72084e76069..0eac8ee13a3 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/headerClass/explicitConstructorDelegation.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/headerClass/explicitConstructorDelegation.kt @@ -4,11 +4,11 @@ expect open class A { constructor(s: String) - constructor(n: Number) : this("A") + constructor(n: Number) : this("A") } expect class B : A { constructor(i: Int) - constructor() : super("B") + constructor() : super("B") } diff --git a/compiler/testData/diagnostics/tests/multiplatform/headerClass/genericClassImplTypeAlias.kt b/compiler/testData/diagnostics/tests/multiplatform/headerClass/genericClassImplTypeAlias.kt index 388199fecc2..a05e9452615 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/headerClass/genericClassImplTypeAlias.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/headerClass/genericClassImplTypeAlias.kt @@ -1,4 +1,4 @@ -// !DIAGNOSTICS: -IMPLEMENTATION_WITHOUT_HEADER +// !DIAGNOSTICS: -ACTUAL_WITHOUT_EXPECT // !LANGUAGE: +MultiPlatformProjects // MODULE: m1-common // FILE: common.kt @@ -18,14 +18,14 @@ expect interface C10 // FILE: jvm.kt actual typealias C1 = String -actual typealias C2<A> = List -actual typealias C3 = List +actual typealias C2<A> = List +actual typealias C3 = List actual typealias C4 = MutableMap -actual typealias C5 = MutableMap +actual typealias C5 = MutableMap actual typealias C6 = MutableList -actual typealias C7 = MutableList -actual typealias C8<J> = MutableList<*> -actual typealias C9 = MutableList +actual typealias C7 = MutableList +actual typealias C8<J> = MutableList<*> +actual typealias C9 = MutableList typealias Tmp = MutableList -actual typealias C10 = Tmp +actual typealias C10 = Tmp diff --git a/compiler/testData/diagnostics/tests/multiplatform/headerClass/headerClassWithFunctionBody.kt b/compiler/testData/diagnostics/tests/multiplatform/headerClass/headerClassWithFunctionBody.kt index a44cf419e53..95c5c8f89c3 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/headerClass/headerClassWithFunctionBody.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/headerClass/headerClassWithFunctionBody.kt @@ -2,28 +2,28 @@ // MODULE: m1-common // FILE: common.kt expect class Foo( - val constructorProperty: String, + val constructorProperty: String, constructorParameter: String ) { - init { + init { "no" } - constructor(s: String) { + constructor(s: String) { "no" } - constructor() : this("no") + constructor() : this("no") - val prop: String = "no" + val prop: String = "no" var getSet: String - get() = "no" - set(value) {} + get() = "no" + set(value) {} - fun defaultArg(value: String = "no") + fun defaultArg(value: String = "no") - fun functionWithBody(x: Int): Int { + fun functionWithBody(x: Int): Int { return x + 1 } } diff --git a/compiler/testData/diagnostics/tests/multiplatform/headerClass/nestedClassesWithErrors.kt b/compiler/testData/diagnostics/tests/multiplatform/headerClass/nestedClassesWithErrors.kt index ca45328adf7..275ddef2043 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/headerClass/nestedClassesWithErrors.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/headerClass/nestedClassesWithErrors.kt @@ -4,7 +4,7 @@ expect class B { class N { - fun body() {} + fun body() {} expect fun extraHeader() } } @@ -39,8 +39,8 @@ actual class C { actual inner class I } -actual class D +actual class D actual class E { - class N + class N } diff --git a/compiler/testData/diagnostics/tests/multiplatform/headerClass/noImplKeywordOnMember.kt b/compiler/testData/diagnostics/tests/multiplatform/headerClass/noImplKeywordOnMember.kt index 8dacd9ea6c1..0ebfd66c455 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/headerClass/noImplKeywordOnMember.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/headerClass/noImplKeywordOnMember.kt @@ -10,5 +10,5 @@ expect class Foo { // FILE: jvm.kt actual class Foo { - fun bar(): String = "bar" + fun bar(): String = "bar" } diff --git a/compiler/testData/diagnostics/tests/multiplatform/modifierApplicability.kt b/compiler/testData/diagnostics/tests/multiplatform/modifierApplicability.kt index 711d514652b..bc455140291 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/modifierApplicability.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/modifierApplicability.kt @@ -23,7 +23,7 @@ fun foo() { // FILE: jvm.kt class Outer actual constructor() { - actual class Nested + actual class Nested actual init {} } @@ -31,5 +31,5 @@ class Outer actual constructor() { fun foo() { actual fun localFun() {} actual var x = 42 - actual class Bar + actual class Bar } diff --git a/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/defaultArguments.kt b/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/defaultArguments.kt index a3508f4bc60..b38d03f9260 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/defaultArguments.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/defaultArguments.kt @@ -2,4 +2,4 @@ // MODULE: m1-common // FILE: common.kt -expect fun foo(x: Int, y: String = "") +expect fun foo(x: Int, y: String = "") diff --git a/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/headerAndImplInDIfferentPackages.kt b/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/headerAndImplInDIfferentPackages.kt index a5c8e8dfc90..8da74c11509 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/headerAndImplInDIfferentPackages.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/headerAndImplInDIfferentPackages.kt @@ -3,16 +3,16 @@ // FILE: common.kt package common -expect fun foo() +expect fun foo() // MODULE: m2-jvm(m1-common) // FILE: jvm.kt package jvm -actual fun foo() {} +actual fun foo() {} // MODULE: m3-js(m1-common) // FILE: js.kt package js -actual fun foo() {} +actual fun foo() {} diff --git a/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/headerDeclarationWithBody.kt b/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/headerDeclarationWithBody.kt index fbe117aeea4..6751e0bd017 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/headerDeclarationWithBody.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/headerDeclarationWithBody.kt @@ -4,6 +4,6 @@ expect fun foo() -expect fun foo() {} +expect fun foo() {} -expect fun bar() {} +expect fun bar() {} diff --git a/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/implDeclarationWithoutBody.kt b/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/implDeclarationWithoutBody.kt index bd79c4f5e43..733a4e3c610 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/implDeclarationWithoutBody.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/implDeclarationWithoutBody.kt @@ -9,4 +9,4 @@ expect fun foo() actual fun foo() -actual fun bar() +actual fun bar() diff --git a/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/implWithoutHeader.kt b/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/implWithoutHeader.kt index dff28271296..81bb3b58a22 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/implWithoutHeader.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/implWithoutHeader.kt @@ -2,4 +2,4 @@ // MODULE: m1-jvm // FILE: jvm.kt -actual fun foo() { } +actual fun foo() { } diff --git a/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/inlineFun.kt b/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/inlineFun.kt index 67e26b4c696..19b51ece5da 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/inlineFun.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/inlineFun.kt @@ -8,7 +8,7 @@ expect fun nonInlineFun() // MODULE: m2-jvm(m1-common) // FILE: jvm.kt -actual fun inlineFun() { } +actual fun inlineFun() { } actual fun nonInlineFun() { } // MODULE: m3-js(m1-common) diff --git a/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/valueParameterModifiers.kt b/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/valueParameterModifiers.kt index d615126d400..927c8c6b620 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/valueParameterModifiers.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/topLevelFun/valueParameterModifiers.kt @@ -18,10 +18,10 @@ expect fun f8(vararg x: Any) // FILE: jvm.kt actual inline fun f1(noinline s: () -> String) {} -actual inline fun f2(noinline s: () -> String) {} +actual inline fun f2(noinline s: () -> String) {} actual inline fun f3(s: () -> String) {} actual inline fun f4(crossinline s: () -> String) {} -actual inline fun f5(crossinline s: () -> String) {} +actual inline fun f5(crossinline s: () -> String) {} actual inline fun f6(s: () -> String) {} -actual fun f7(vararg x: Any) {} -actual fun f8(x: Any) {} +actual fun f7(vararg x: Any) {} +actual fun f8(x: Any) {} diff --git a/compiler/testData/diagnostics/tests/multiplatform/topLevelProperty/differentKindsOfProperties.kt b/compiler/testData/diagnostics/tests/multiplatform/topLevelProperty/differentKindsOfProperties.kt index be107a001cf..2183b91383f 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/topLevelProperty/differentKindsOfProperties.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/topLevelProperty/differentKindsOfProperties.kt @@ -17,14 +17,14 @@ expect var varWithPlatformGetSet: String expect get expect set -expect val backingFieldVal: String = "no" -expect var backingFieldVar: String = "no" +expect val backingFieldVal: String = "no" +expect var backingFieldVar: String = "no" expect val customAccessorVal: String - get() = "no" + get() = "no" expect var customAccessorVar: String - get() = "no" - set(value) {} + get() = "no" + set(value) {} expect const val constVal: Int diff --git a/compiler/testData/diagnostics/tests/sourceCompatibility/noMultiplatformProjects.kt b/compiler/testData/diagnostics/tests/sourceCompatibility/noMultiplatformProjects.kt index cf0dd55cd50..e9cfa4b3549 100644 --- a/compiler/testData/diagnostics/tests/sourceCompatibility/noMultiplatformProjects.kt +++ b/compiler/testData/diagnostics/tests/sourceCompatibility/noMultiplatformProjects.kt @@ -1,5 +1,5 @@ expect fun foo1() -expect val bar1 = 42 +expect val bar1 = 42 expect class Baz1 actual fun foo2() = 42 diff --git a/compiler/tests-common/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTest.kt b/compiler/tests-common/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTest.kt index d40212b5d77..7b7f0f18360 100644 --- a/compiler/tests-common/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTest.kt +++ b/compiler/tests-common/org/jetbrains/kotlin/checkers/AbstractDiagnosticsTest.kt @@ -344,7 +344,7 @@ abstract class AbstractDiagnosticsTest : BaseDiagnosticsTest() { val dependencies = moduleDescriptor.testOnly_AllDependentModules // TODO: diagnostics on common code reported during the platform module analysis should be distinguished somehow - // E.g. "... + // E.g. "... val result = ArrayList(0) for (dependency in dependencies) { if (dependency.getCapability(MultiTargetPlatform.CAPABILITY) == MultiTargetPlatform.Common) { diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/IdeErrorMessages.java b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/IdeErrorMessages.java index fd97612b14a..ff254dc0543 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/IdeErrorMessages.java +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/highlighter/IdeErrorMessages.java @@ -175,12 +175,12 @@ public class IdeErrorMessages { MAP.put(EXPERIMENTAL_FEATURE_WARNING, "{0}", new LanguageFeatureMessageRenderer(LanguageFeatureMessageRenderer.Type.WARNING, true)); MAP.put(EXPERIMENTAL_FEATURE_ERROR, "{0}", new LanguageFeatureMessageRenderer(LanguageFeatureMessageRenderer.Type.ERROR, true)); - MAP.put(HEADER_WITHOUT_IMPLEMENTATION, "''header'' {0} has no implementation in module{1}{2}", DECLARATION_NAME_WITH_KIND, + MAP.put(NO_ACTUAL_FOR_EXPECT, "''header'' {0} has no implementation in module{1}{2}", DECLARATION_NAME_WITH_KIND, PLATFORM, new PlatformIncompatibilityDiagnosticRenderer(IdeMultiplatformDiagnosticRenderingMode.INSTANCE)); - MAP.put(IMPLEMENTATION_WITHOUT_HEADER, "''impl'' {0} has no corresponding ''header'' declaration{1}", DECLARATION_NAME_WITH_KIND, + MAP.put(ACTUAL_WITHOUT_EXPECT, "''impl'' {0} has no corresponding ''header'' declaration{1}", DECLARATION_NAME_WITH_KIND, new PlatformIncompatibilityDiagnosticRenderer(IdeMultiplatformDiagnosticRenderingMode.INSTANCE)); - MAP.put(HEADER_CLASS_MEMBERS_ARE_NOT_IMPLEMENTED, "''impl'' class ''{0}'' has no implementation of ''header'' class members:{1}", + MAP.put(NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS, "''impl'' class ''{0}'' has no implementation of ''header'' class members:{1}", NAME, new IncompatibleHeaderImplClassScopesRenderer(IdeMultiplatformDiagnosticRenderingMode.INSTANCE)); MAP.setImmutable(); diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt index fbd799b2af0..05471726eae 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/QuickFixRegistrar.kt @@ -477,8 +477,8 @@ class QuickFixRegistrar : QuickFixContributor { OVERLOADS_LOCAL.registerFactory(RemoveAnnotationFix.JvmOverloads) OVERLOADS_WITHOUT_DEFAULT_ARGUMENTS.registerFactory(RemoveAnnotationFix.JvmOverloads) - HEADER_WITHOUT_IMPLEMENTATION.registerFactory(CreateActualFix) - IMPL_MISSING.registerFactory(AddModifierFix.createFactory(KtTokens.ACTUAL_KEYWORD)) + NO_ACTUAL_FOR_EXPECT.registerFactory(CreateActualFix) + ACTUAL_MISSING.registerFactory(AddModifierFix.createFactory(KtTokens.ACTUAL_KEYWORD)) CAST_NEVER_SUCCEEDS.registerFactory(ReplacePrimitiveCastWithNumberConversionFix) diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/createImpl/CreateActualFix.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/createImpl/CreateActualFix.kt index f85bae6afc8..e3ec90f7a97 100644 --- a/idea/src/org/jetbrains/kotlin/idea/quickfix/createImpl/CreateActualFix.kt +++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/createImpl/CreateActualFix.kt @@ -134,7 +134,7 @@ sealed class CreateActualFix( companion object : KotlinSingleIntentionActionFactory() { override fun createAction(diagnostic: Diagnostic): IntentionAction? { - val d = DiagnosticFactory.cast(diagnostic, Errors.HEADER_WITHOUT_IMPLEMENTATION) + val d = DiagnosticFactory.cast(diagnostic, Errors.NO_ACTUAL_FOR_EXPECT) val declaration = d.psiElement as? KtNamedDeclaration ?: return null val compatibility = d.c if (compatibility.isNotEmpty()) return null diff --git a/idea/testData/multiModuleHighlighting/multiplatform/basic/common/common.kt b/idea/testData/multiModuleHighlighting/multiplatform/basic/common/common.kt index bb08bd6c2c4..ea52485306c 100644 --- a/idea/testData/multiModuleHighlighting/multiplatform/basic/common/common.kt +++ b/idea/testData/multiModuleHighlighting/multiplatform/basic/common/common.kt @@ -1,3 +1,3 @@ -expect class My { +expect class My { } diff --git a/idea/testData/multiModuleHighlighting/multiplatform/basic/jvm/jvm.kt b/idea/testData/multiModuleHighlighting/multiplatform/basic/jvm/jvm.kt index a11a7b7cda4..c179ff49c2f 100644 --- a/idea/testData/multiModuleHighlighting/multiplatform/basic/jvm/jvm.kt +++ b/idea/testData/multiModuleHighlighting/multiplatform/basic/jvm/jvm.kt @@ -1,8 +1,8 @@ -actual class Your { +actual class Your { } -expect class His { +expect class His { } diff --git a/idea/testData/multiModuleHighlighting/multiplatform/headerWithoutImplForBoth/common/common.kt b/idea/testData/multiModuleHighlighting/multiplatform/headerWithoutImplForBoth/common/common.kt index fd24b7b6c0d..c2e87902564 100644 --- a/idea/testData/multiModuleHighlighting/multiplatform/headerWithoutImplForBoth/common/common.kt +++ b/idea/testData/multiModuleHighlighting/multiplatform/headerWithoutImplForBoth/common/common.kt @@ -1,3 +1,3 @@ -expect class My { +expect class My { } diff --git a/idea/testData/multiModuleHighlighting/multiplatform/suppressHeaderWithoutImpl/common/common.kt b/idea/testData/multiModuleHighlighting/multiplatform/suppressHeaderWithoutImpl/common/common.kt index 5a5231ba567..0da57ae1110 100644 --- a/idea/testData/multiModuleHighlighting/multiplatform/suppressHeaderWithoutImpl/common/common.kt +++ b/idea/testData/multiModuleHighlighting/multiplatform/suppressHeaderWithoutImpl/common/common.kt @@ -1,7 +1,7 @@ // See KT-15601 -@Suppress("HEADER_WITHOUT_IMPLEMENTATION") +@Suppress("NO_ACTUAL_FOR_EXPECT") expect interface Event @Suppress("SOMETHING_WRONG") -expect class Wrong +expect class Wrong diff --git a/libraries/kotlin.test/common/src/main/kotlin/org/junit/Test.kt b/libraries/kotlin.test/common/src/main/kotlin/org/junit/Test.kt index c50c989809c..31460f5c959 100644 --- a/libraries/kotlin.test/common/src/main/kotlin/org/junit/Test.kt +++ b/libraries/kotlin.test/common/src/main/kotlin/org/junit/Test.kt @@ -1,4 +1,4 @@ package org.junit -@Suppress("HEADER_WITHOUT_IMPLEMENTATION") +@Suppress("NO_ACTUAL_FOR_EXPECT") header annotation class Test