Improve header/impl mismatch diagnostic messages

Try to report most mismatch errors on the 'impl' declaration. Only
report a mismatch error on the 'header' declaration if no error would be
otherwise reported on any 'impl' declaration in the compilation unit.
Also render declaration kind in the message

 #KT-18447 In Progress
This commit is contained in:
Alexander Udalov
2017-07-17 20:54:23 +03:00
parent 472959aca1
commit 74ba0080b1
34 changed files with 372 additions and 494 deletions
@@ -562,7 +562,9 @@ public interface Errors {
DiagnosticFactory3<KtDeclaration, MemberDescriptor, ModuleDescriptor, DiagnosticFactory3<KtDeclaration, MemberDescriptor, ModuleDescriptor,
Map<HeaderImplDeclarationChecker.Compatibility.Incompatible, Collection<MemberDescriptor>>> HEADER_WITHOUT_IMPLEMENTATION = Map<HeaderImplDeclarationChecker.Compatibility.Incompatible, Collection<MemberDescriptor>>> HEADER_WITHOUT_IMPLEMENTATION =
DiagnosticFactory3.create(ERROR, DECLARATION_SIGNATURE); DiagnosticFactory3.create(ERROR, DECLARATION_SIGNATURE);
DiagnosticFactory0<PsiElement> IMPLEMENTATION_WITHOUT_HEADER = DiagnosticFactory0.create(ERROR); DiagnosticFactory2<KtDeclaration, MemberDescriptor,
Map<HeaderImplDeclarationChecker.Compatibility.Incompatible, Collection<MemberDescriptor>>> IMPLEMENTATION_WITHOUT_HEADER =
DiagnosticFactory2.create(ERROR, DECLARATION_SIGNATURE);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -270,9 +270,10 @@ public class DefaultErrorMessages {
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_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(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(HEADER_WITHOUT_IMPLEMENTATION, "Header declaration ''{0}'' has no implementation in module{1}{2}", NAME, MAP.put(HEADER_WITHOUT_IMPLEMENTATION, "''header'' {0} has no implementation in module{1}{2}", DECLARATION_NAME_WITH_KIND,
PLATFORM, PlatformIncompatibilityDiagnosticRenderer.INSTANCE); PLATFORM, PlatformIncompatibilityDiagnosticRenderer.INSTANCE);
MAP.put(IMPLEMENTATION_WITHOUT_HEADER, "Modifier 'impl' is only applicable to members that are initially declared in platform-independent code"); MAP.put(IMPLEMENTATION_WITHOUT_HEADER, "''impl'' {0} has no corresponding ''header'' declaration{1}", DECLARATION_NAME_WITH_KIND,
PlatformIncompatibilityDiagnosticRenderer.INSTANCE);
MAP.put(PROJECTION_ON_NON_CLASS_TYPE_ARGUMENT, "Projections are not allowed on type arguments of functions and properties"); 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"); MAP.put(SUPERTYPE_NOT_INITIALIZED, "This type has a constructor, and thus must be initialized here");
@@ -93,19 +93,19 @@ object Renderers {
} }
@JvmField val DECLARATION_NAME_WITH_KIND = Renderer<DeclarationDescriptor> { @JvmField val DECLARATION_NAME_WITH_KIND = Renderer<DeclarationDescriptor> {
val declarationKindWithSpace = when (it) { val name = it.name.asString()
is PackageFragmentDescriptor -> "package " when (it) {
is ClassDescriptor -> "${it.renderKind()} " is PackageFragmentDescriptor -> "package '$name'"
is TypeAliasDescriptor -> "typealias " is ClassDescriptor -> "${it.renderKind()} '$name'"
is ConstructorDescriptor -> "constructor " is TypeAliasDescriptor -> "typealias '$name'"
is TypeAliasConstructorDescriptor -> "typealias constructor " is TypeAliasConstructorDescriptor -> "constructor of '${it.typeAliasDescriptor.name.asString()}'"
is PropertyGetterDescriptor -> "property getter " is ConstructorDescriptor -> "constructor of '${it.constructedClass.name.asString()}'"
is PropertySetterDescriptor -> "property setter " is PropertyGetterDescriptor -> "getter of property '${it.correspondingProperty.name.asString()}'"
is FunctionDescriptor -> "function " is PropertySetterDescriptor -> "setter of property '${it.correspondingProperty.name.asString()}'"
is PropertyDescriptor -> "property " is FunctionDescriptor -> "function '$name'"
is PropertyDescriptor -> "property '$name'"
else -> throw AssertionError("Unexpected declaration kind: $it") else -> throw AssertionError("Unexpected declaration kind: $it")
} }
"$declarationKindWithSpace'${it.name.asString()}'"
} }
@JvmField val NAME_OF_CONTAINING_DECLARATION_OR_FILE = Renderer<DeclarationDescriptor> { @JvmField val NAME_OF_CONTAINING_DECLARATION_OR_FILE = Renderer<DeclarationDescriptor> {
@@ -77,9 +77,16 @@ object HeaderImplDeclarationChecker : DeclarationChecker {
platformModule: ModuleDescriptor, platformModule: ModuleDescriptor,
checkImpl: Boolean checkImpl: Boolean
) { ) {
val compatibility = findImplForHeader(descriptor, platformModule, checkImpl) val compatibility = findImplForHeader(descriptor, platformModule, checkImpl) ?: return
if (compatibility != null && Compatible !in compatibility) { val shouldReportError =
compatibility.isEmpty() ||
Compatible !in compatibility && compatibility.values.flatMapTo(hashSetOf()) { it }.all { impl ->
val headers = findHeaderForImpl(impl, descriptor.module)
headers != null && Compatible in headers.keys
}
if (shouldReportError) {
assert(compatibility.keys.all { it is Incompatible }) assert(compatibility.keys.all { it is Incompatible })
@Suppress("UNCHECKED_CAST") @Suppress("UNCHECKED_CAST")
val incompatibility = compatibility as Map<Incompatible, Collection<MemberDescriptor>> val incompatibility = compatibility as Map<Incompatible, Collection<MemberDescriptor>>
@@ -120,12 +127,13 @@ object HeaderImplDeclarationChecker : DeclarationChecker {
// Using the platform module instead of the common module is sort of fine here because the former always depends on the latter. // Using the platform module instead of the common module is sort of fine here because the former always depends on the latter.
// However, it would be clearer to find the common module this platform module implements and look for headers there instead. // However, it would be clearer to find the common module this platform module implements and look for headers there instead.
// TODO: use common module here // TODO: use common module here
val compatibility = findHeaderForImpl(descriptor, descriptor.module) val compatibility = findHeaderForImpl(descriptor, descriptor.module) ?: return
if (compatibility != null && Compatible !in compatibility) { if (Compatible !in compatibility) {
assert(compatibility.keys.all { it is Incompatible }) assert(compatibility.keys.all { it is Incompatible })
// TODO: do not report this error for members which are "almost compatible" with some header declarations @Suppress("UNCHECKED_CAST")
diagnosticHolder.report(Errors.IMPLEMENTATION_WITHOUT_HEADER.on(reportOn.modifierList!!.getModifier(KtTokens.IMPL_KEYWORD)!!)) val incompatibility = compatibility as Map<Incompatible, Collection<MemberDescriptor>>
diagnosticHolder.report(Errors.IMPLEMENTATION_WITHOUT_HEADER.on(reportOn, descriptor, incompatibility))
} }
} }
@@ -4,8 +4,8 @@
// FILE: common.kt // FILE: common.kt
header class C1 header class C1
header interface <!JVM:HEADER_WITHOUT_IMPLEMENTATION!>C2<!><A> header interface C2<A>
header interface <!JVM:HEADER_WITHOUT_IMPLEMENTATION!>C3<!><B> header interface C3<B>
header interface C4<D, E> header interface C4<D, E>
header interface C5<F, G> header interface C5<F, G>
header interface C6<H> header interface C6<H>
@@ -23,7 +23,7 @@ fun foo() {
// FILE: jvm.kt // FILE: jvm.kt
class Outer impl constructor() { class Outer impl constructor() {
<!IMPLEMENTATION_WITHOUT_HEADER!>impl<!> class Nested impl class <!IMPLEMENTATION_WITHOUT_HEADER!>Nested<!>
<!WRONG_MODIFIER_TARGET!>impl<!> init {} <!WRONG_MODIFIER_TARGET!>impl<!> init {}
} }
@@ -31,5 +31,5 @@ class Outer impl constructor() {
fun foo() { fun foo() {
<!WRONG_MODIFIER_TARGET!>impl<!> fun localFun() {} <!WRONG_MODIFIER_TARGET!>impl<!> fun localFun() {}
<!WRONG_MODIFIER_TARGET!>impl<!> var <!UNUSED_VARIABLE!>x<!> = 42 <!WRONG_MODIFIER_TARGET!>impl<!> var <!UNUSED_VARIABLE!>x<!> = 42
<!IMPLEMENTATION_WITHOUT_HEADER, WRONG_MODIFIER_TARGET!>impl<!> class Bar <!WRONG_MODIFIER_TARGET!>impl<!> class <!IMPLEMENTATION_WITHOUT_HEADER!>Bar<!>
} }
@@ -9,10 +9,10 @@ package common
// FILE: jvm.kt // FILE: jvm.kt
package jvm package jvm
<!IMPLEMENTATION_WITHOUT_HEADER!>impl<!> fun foo() {} <!IMPLEMENTATION_WITHOUT_HEADER!>impl fun foo()<!> {}
// MODULE: m3-js(m1-common) // MODULE: m3-js(m1-common)
// FILE: js.kt // FILE: js.kt
package js package js
<!IMPLEMENTATION_WITHOUT_HEADER!>impl<!> fun foo() {} <!IMPLEMENTATION_WITHOUT_HEADER!>impl fun foo()<!> {}
@@ -9,4 +9,4 @@ header fun foo()
<!NON_MEMBER_FUNCTION_NO_BODY!>impl fun foo()<!> <!NON_MEMBER_FUNCTION_NO_BODY!>impl fun foo()<!>
<!NON_MEMBER_FUNCTION_NO_BODY!><!IMPLEMENTATION_WITHOUT_HEADER!>impl<!> fun bar()<!> <!NON_MEMBER_FUNCTION_NO_BODY, IMPLEMENTATION_WITHOUT_HEADER!>impl fun bar()<!>
@@ -2,4 +2,4 @@
// MODULE: m1-jvm // MODULE: m1-jvm
// FILE: jvm.kt // FILE: jvm.kt
<!IMPLEMENTATION_WITHOUT_HEADER!>impl<!> fun foo() { } <!IMPLEMENTATION_WITHOUT_HEADER!>impl fun foo()<!> { }
@@ -2,13 +2,13 @@
// MODULE: m1-common // MODULE: m1-common
// FILE: common.kt // FILE: common.kt
<!JVM:HEADER_WITHOUT_IMPLEMENTATION!>inline header fun inlineFun()<!> inline header fun inlineFun()
header fun nonInlineFun() header fun nonInlineFun()
// MODULE: m2-jvm(m1-common) // MODULE: m2-jvm(m1-common)
// FILE: jvm.kt // FILE: jvm.kt
<!IMPLEMENTATION_WITHOUT_HEADER!>impl<!> fun inlineFun() { } <!IMPLEMENTATION_WITHOUT_HEADER!>impl fun inlineFun()<!> { }
impl fun nonInlineFun() { } impl fun nonInlineFun() { }
// MODULE: m3-js(m1-common) // MODULE: m3-js(m1-common)
@@ -5,9 +5,9 @@ Output:
-- JVM -- -- JVM --
Exit code: COMPILATION_ERROR Exit code: COMPILATION_ERROR
Output: Output:
compiler/testData/multiplatform/classScopes/constructorIncorrectSignature/common.kt:1:14: error: header declaration 'Foo' has no implementation in module compiler/testData/multiplatform/classScopes/constructorIncorrectSignature/jvm.kt:1:12: error: 'impl' class 'Foo' has no corresponding 'header' declaration
The following declaration is incompatible because some members are not implemented: The following declaration is incompatible because some members are not implemented:
public final impl class Foo public final header class Foo
No implementations are found for members listed below: No implementations are found for members listed below:
public constructor Foo(s: String) public constructor Foo(s: String)
@@ -15,11 +15,8 @@ No implementations are found for members listed below:
The following declaration is incompatible because parameter types are different: The following declaration is incompatible because parameter types are different:
public constructor Foo(s: Array<String>) public constructor Foo(s: Array<String>)
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 { impl class Foo {
^ ^
compiler/testData/multiplatform/classScopes/constructorIncorrectSignature/jvm.kt:2:5: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code compiler/testData/multiplatform/classScopes/constructorIncorrectSignature/jvm.kt:2:10: error: 'impl' constructor of 'Foo' has no corresponding 'header' declaration
impl constructor(s: Array<String>) impl constructor(s: Array<String>)
^ ^
@@ -5,22 +5,15 @@ Output:
-- JVM -- -- JVM --
Exit code: COMPILATION_ERROR Exit code: COMPILATION_ERROR
Output: Output:
compiler/testData/multiplatform/classScopes/enumsWithDifferentEntries/common.kt:1:19: error: header declaration 'AB' has no implementation in module compiler/testData/multiplatform/classScopes/enumsWithDifferentEntries/jvm.kt:1:17: error: 'impl' enum class 'AB' has no corresponding 'header' declaration
The following declaration is incompatible because some entries from header enum are missing in the impl enum: The following declaration is incompatible because some entries from header enum are missing in the impl enum:
public final impl enum class AB : Enum<AB> public final header enum class AB : Enum<AB>
header enum class AB { A, B }
^
compiler/testData/multiplatform/classScopes/enumsWithDifferentEntries/common.kt:3:19: error: header declaration 'CD' has no implementation in module
The following declaration is incompatible because some entries from header enum are missing in the impl enum:
public final impl enum class CD : Enum<CD>
header enum class CD { C, D }
^
compiler/testData/multiplatform/classScopes/enumsWithDifferentEntries/jvm.kt:1:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code
impl enum class AB { A, C } impl enum class AB { A, C }
^ ^
compiler/testData/multiplatform/classScopes/enumsWithDifferentEntries/jvm.kt:3:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code compiler/testData/multiplatform/classScopes/enumsWithDifferentEntries/jvm.kt:3:17: error: 'impl' enum class 'CD' has no corresponding 'header' declaration
impl enum class CD { C } The following declaration is incompatible because some entries from header enum are missing in the impl enum:
^ public final header enum class CD : Enum<CD>
impl enum class CD { C }
^
@@ -5,9 +5,9 @@ Output:
-- JVM -- -- JVM --
Exit code: COMPILATION_ERROR Exit code: COMPILATION_ERROR
Output: Output:
compiler/testData/multiplatform/classScopes/functionIncorrectSignature/common.kt:1:14: error: header declaration 'Foo' has no implementation in module compiler/testData/multiplatform/classScopes/functionIncorrectSignature/jvm.kt:1:12: error: 'impl' class 'Foo' has no corresponding 'header' declaration
The following declaration is incompatible because some members are not implemented: The following declaration is incompatible because some members are not implemented:
public final impl class Foo public final header class Foo
No implementations are found for members listed below: No implementations are found for members listed below:
public final header fun function(b: ByteArray): Int public final header fun function(b: ByteArray): Int
@@ -15,11 +15,8 @@ No implementations are found for members listed below:
The following declaration is incompatible because return type is different: The following declaration is incompatible because return type is different:
public final impl fun function(b: ByteArray): Long public final impl fun function(b: ByteArray): Long
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 { impl class Foo {
^ ^
compiler/testData/multiplatform/classScopes/functionIncorrectSignature/jvm.kt:2:5: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code compiler/testData/multiplatform/classScopes/functionIncorrectSignature/jvm.kt:2:5: error: 'impl' function 'function' has no corresponding 'header' declaration
impl fun function(b: ByteArray): Long = b.size.toLong() impl fun function(b: ByteArray): Long = b.size.toLong()
^ ^
@@ -5,9 +5,9 @@ Output:
-- JVM -- -- JVM --
Exit code: COMPILATION_ERROR Exit code: COMPILATION_ERROR
Output: Output:
compiler/testData/multiplatform/classScopes/missingConstructor/common.kt:1:14: error: header declaration 'Foo' has no implementation in module compiler/testData/multiplatform/classScopes/missingConstructor/jvm.kt:1:12: error: 'impl' class 'Foo' has no corresponding 'header' declaration
The following declaration is incompatible because some members are not implemented: The following declaration is incompatible because some members are not implemented:
public final impl class Foo public final header class Foo
No implementations are found for members listed below: No implementations are found for members listed below:
public constructor Foo(s: String) public constructor Foo(s: String)
@@ -15,8 +15,5 @@ No implementations are found for members listed below:
The following declaration is incompatible because number of value parameters is different: The following declaration is incompatible because number of value parameters is different:
public constructor Foo() public constructor 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 impl class Foo
^ ^
@@ -5,15 +5,12 @@ Output:
-- JVM -- -- JVM --
Exit code: COMPILATION_ERROR Exit code: COMPILATION_ERROR
Output: Output:
compiler/testData/multiplatform/classScopes/missingFunction/common.kt:1:14: error: header declaration 'Foo' has no implementation in module compiler/testData/multiplatform/classScopes/missingFunction/jvm.kt:1:12: error: 'impl' class 'Foo' has no corresponding 'header' declaration
The following declaration is incompatible because some members are not implemented: The following declaration is incompatible because some members are not implemented:
public final impl class Foo public final header class Foo
No implementations are found for members listed below: No implementations are found for members listed below:
public final header fun function(s: String): Unit public final header fun function(s: String): Unit
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 impl class Foo
^ ^
@@ -5,6 +5,6 @@ Output:
-- JVM -- -- JVM --
Exit code: COMPILATION_ERROR Exit code: COMPILATION_ERROR
Output: Output:
compiler/testData/multiplatform/implTypeAlias/nestedClassesViaTypeAlias/common.kt:2:22: error: header declaration 'Nested' has no implementation in module compiler/testData/multiplatform/implTypeAlias/nestedClassesViaTypeAlias/common.kt:2:22: error: 'header' interface 'Nested' has no implementation in module
header interface Nested header interface Nested
^ ^
@@ -11,202 +11,135 @@ header fun <A, B : Continuation<A>> f13()
-- JVM -- -- JVM --
Exit code: COMPILATION_ERROR Exit code: COMPILATION_ERROR
Output: Output:
compiler/testData/multiplatform/incompatibleCallables/common.kt:3:1: error: header declaration 'f1' has no implementation in module compiler/testData/multiplatform/incompatibleCallables/jvm.kt:3:1: error: 'impl' function 'f1' has no corresponding 'header' declaration
The following declaration is incompatible because return type is different: The following declaration is incompatible because return type is different:
public impl fun f1(): String public header fun f1(): Unit
header fun f1()
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:5:1: error: header declaration 'f2' has no implementation in module
The following declaration is incompatible because parameter names are different:
public impl fun f2(otherName: String): Unit
header fun f2(name: String)
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:7:1: error: header declaration 'f3' has no implementation in module
The following declaration is incompatible because parameter types are different:
public impl fun f3(name: Double): Unit
header fun f3(name: String)
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:8:1: error: header declaration 'f3ext' has no implementation in module
The following declaration is incompatible because parameter types are different:
public impl fun Double.f3ext(): Unit
header fun String.f3ext()
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:10:1: error: header declaration 'f4' has no implementation in module
The following declaration is incompatible because parameter shapes are different (extension vs non-extension):
public impl fun String.f4(): Unit
header fun f4(name: String)
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:12:1: error: header declaration 'f5' has no implementation in module
The following declaration is incompatible because parameter shapes are different (extension vs non-extension):
public impl fun f5(name: String): Unit
header fun String.f5()
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:14:1: error: header declaration 'f6' has no implementation in module
The following declaration is incompatible because number of value parameters is different:
public impl fun f6(p2: Int): Unit
header fun f6(p1: String, p2: Int)
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:16:1: error: header declaration 'f7' has no implementation in module
The following declaration is incompatible because number of type parameters is different:
public impl fun <K, V> f7(): Unit
header fun <T> f7()
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:18:1: error: header declaration 'f8' has no implementation in module
The following declaration is incompatible because visibility is different:
public impl fun f8(): Unit
internal header fun f8()
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:19:1: error: header declaration 'f9' has no implementation in module
The following declaration is incompatible because visibility is different:
internal impl fun f9(): Unit
private header fun f9()
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:20:1: error: header declaration 'f10' has no implementation in module
The following declaration is incompatible because visibility is different:
private impl fun f10(): Unit
public header fun f10()
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:26:1: error: header declaration 'f14' has no implementation in module
The following declaration is incompatible because some type parameter is reified in one declaration and non-reified in the other:
public impl inline fun <reified X> f14(): Unit
header inline fun <X> f14()
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:27:1: error: header declaration 'f15' has no implementation in module
The following declaration is incompatible because some type parameter is reified in one declaration and non-reified in the other:
public impl inline fun <Y> f15(): Unit
header inline fun <reified Y> f15()
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:29:1: error: header declaration 'f16' has no implementation in module
The following declaration is incompatible because some parameters have default values:
public impl fun f16(s: String = ...): Unit
header fun f16(s: String)
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:31:1: error: header declaration 'f17' has no implementation in module
The following declaration is incompatible because parameter modifiers are different (vararg, coroutine, crossinline, noinline):
public impl fun f17(s: Array<out String>): Unit
header fun f17(vararg s: String)
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:32:1: error: header declaration 'f18' has no implementation in module
The following declaration is incompatible because parameter modifiers are different (vararg, coroutine, crossinline, noinline):
public impl fun f18(vararg s: String): Unit
header fun f18(s: Array<out String>)
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:33:1: error: header declaration 'f19' has no implementation in module
The following declaration is incompatible because parameter modifiers are different (vararg, coroutine, crossinline, noinline):
public impl inline fun f19(s: () -> Unit): Unit
header inline fun f19(crossinline s: () -> Unit)
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:34:1: error: header declaration 'f20' has no implementation in module
The following declaration is incompatible because parameter modifiers are different (vararg, coroutine, crossinline, noinline):
public impl inline fun f20(crossinline s: () -> Unit): Unit
header inline fun f20(s: () -> Unit)
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:35:1: error: header declaration 'f21' has no implementation in module
The following declaration is incompatible because parameter modifiers are different (vararg, coroutine, crossinline, noinline):
public impl inline fun f21(s: () -> Unit): Unit
header inline fun f21(noinline s: () -> Unit)
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:36:1: error: header declaration 'f22' has no implementation in module
The following declaration is incompatible because parameter modifiers are different (vararg, coroutine, crossinline, noinline):
public impl inline fun f22(noinline s: () -> Unit): Unit
header inline fun f22(s: () -> Unit)
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:37:1: error: header declaration 'f23' has no implementation in module
The following declaration is incompatible because parameter types are different:
public impl fun f23(c: Unit.() -> Unit): Unit
header fun f23(c: suspend Unit.() -> Unit)
^
compiler/testData/multiplatform/incompatibleCallables/common.kt:38:1: error: header declaration 'f24' has no implementation in module
The following declaration is incompatible because parameter types are different:
public impl fun f24(c: suspend Unit.() -> Unit): Unit
header fun f24(c: Unit.() -> Unit)
^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:3:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code
impl fun f1(): String = "" impl fun f1(): String = ""
^ ^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:5:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code compiler/testData/multiplatform/incompatibleCallables/jvm.kt:5:1: error: 'impl' function 'f2' has no corresponding 'header' declaration
The following declaration is incompatible because parameter names are different:
public header fun f2(name: String): Unit
impl fun f2(otherName: String) {} impl fun f2(otherName: String) {}
^ ^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:7:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code compiler/testData/multiplatform/incompatibleCallables/jvm.kt:7:1: error: 'impl' function 'f3' has no corresponding 'header' declaration
The following declaration is incompatible because parameter types are different:
public header fun f3(name: String): Unit
impl fun f3(name: Double) {} impl fun f3(name: Double) {}
^ ^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:8:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code compiler/testData/multiplatform/incompatibleCallables/jvm.kt:8:1: error: 'impl' function 'f3ext' has no corresponding 'header' declaration
The following declaration is incompatible because parameter types are different:
public header fun String.f3ext(): Unit
impl fun Double.f3ext() {} impl fun Double.f3ext() {}
^ ^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:10:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code compiler/testData/multiplatform/incompatibleCallables/jvm.kt:10:1: error: 'impl' function 'f4' has no corresponding 'header' declaration
The following declaration is incompatible because parameter shapes are different (extension vs non-extension):
public header fun f4(name: String): Unit
impl fun String.f4() {} impl fun String.f4() {}
^ ^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:12:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code compiler/testData/multiplatform/incompatibleCallables/jvm.kt:12:1: error: 'impl' function 'f5' has no corresponding 'header' declaration
The following declaration is incompatible because parameter shapes are different (extension vs non-extension):
public header fun String.f5(): Unit
impl fun f5(name: String) {} impl fun f5(name: String) {}
^ ^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:14:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code compiler/testData/multiplatform/incompatibleCallables/jvm.kt:14:1: error: 'impl' function 'f6' has no corresponding 'header' declaration
The following declaration is incompatible because number of value parameters is different:
public header fun f6(p1: String, p2: Int): Unit
impl fun f6(p2: Int) {} impl fun f6(p2: Int) {}
^ ^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:16:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code compiler/testData/multiplatform/incompatibleCallables/jvm.kt:16:1: error: 'impl' function 'f7' has no corresponding 'header' declaration
The following declaration is incompatible because number of type parameters is different:
public header fun <T> f7(): Unit
impl fun <K, V> f7() {} impl fun <K, V> f7() {}
^ ^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:18:8: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code compiler/testData/multiplatform/incompatibleCallables/jvm.kt:18:1: error: 'impl' function 'f8' has no corresponding 'header' declaration
The following declaration is incompatible because visibility is different:
internal header fun f8(): Unit
public impl fun f8() {} public impl fun f8() {}
^ ^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:19:10: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code compiler/testData/multiplatform/incompatibleCallables/jvm.kt:19:1: error: 'impl' function 'f9' has no corresponding 'header' declaration
The following declaration is incompatible because visibility is different:
private header fun f9(): Unit
internal impl fun f9() {} internal impl fun f9() {}
^ ^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:20:9: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code compiler/testData/multiplatform/incompatibleCallables/jvm.kt:20:1: error: 'impl' function 'f10' has no corresponding 'header' declaration
The following declaration is incompatible because visibility is different:
public header fun f10(): Unit
private impl fun f10() {} private impl fun f10() {}
^ ^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:26:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code compiler/testData/multiplatform/incompatibleCallables/jvm.kt:26:1: error: 'impl' function 'f14' has no corresponding 'header' declaration
The following declaration is incompatible because some type parameter is reified in one declaration and non-reified in the other:
public header inline fun <X> f14(): Unit
impl inline fun <reified X> f14() {} impl inline fun <reified X> f14() {}
^ ^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:27:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code compiler/testData/multiplatform/incompatibleCallables/jvm.kt:27:1: error: 'impl' function 'f15' has no corresponding 'header' declaration
The following declaration is incompatible because some type parameter is reified in one declaration and non-reified in the other:
public header inline fun <reified Y> f15(): Unit
impl inline fun <Y> f15() {} impl inline fun <Y> f15() {}
^ ^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:29:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code compiler/testData/multiplatform/incompatibleCallables/jvm.kt:29:1: error: 'impl' function 'f16' has no corresponding 'header' declaration
The following declaration is incompatible because some parameters have default values:
public header fun f16(s: String): Unit
impl fun f16(s: String = "") {} impl fun f16(s: String = "") {}
^ ^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:31:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code compiler/testData/multiplatform/incompatibleCallables/jvm.kt:31:1: error: 'impl' function 'f17' has no corresponding 'header' declaration
The following declaration is incompatible because parameter modifiers are different (vararg, coroutine, crossinline, noinline):
public header fun f17(vararg s: String): Unit
impl fun f17(s: Array<out String>) {} impl fun f17(s: Array<out String>) {}
^ ^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:32:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code compiler/testData/multiplatform/incompatibleCallables/jvm.kt:32:1: error: 'impl' function 'f18' has no corresponding 'header' declaration
The following declaration is incompatible because parameter modifiers are different (vararg, coroutine, crossinline, noinline):
public header fun f18(s: Array<out String>): Unit
impl fun f18(vararg s: String) {} impl fun f18(vararg s: String) {}
^ ^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:33:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code compiler/testData/multiplatform/incompatibleCallables/jvm.kt:33:1: error: 'impl' function 'f19' has no corresponding 'header' declaration
The following declaration is incompatible because parameter modifiers are different (vararg, coroutine, crossinline, noinline):
public header inline fun f19(crossinline s: () -> Unit): Unit
impl inline fun f19(s: () -> Unit) {} impl inline fun f19(s: () -> Unit) {}
^ ^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:34:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code compiler/testData/multiplatform/incompatibleCallables/jvm.kt:34:1: error: 'impl' function 'f20' has no corresponding 'header' declaration
The following declaration is incompatible because parameter modifiers are different (vararg, coroutine, crossinline, noinline):
public header inline fun f20(s: () -> Unit): Unit
impl inline fun f20(crossinline s: () -> Unit) {} impl inline fun f20(crossinline s: () -> Unit) {}
^ ^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:35:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code compiler/testData/multiplatform/incompatibleCallables/jvm.kt:35:1: error: 'impl' function 'f21' has no corresponding 'header' declaration
The following declaration is incompatible because parameter modifiers are different (vararg, coroutine, crossinline, noinline):
public header inline fun f21(noinline s: () -> Unit): Unit
impl inline fun f21(s: () -> Unit) {} impl inline fun f21(s: () -> Unit) {}
^ ^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:36:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code compiler/testData/multiplatform/incompatibleCallables/jvm.kt:36:1: error: 'impl' function 'f22' has no corresponding 'header' declaration
The following declaration is incompatible because parameter modifiers are different (vararg, coroutine, crossinline, noinline):
public header inline fun f22(s: () -> Unit): Unit
impl inline fun f22(noinline s: () -> Unit) {} impl inline fun f22(noinline s: () -> Unit) {}
^ ^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:37:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code compiler/testData/multiplatform/incompatibleCallables/jvm.kt:37:1: error: 'impl' function 'f23' has no corresponding 'header' declaration
The following declaration is incompatible because parameter types are different:
public header fun f23(c: suspend Unit.() -> Unit): Unit
impl fun f23(c: Unit.() -> Unit) {} impl fun f23(c: Unit.() -> Unit) {}
^ ^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:38:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code compiler/testData/multiplatform/incompatibleCallables/jvm.kt:38:1: error: 'impl' function 'f24' has no corresponding 'header' declaration
The following declaration is incompatible because parameter types are different:
public header fun f24(c: Unit.() -> Unit): Unit
impl fun f24(c: suspend Unit.() -> Unit) {} impl fun f24(c: suspend Unit.() -> Unit) {}
^ ^
+80 -123
View File
@@ -5,130 +5,87 @@ Output:
-- JVM -- -- JVM --
Exit code: COMPILATION_ERROR Exit code: COMPILATION_ERROR
Output: Output:
compiler/testData/multiplatform/incompatibleClasses/common.kt:1:14: error: header declaration 'PClass' has no implementation in module compiler/testData/multiplatform/incompatibleClasses/jvm.kt:1:16: error: 'impl' interface 'PClass' has no corresponding 'header' declaration
The following declaration is incompatible because class kinds are different (class, interface, object, enum, annotation): The following declaration is incompatible because class kinds are different (class, interface, object, enum, annotation):
public impl interface PClass public final header class PClass
header class PClass
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:2:18: error: header declaration 'PInterface' has no implementation in module
The following declaration is incompatible because class kinds are different (class, interface, object, enum, annotation):
public impl object PInterface
header interface PInterface
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:3:8: error: header declaration 'PObject' has no implementation in module
The following declaration is incompatible because class kinds are different (class, interface, object, enum, annotation):
public final impl enum class PObject : Enum<PObject>
header object PObject
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:4:19: error: header declaration 'PEnumClass' has no implementation in module
The following declaration is incompatible because class kinds are different (class, interface, object, enum, annotation):
public final impl annotation class PEnumClass : Annotation
header enum class PEnumClass
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:5:25: error: header declaration 'PAnnotationClass' has no implementation in module
The following declaration is incompatible because class kinds are different (class, interface, object, enum, annotation):
public final impl class PAnnotationClass
header annotation class PAnnotationClass
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:7:17: error: header declaration 'InternalObject' has no implementation in module
The following declaration is incompatible because visibility is different:
private impl object InternalObject
internal header object InternalObject
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:8:15: error: header declaration 'PublicObject' has no implementation in module
The following declaration is incompatible because visibility is different:
internal impl object PublicObject
public header object PublicObject
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:9:16: error: header declaration 'PrivateObject' has no implementation in module
The following declaration is incompatible because visibility is different:
public impl object PrivateObject
private header object PrivateObject
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:11:19: error: header declaration 'OpenClass' has no implementation in module
The following declaration is incompatible because modality is different:
public final impl class OpenClass
open header class OpenClass
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:12:23: error: header declaration 'AbstractClass' has no implementation in module
The following declaration is incompatible because modality is different:
public open impl class AbstractClass
abstract header class AbstractClass
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:13:20: error: header declaration 'FinalClass' has no implementation in module
The following declaration is incompatible because modality is different:
public abstract impl class FinalClass
final header class FinalClass
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:15:14: error: header declaration 'C1' has no implementation in module
The following declaration is incompatible because number of type parameters is different:
public final impl class C1<A, Extra>
header class C1<A>
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:16:14: error: header declaration 'C2' has no implementation in module
The following declaration is incompatible because declaration-site variances of type parameters are different:
public final impl class C2<out B>
header class C2<B>
^
compiler/testData/multiplatform/incompatibleClasses/common.kt:22:23: error: header declaration 'ExtendsNumber' has no implementation in module
The following declaration is incompatible because some supertypes are missing in the implementation:
public abstract impl class ExtendsNumber
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 impl interface PClass
^ ^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:2:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code compiler/testData/multiplatform/incompatibleClasses/jvm.kt:2:6: error: 'impl' object 'PInterface' has no corresponding 'header' declaration
impl object PInterface The following declaration is incompatible because class kinds are different (class, interface, object, enum, annotation):
^ public header interface PInterface
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:3:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code
impl enum class PObject
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:4:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code
impl annotation class PEnumClass
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:5:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code
impl class PAnnotationClass
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:7:9: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code
private impl object InternalObject
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:8:10: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code
internal impl object PublicObject
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:9:8: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code
public impl object PrivateObject
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:11:7: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code
final impl class OpenClass
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:12:6: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code
open impl class AbstractClass
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:13:10: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code
abstract impl class FinalClass
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:15:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code
impl class C1<A, Extra>
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:16:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code
impl class C2<out B>
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:22:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code
impl abstract class ExtendsNumber : Any()
^
impl object PInterface
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:3:17: error: 'impl' enum class 'PObject' has no corresponding 'header' declaration
The following declaration is incompatible because class kinds are different (class, interface, object, enum, annotation):
public header object PObject
impl enum class PObject
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:4:23: error: 'impl' annotation class 'PEnumClass' has no corresponding 'header' declaration
The following declaration is incompatible because class kinds are different (class, interface, object, enum, annotation):
public final header enum class PEnumClass : Enum<PEnumClass>
impl annotation class PEnumClass
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:5:12: error: 'impl' class 'PAnnotationClass' has no corresponding 'header' declaration
The following declaration is incompatible because class kinds are different (class, interface, object, enum, annotation):
public final header annotation class PAnnotationClass : Annotation
impl class PAnnotationClass
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:7:14: error: 'impl' object 'InternalObject' has no corresponding 'header' declaration
The following declaration is incompatible because visibility is different:
internal header object InternalObject
private impl object InternalObject
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:8:15: error: 'impl' object 'PublicObject' has no corresponding 'header' declaration
The following declaration is incompatible because visibility is different:
public header object PublicObject
internal impl object PublicObject
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:9:13: error: 'impl' object 'PrivateObject' has no corresponding 'header' declaration
The following declaration is incompatible because visibility is different:
private header object PrivateObject
public impl object PrivateObject
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:11:18: error: 'impl' class 'OpenClass' has no corresponding 'header' declaration
The following declaration is incompatible because modality is different:
public open header class OpenClass
final impl class OpenClass
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:12:17: error: 'impl' class 'AbstractClass' has no corresponding 'header' declaration
The following declaration is incompatible because modality is different:
public abstract header class AbstractClass
open impl class AbstractClass
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:13:21: error: 'impl' class 'FinalClass' has no corresponding 'header' declaration
The following declaration is incompatible because modality is different:
public final header class FinalClass
abstract impl class FinalClass
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:15:12: error: 'impl' class 'C1' has no corresponding 'header' declaration
The following declaration is incompatible because number of type parameters is different:
public final header class C1<A>
impl class C1<A, Extra>
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:16:12: error: 'impl' class 'C2' has no corresponding 'header' declaration
The following declaration is incompatible because declaration-site variances of type parameters are different:
public final header class C2<B>
impl class C2<out B>
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:22:21: error: 'impl' class 'ExtendsNumber' has no corresponding 'header' declaration
The following declaration is incompatible because some supertypes are missing in the implementation:
public abstract header class ExtendsNumber : Number
impl abstract class ExtendsNumber : Any()
^
@@ -5,49 +5,33 @@ Output:
-- JVM -- -- JVM --
Exit code: COMPILATION_ERROR Exit code: COMPILATION_ERROR
Output: Output:
compiler/testData/multiplatform/incompatibleFunctions/common.kt:1:1: error: header declaration 'plus' has no implementation in module compiler/testData/multiplatform/incompatibleFunctions/jvm.kt:1:1: error: 'impl' function 'plus' has no corresponding 'header' declaration
The following declaration is incompatible because some modifiers on header declaration are missing on the implementation (external, infix, inline, operator, tailrec): The following declaration is incompatible because some modifiers on header declaration are missing on the implementation (external, infix, inline, operator, tailrec):
public impl fun Int.plus(s: CharSequence): Int public infix header fun Int.plus(s: CharSequence): Int
header infix fun Int.plus(s: CharSequence): Int
^
compiler/testData/multiplatform/incompatibleFunctions/common.kt:3:1: error: header declaration 'times' has no implementation in module
The following declaration is incompatible because some modifiers on header declaration are missing on the implementation (external, infix, inline, operator, tailrec):
public impl fun Double.times(x: CharArray): Unit
header operator fun Double.times(x: CharArray)
^
compiler/testData/multiplatform/incompatibleFunctions/common.kt:5:1: error: header declaration 'f1' has no implementation in module
The following declaration is incompatible because some modifiers on header declaration are missing on the implementation (external, infix, inline, operator, tailrec):
public impl fun f1(): Unit
header external fun f1()
^
compiler/testData/multiplatform/incompatibleFunctions/common.kt:7:1: error: header declaration 'f2' has no implementation in module
The following declaration is incompatible because some modifiers on header declaration are missing on the implementation (external, infix, inline, operator, tailrec):
public impl fun f2(): Unit
header inline fun f2()
^
compiler/testData/multiplatform/incompatibleFunctions/common.kt:9:1: error: header declaration 'f3' has no implementation in module
The following declaration is incompatible because some modifiers on header declaration are missing on the implementation (external, infix, inline, operator, tailrec):
public impl fun f3(): Unit
header tailrec fun f3()
^
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 impl fun Int.plus(s: CharSequence): Int = 0
^ ^
compiler/testData/multiplatform/incompatibleFunctions/jvm.kt:3:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code compiler/testData/multiplatform/incompatibleFunctions/jvm.kt:3:1: error: 'impl' function 'times' has no corresponding 'header' declaration
The following declaration is incompatible because some modifiers on header declaration are missing on the implementation (external, infix, inline, operator, tailrec):
public operator header fun Double.times(x: CharArray): Unit
impl fun Double.times(x: CharArray) {} impl fun Double.times(x: CharArray) {}
^ ^
compiler/testData/multiplatform/incompatibleFunctions/jvm.kt:5:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code compiler/testData/multiplatform/incompatibleFunctions/jvm.kt:5:1: error: 'impl' function 'f1' has no corresponding 'header' declaration
The following declaration is incompatible because some modifiers on header declaration are missing on the implementation (external, infix, inline, operator, tailrec):
public external header fun f1(): Unit
impl fun f1() {} impl fun f1() {}
^ ^
compiler/testData/multiplatform/incompatibleFunctions/jvm.kt:7:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code compiler/testData/multiplatform/incompatibleFunctions/jvm.kt:7:1: error: 'impl' function 'f2' has no corresponding 'header' declaration
The following declaration is incompatible because some modifiers on header declaration are missing on the implementation (external, infix, inline, operator, tailrec):
public header inline fun f2(): Unit
impl fun f2() {} impl fun f2() {}
^ ^
compiler/testData/multiplatform/incompatibleFunctions/jvm.kt:9:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code compiler/testData/multiplatform/incompatibleFunctions/jvm.kt:9:1: error: 'impl' function 'f3' has no corresponding 'header' declaration
The following declaration is incompatible because some modifiers on header declaration are missing on the implementation (external, infix, inline, operator, tailrec):
public header tailrec fun f3(): Unit
impl fun f3() {} impl fun f3() {}
^ ^
@@ -5,76 +5,51 @@ Output:
-- JVM -- -- JVM --
Exit code: COMPILATION_ERROR Exit code: COMPILATION_ERROR
Output: Output:
compiler/testData/multiplatform/incompatibleNestedClasses/common.kt:2:18: error: header declaration 'N1' has no implementation in module compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:2:20: error: 'impl' interface 'N1' has no corresponding 'header' declaration
The following declaration is incompatible because class kinds are different (class, interface, object, enum, annotation): The following declaration is incompatible because class kinds are different (class, interface, object, enum, annotation):
public impl interface N1 public final header class N1
header class N1
^
compiler/testData/multiplatform/incompatibleNestedClasses/common.kt:3:22: error: header declaration 'N2' has no implementation in module
The following declaration is incompatible because class kinds are different (class, interface, object, enum, annotation):
public impl object N2
header interface N2
^
compiler/testData/multiplatform/incompatibleNestedClasses/common.kt:4:12: error: header declaration 'N3' has no implementation in module
The following declaration is incompatible because class kinds are different (class, interface, object, enum, annotation):
public final impl class N3
header object N3
^
compiler/testData/multiplatform/incompatibleNestedClasses/common.kt:8:18: error: header declaration 'N2' has no implementation in module
The following declaration is incompatible because modifiers are different (companion, inner):
public final impl inner class N2
header class N2
^
compiler/testData/multiplatform/incompatibleNestedClasses/common.kt:9:24: error: header declaration 'I2' has no implementation in module
The following declaration is incompatible because modifiers are different (companion, inner):
public final impl class I2
header inner class I2
^
compiler/testData/multiplatform/incompatibleNestedClasses/common.kt:13:12: error: header declaration 'Companion' has no implementation in module
The following declaration is incompatible because modifiers are different (companion, inner):
public impl companion object
header object Companion
^
compiler/testData/multiplatform/incompatibleNestedClasses/common.kt:14:22: error: header declaration 'Factory' has no implementation in module
The following declaration is incompatible because modifiers are different (companion, inner):
public impl object Factory
header companion object Factory
^
compiler/testData/multiplatform/incompatibleNestedClasses/common.kt:18:22: error: header declaration 'Companion' has no implementation in module
The following declaration is incompatible because modifiers are different (companion, inner):
public impl object Companion
header companion object
^
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:2:5: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code
impl interface N1 impl interface N1
^ ^
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:3:5: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:3:10: error: 'impl' object 'N2' has no corresponding 'header' declaration
impl object N2 The following declaration is incompatible because class kinds are different (class, interface, object, enum, annotation):
^ public header interface N2
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:4:5: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code
impl class N3
^
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:8:5: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code
impl inner class N2
^
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:9:5: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code
impl class I2
^
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:13:5: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code
impl companion object {}
^
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:14:5: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code
impl object Factory
^
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:18:5: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code
impl object Companion
^
impl object N2
^
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:4:16: error: 'impl' class 'N3' has no corresponding 'header' declaration
The following declaration is incompatible because class kinds are different (class, interface, object, enum, annotation):
public header object N3
impl class N3
^
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:8:22: error: 'impl' class 'N2' has no corresponding 'header' declaration
The following declaration is incompatible because modifiers are different (companion, inner):
public final header class N2
impl inner class N2
^
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:9:16: error: 'impl' class 'I2' has no corresponding 'header' declaration
The following declaration is incompatible because modifiers are different (companion, inner):
public final header inner class I2
impl class I2
^
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:13:20: error: 'impl' companion object 'Companion' has no corresponding 'header' declaration
The following declaration is incompatible because modifiers are different (companion, inner):
public header object Companion
impl companion object {}
^
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:14:10: error: 'impl' object 'Factory' has no corresponding 'header' declaration
The following declaration is incompatible because modifiers are different (companion, inner):
public header companion object Factory
impl object Factory
^
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:18:10: error: 'impl' object 'Companion' has no corresponding 'header' declaration
The following declaration is incompatible because modifiers are different (companion, inner):
public header companion object
impl object Companion
^
@@ -5,22 +5,15 @@ Output:
-- JVM -- -- JVM --
Exit code: COMPILATION_ERROR Exit code: COMPILATION_ERROR
Output: Output:
compiler/testData/multiplatform/incompatibleProperties/common.kt:1:1: error: header declaration 'pval' has no implementation in module compiler/testData/multiplatform/incompatibleProperties/jvm.kt:1:1: error: 'impl' property 'pval' has no corresponding 'header' declaration
The following declaration is incompatible because property kinds are different (val vs var): The following declaration is incompatible because property kinds are different (val vs var):
public impl var pval: String public header val pval: String
header val pval: String
^
compiler/testData/multiplatform/incompatibleProperties/common.kt:2:1: error: header declaration 'pvar' has no implementation in module
The following declaration is incompatible because property kinds are different (val vs var):
public impl val 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 = "" impl var pval: String = ""
^ ^
compiler/testData/multiplatform/incompatibleProperties/jvm.kt:2:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code compiler/testData/multiplatform/incompatibleProperties/jvm.kt:2:1: error: 'impl' property 'pvar' has no corresponding 'header' declaration
The following declaration is incompatible because property kinds are different (val vs var):
public header var pvar: String
impl val pvar: String = "" impl val pvar: String = ""
^ ^
@@ -5,13 +5,15 @@ Output:
-- JVM -- -- JVM --
Exit code: COMPILATION_ERROR Exit code: COMPILATION_ERROR
Output: Output:
compiler/testData/multiplatform/incorrectImplInClass/jvm.kt:2:5: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code compiler/testData/multiplatform/incorrectImplInClass/jvm.kt:2:10: error: 'impl' constructor of 'Foo' has no corresponding 'header' declaration
The following declaration is incompatible because number of value parameters is different:
public constructor Foo()
impl constructor(s: String) : this() impl constructor(s: String) : this()
^ ^
compiler/testData/multiplatform/incorrectImplInClass/jvm.kt:4:5: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code compiler/testData/multiplatform/incorrectImplInClass/jvm.kt:4:5: error: 'impl' function 'nonPlatformFun' has no corresponding 'header' declaration
impl fun nonPlatformFun() {} impl fun nonPlatformFun() {}
^ ^
compiler/testData/multiplatform/incorrectImplInClass/jvm.kt:6:5: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code compiler/testData/multiplatform/incorrectImplInClass/jvm.kt:6:5: error: 'impl' property 'nonPlatformVal' has no corresponding 'header' declaration
impl val nonPlatformVal = "" impl val nonPlatformVal = ""
^ ^
@@ -0,0 +1,9 @@
header class Foo {
fun f(s: String)
fun f(a: Any)
}
header fun g(s: String)
header fun g(a: Any)
@@ -0,0 +1,5 @@
impl class Foo {
impl fun f(s: String) {}
}
impl fun g(a: Any) {}
@@ -0,0 +1,22 @@
-- Common --
Exit code: OK
Output:
-- JVM --
Exit code: COMPILATION_ERROR
Output:
compiler/testData/multiplatform/missingOverload/common.kt:7:1: error: 'header' function 'g' has no implementation in module
The following declaration is incompatible because parameter types are different:
public impl fun g(a: Any): Unit
header fun g(s: String)
^
compiler/testData/multiplatform/missingOverload/jvm.kt:1:12: error: 'impl' class 'Foo' has no implementations of 'header' class members:
public final header fun f(a: Any): Unit
The following declaration is incompatible because parameter types are different:
public final impl fun f(s: String): Unit
impl class Foo {
^
@@ -96,6 +96,12 @@ public class MultiPlatformIntegrationTestGenerated extends AbstractMultiPlatform
doTest(fileName); doTest(fileName);
} }
@TestMetadata("missingOverload")
public void testMissingOverload() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/multiplatform/missingOverload/");
doTest(fileName);
}
@TestMetadata("simple") @TestMetadata("simple")
public void testSimple() throws Exception { public void testSimple() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/multiplatform/simple/"); String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/multiplatform/simple/");
@@ -1,3 +1,3 @@
header class <error descr="[HEADER_WITHOUT_IMPLEMENTATION] Header declaration 'My' has no implementation in module jvm for JVM">My</error> { header class <error descr="[HEADER_WITHOUT_IMPLEMENTATION] 'header' class 'My' has no implementation in module jvm for JVM">My</error> {
} }
@@ -1,8 +1,8 @@
<error descr="[IMPLEMENTATION_WITHOUT_HEADER] Modifier 'impl' is only applicable to members that are initially declared in platform-independent code">impl</error> class Your { impl class <error descr="[IMPLEMENTATION_WITHOUT_HEADER] 'impl' class 'Your' has no corresponding 'header' declaration">Your</error> {
} }
header class <error descr="[HEADER_WITHOUT_IMPLEMENTATION] Header declaration 'His' has no implementation in module jvm for JVM">His</error> { header class <error descr="[HEADER_WITHOUT_IMPLEMENTATION] 'header' class 'His' has no implementation in module jvm for JVM">His</error> {
} }
@@ -12,4 +12,4 @@ header class Their {
impl class Their { impl class Their {
} }
@@ -1,4 +1,4 @@
header class <error>My</error> { header class My {
fun foo(): Int fun foo(): Int
@@ -6,7 +6,7 @@ header class <error>My</error> {
} }
header class <error>Your</error> { header class Your {
fun foo(): Int fun foo(): Int
@@ -20,4 +20,4 @@ header class His {
fun bar(arg: Int): Boolean fun bar(arg: Int): Boolean
} }
@@ -1,13 +1,13 @@
<error descr="[IMPLEMENTATION_WITHOUT_HEADER] Modifier 'impl' is only applicable to members that are initially declared in platform-independent code">impl</error> class My { impl class <error>My</error> {
<error descr="[IMPLEMENTATION_WITHOUT_HEADER] Modifier 'impl' is only applicable to members that are initially declared in platform-independent code">impl</error> fun foo() = 42 <error>impl fun foo()</error> = 42
} }
<error descr="[IMPLEMENTATION_WITHOUT_HEADER] Modifier 'impl' is only applicable to members that are initially declared in platform-independent code">impl</error> class Your { impl class <error>Your</error> {
<error descr="[IMPLEMENTATION_WITHOUT_HEADER] Modifier 'impl' is only applicable to members that are initially declared in platform-independent code">impl</error> fun foo() = 13 <error>impl fun foo()</error> = 13
<error descr="[IMPLEMENTATION_WITHOUT_HEADER] Modifier 'impl' is only applicable to members that are initially declared in platform-independent code">impl</error> fun bar(arg: Int) = arg <error>impl fun bar(arg: Int)</error> = arg
} }
@@ -17,4 +17,4 @@ impl class His {
impl fun bar(arg: Int) = arg == foo() impl fun bar(arg: Int) = arg == foo()
} }
@@ -1,3 +1,3 @@
header class <error descr="[HEADER_WITHOUT_IMPLEMENTATION] Header declaration 'My' has no implementation in module js for JS"><error descr="[HEADER_WITHOUT_IMPLEMENTATION] Header declaration 'My' has no implementation in module jvm for JVM">My</error></error> { header class <error descr="[HEADER_WITHOUT_IMPLEMENTATION] 'header' class 'My' has no implementation in module js for JS"><error descr="[HEADER_WITHOUT_IMPLEMENTATION] 'header' class 'My' has no implementation in module jvm for JVM">My</error></error> {
} }
@@ -4,4 +4,4 @@
header interface Event header interface Event
@Suppress("SOMETHING_WRONG") @Suppress("SOMETHING_WRONG")
header class <error descr="[HEADER_WITHOUT_IMPLEMENTATION] Header declaration 'Wrong' has no implementation in module jvm for JVM">Wrong</error> header class <error descr="[HEADER_WITHOUT_IMPLEMENTATION] 'header' class 'Wrong' has no implementation in module jvm for JVM">Wrong</error>
+2 -2
View File
@@ -1,9 +1,9 @@
// "Implement members" "true" // "Implement members" "true"
// WITH_RUNTIME // WITH_RUNTIME
// ERROR: Header declaration 'InterfaceWithFuns' has no implementation in module light_idea_test_case for JVM // ERROR: 'header' interface 'InterfaceWithFuns' has no implementation in module light_idea_test_case for JVM
header interface InterfaceWithFuns { header interface InterfaceWithFuns {
fun funInInterface() fun funInInterface()
} }
class <caret>ChildOfInterface : InterfaceWithFuns{ class <caret>ChildOfInterface : InterfaceWithFuns{
} }
+2 -2
View File
@@ -1,6 +1,6 @@
// "Implement members" "true" // "Implement members" "true"
// WITH_RUNTIME // WITH_RUNTIME
// ERROR: Header declaration 'InterfaceWithFuns' has no implementation in module light_idea_test_case for JVM // ERROR: 'header' interface 'InterfaceWithFuns' has no implementation in module light_idea_test_case for JVM
header interface InterfaceWithFuns { header interface InterfaceWithFuns {
fun funInInterface() fun funInInterface()
} }
@@ -9,4 +9,4 @@ class ChildOfInterface : InterfaceWithFuns{
override fun funInInterface() { override fun funInInterface() {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates. TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
} }
} }