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:
@@ -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
|
||||
^
|
||||
|
||||
Reference in New Issue
Block a user