Migration to expect/actual: fix multiplatform integration tests

This commit is contained in:
Mikhail Glukhikh
2017-09-15 10:44:43 +03:00
parent 27615209ed
commit 85d6a4d1af
65 changed files with 394 additions and 394 deletions
@@ -1,3 +1,3 @@
header class Foo {
expect class Foo {
constructor(s: String)
}
@@ -1,3 +1,3 @@
impl class Foo {
impl constructor(s: Array<String>)
actual class Foo {
actual constructor(s: Array<String>)
}
@@ -5,9 +5,9 @@ Output:
-- JVM --
Exit code: COMPILATION_ERROR
Output:
compiler/testData/multiplatform/classScopes/constructorIncorrectSignature/jvm.kt:2:10: error: 'impl' constructor of 'Foo' has no corresponding 'header' declaration
compiler/testData/multiplatform/classScopes/constructorIncorrectSignature/jvm.kt:2:12: error: 'impl' constructor of 'Foo' has no corresponding 'header' declaration
The following declaration is incompatible because parameter types are different:
public constructor Foo(s: String)
impl constructor(s: Array<String>)
^
actual constructor(s: Array<String>)
^
@@ -1,3 +1,3 @@
header enum class AB { A, B }
expect enum class AB { A, B }
header enum class CD { C, D }
expect enum class CD { C, D }
@@ -1,3 +1,3 @@
impl enum class AB { A, C }
actual enum class AB { A, C }
impl enum class CD { C }
actual enum class CD { C }
@@ -5,15 +5,15 @@ Output:
-- JVM --
Exit code: COMPILATION_ERROR
Output:
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 header enum class AB : Enum<AB>
compiler/testData/multiplatform/classScopes/enumsWithDifferentEntries/jvm.kt:1:19: error: 'impl' enum class 'AB' has no corresponding 'header' declaration
The following declaration is incompatible because some entries from expected enum are missing in the actual enum:
public final expect enum class AB : Enum<AB>
impl enum class AB { A, 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>
actual enum class AB { A, C }
^
compiler/testData/multiplatform/classScopes/enumsWithDifferentEntries/jvm.kt:3:19: error: 'impl' enum class 'CD' has no corresponding 'header' declaration
The following declaration is incompatible because some entries from expected enum are missing in the actual enum:
public final expect enum class CD : Enum<CD>
impl enum class CD { C }
^
actual enum class CD { C }
^
@@ -1,7 +1,7 @@
header open class Base {
expect open class Base {
fun base()
}
header class Derived : Base {
expect class Derived : Base {
fun derived()
}
@@ -1,7 +1,7 @@
impl open class Base {
impl fun base() {}
actual open class Base {
actual fun base() {}
}
impl class Derived : Base() {
impl fun derived() {}
actual class Derived : Base() {
actual fun derived() {}
}
@@ -1,3 +1,3 @@
header class Foo {
expect class Foo {
fun function(b: ByteArray): Int
}
@@ -1,3 +1,3 @@
impl class Foo {
impl fun function(b: ByteArray): Long = b.size.toLong()
actual class Foo {
actual fun function(b: ByteArray): Long = b.size.toLong()
}
@@ -7,7 +7,7 @@ Exit code: COMPILATION_ERROR
Output:
compiler/testData/multiplatform/classScopes/functionIncorrectSignature/jvm.kt:2:5: error: 'impl' function 'function' has no corresponding 'header' declaration
The following declaration is incompatible because return type is different:
public final header fun function(b: ByteArray): Int
public final expect fun function(b: ByteArray): Int
impl fun function(b: ByteArray): Long = b.size.toLong()
actual fun function(b: ByteArray): Long = b.size.toLong()
^
@@ -1,3 +1,3 @@
header class Foo {
expect class Foo {
fun function(b: ByteArray): Int
}
@@ -2,4 +2,4 @@ open class Base {
fun function(b: ByteArray): Long = b.size.toLong()
}
impl class Foo : Base()
actual class Foo : Base()
@@ -5,12 +5,12 @@ Output:
-- JVM --
Exit code: COMPILATION_ERROR
Output:
compiler/testData/multiplatform/classScopes/functionIncorrectSignatureFromSuperclass/jvm.kt:5:12: error: 'impl' class 'Foo' has no implementation of 'header' class members:
compiler/testData/multiplatform/classScopes/functionIncorrectSignatureFromSuperclass/jvm.kt:5:14: error: 'impl' class 'Foo' has no implementation of 'header' class members:
public final header fun function(b: ByteArray): Int
public final expect fun function(b: ByteArray): Int
The following declaration is incompatible because return type is different:
public final fun function(b: ByteArray): Long
impl class Foo : Base()
^
actual class Foo : Base()
^
@@ -1,3 +1,3 @@
header class Foo {
expect class Foo {
constructor(s: String)
}
@@ -1 +1 @@
impl class Foo
actual class Foo
@@ -5,12 +5,12 @@ Output:
-- JVM --
Exit code: COMPILATION_ERROR
Output:
compiler/testData/multiplatform/classScopes/missingConstructor/jvm.kt:1:12: error: 'impl' class 'Foo' has no implementation of 'header' class members:
compiler/testData/multiplatform/classScopes/missingConstructor/jvm.kt:1:14: error: 'impl' class 'Foo' has no implementation of 'header' class members:
public constructor Foo(s: String)
The following declaration is incompatible because number of value parameters is different:
public constructor Foo()
impl class Foo
^
actual class Foo
^
@@ -1,3 +1,3 @@
header class Foo {
expect class Foo {
fun function(s: String)
}
@@ -1 +1 @@
impl class Foo
actual class Foo
@@ -5,9 +5,9 @@ Output:
-- JVM --
Exit code: COMPILATION_ERROR
Output:
compiler/testData/multiplatform/classScopes/missingFunction/jvm.kt:1:12: error: 'impl' class 'Foo' has no implementation of 'header' class members:
compiler/testData/multiplatform/classScopes/missingFunction/jvm.kt:1:14: error: 'impl' class 'Foo' has no implementation of 'header' class members:
public final header fun function(s: String): Unit
public final expect fun function(s: String): Unit
impl class Foo
^
actual class Foo
^
@@ -1,4 +1,4 @@
header class Foo(param: String) {
expect class Foo(param: String) {
var property: Int
fun <T> function(p: List<T>): T
+3 -3
View File
@@ -1,5 +1,5 @@
impl class Foo impl constructor(param: String) {
impl var property: Int = param.length
actual class Foo actual constructor(param: String) {
actual var property: Int = param.length
impl fun <T> function(p: List<T>): T = p.first()
actual fun <T> function(p: List<T>): T = p.first()
}