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
-8
@@ -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>)
|
||||
^
|
||||
^
|
||||
|
||||
+8
-15
@@ -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 }
|
||||
^
|
||||
|
||||
+4
-7
@@ -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
|
||||
^
|
||||
^
|
||||
|
||||
Reference in New Issue
Block a user