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
@@ -5,9 +5,9 @@ Output:
-- JVM --
Exit code: COMPILATION_ERROR
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:
public final impl class Foo
public final header class Foo
No implementations are found for members listed below:
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:
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 {
^
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>)
^
^
@@ -5,22 +5,15 @@ Output:
-- JVM --
Exit code: COMPILATION_ERROR
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:
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 }
^
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
impl enum class CD { C }
^
^
compiler/testData/multiplatform/classScopes/enumsWithDifferentEntries/jvm.kt:3:17: error: 'impl' enum class 'CD' has no corresponding 'header' declaration
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 --
Exit code: COMPILATION_ERROR
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:
public final impl class Foo
public final header class Foo
No implementations are found for members listed below:
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:
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 {
^
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()
^
@@ -5,9 +5,9 @@ Output:
-- JVM --
Exit code: COMPILATION_ERROR
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:
public final impl class Foo
public final header class Foo
No implementations are found for members listed below:
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:
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
^
^
@@ -5,15 +5,12 @@ Output:
-- JVM --
Exit code: COMPILATION_ERROR
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:
public final impl class Foo
public final header class Foo
No implementations are found for members listed below:
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
^
^
@@ -5,6 +5,6 @@ Output:
-- JVM --
Exit code: COMPILATION_ERROR
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
^
@@ -11,202 +11,135 @@ header fun <A, B : Continuation<A>> f13()
-- JVM --
Exit code: COMPILATION_ERROR
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:
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 = ""
^
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) {}
^
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) {}
^
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() {}
^
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() {}
^
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) {}
^
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) {}
^
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() {}
^
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() {}
^
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() {}
^
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() {}
^
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() {}
^
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() {}
^
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 = "") {}
^
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>) {}
^
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) {}
^
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) {}
^
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) {}
^
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) {}
^
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) {}
^
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) {}
^
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) {}
^
+80 -123
View File
@@ -5,130 +5,87 @@ Output:
-- JVM --
Exit code: COMPILATION_ERROR
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):
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
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:2:1: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code
impl object 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()
^
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:2:6: error: 'impl' object 'PInterface' has no corresponding 'header' declaration
The following declaration is incompatible because class kinds are different (class, interface, object, enum, annotation):
public header interface PInterface
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 --
Exit code: COMPILATION_ERROR
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):
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
^
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) {}
^
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() {}
^
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() {}
^
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() {}
^
@@ -5,76 +5,51 @@ Output:
-- JVM --
Exit code: COMPILATION_ERROR
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):
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
^
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:3:5: error: modifier 'impl' is only applicable to members that are initially declared in platform-independent code
impl object 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
^
^
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:3:10: error: 'impl' object 'N2' has no corresponding 'header' declaration
The following declaration is incompatible because class kinds are different (class, interface, object, enum, annotation):
public header interface N2
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 --
Exit code: COMPILATION_ERROR
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):
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 = ""
^
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 = ""
^
@@ -5,13 +5,15 @@ Output:
-- JVM --
Exit code: COMPILATION_ERROR
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()
^
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() {}
^
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 = ""
^
@@ -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 {
^