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
@@ -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 {
}
}
@@ -1,4 +1,4 @@
header class <error>My</error> {
header class My {
fun foo(): Int
@@ -6,7 +6,7 @@ header class <error>My</error> {
}
header class <error>Your</error> {
header class Your {
fun foo(): Int
@@ -20,4 +20,4 @@ header class His {
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()
}
}
@@ -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
@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>