Check platform<->impl declaration compatibility
For each platform declaration, there must be at least one impl declaration in the module with the compatible signature; similarly, for each impl declaration, there must be at least one platform declaration with the compatible signature. Note that currently the presence of the 'impl' modifier is not checked yet. Also, the sad fact is that if you have platform and impl declarations which are not compatible, you get two errors: on the platform delcaration and on the impl declaration. This needs to be addressed as well
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
platform val pval: String
|
||||
platform var pvar: String
|
||||
@@ -0,0 +1,2 @@
|
||||
impl var pval: String = ""
|
||||
impl val pvar: String = ""
|
||||
@@ -0,0 +1,26 @@
|
||||
-- Common --
|
||||
Exit code: OK
|
||||
Output:
|
||||
|
||||
-- JVM --
|
||||
Exit code: COMPILATION_ERROR
|
||||
Output:
|
||||
compiler/testData/multiplatform/incompatibleProperties/common.kt:1:1: error: no definition is found for platform declaration 'pval'
|
||||
The following declaration is incompatible because property kinds are different (val vs var):
|
||||
public var pval: String
|
||||
|
||||
platform val pval: String
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleProperties/common.kt:2:1: error: no definition is found for platform declaration 'pvar'
|
||||
The following declaration is incompatible because property kinds are different (val vs var):
|
||||
public val pvar: String
|
||||
|
||||
platform 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
|
||||
impl val pvar: String = ""
|
||||
^
|
||||
|
||||
Reference in New Issue
Block a user