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
@@ -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 {
^