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()
}
@@ -1,2 +1,2 @@
header val bar: String
expect val bar: String
@@ -1 +1 @@
impl val bar = "Hello"
actual val bar = "Hello"
@@ -4,6 +4,6 @@ fun f(g: suspend () -> Unit): Any = g
suspend fun h() = f { }
header suspend fun k()
expect suspend fun k()
header fun l(g: suspend () -> Unit): Any
expect fun l(g: suspend () -> Unit): Any
@@ -1 +1 @@
header class Foo
expect class Foo
@@ -1,5 +1,5 @@
impl class Foo(x: Int) {
impl constructor() : this(0)
actual class Foo(x: Int) {
actual constructor() : this(0)
val x: Int = x
}
@@ -1,13 +1,13 @@
header fun <T> f1(): T
expect fun <T> f1(): T
header fun <T> f2(t: T)
expect fun <T> f2(t: T)
header fun <K : Enum<K>, V : MutableList<out K>> f3(v: Map<V, Enum<in K>>, w: Comparable<*>)
expect fun <K : Enum<K>, V : MutableList<out K>> f3(v: Map<V, Enum<in K>>, w: Comparable<*>)
header fun <T: Comparable<T>> Array<out T>.sort(): Unit
expect fun <T: Comparable<T>> Array<out T>.sort(): Unit
header class C1<A>
header class C2<B : C2<B>>
header class C3<D, E : MutableList<in D>>
expect class C1<A>
expect class C2<B : C2<B>>
expect class C3<D, E : MutableList<in D>>
header abstract class AbstractList<F> : MutableList<F>
expect abstract class AbstractList<F> : MutableList<F>
+8 -8
View File
@@ -1,15 +1,15 @@
impl fun <T> f1(): T = throw AssertionError()
actual fun <T> f1(): T = throw AssertionError()
impl fun <T> f2(t: T) {}
actual fun <T> f2(t: T) {}
impl fun <K : Enum<K>, V : MutableList<out K>> f3(v: Map<V, Enum<in K>>, w: Comparable<*>) {}
actual fun <K : Enum<K>, V : MutableList<out K>> f3(v: Map<V, Enum<in K>>, w: Comparable<*>) {}
impl fun <T: Comparable<T>> Array<out T>.sort(): Unit {
actual fun <T: Comparable<T>> Array<out T>.sort(): Unit {
java.util.Arrays.sort(this)
}
impl class C1<A>
impl class C2<B : C2<B>>
impl class C3<D, E : MutableList<in D>>
actual class C1<A>
actual class C2<B : C2<B>>
actual class C3<D, E : MutableList<in D>>
impl abstract class AbstractList<F> : MutableList<F>, java.io.Serializable
actual abstract class AbstractList<F> : MutableList<F>, java.io.Serializable
@@ -1,3 +1,3 @@
class Foo(val a: A? = null)
header class A
expect class A
@@ -1,4 +1,4 @@
impl typealias A = AImpl
actual typealias A = AImpl
class AImpl {
fun jvm(): A = this
@@ -1,3 +1,3 @@
header class C1<A> {
expect class C1<A> {
fun foo(a: A): List<A>?
}
@@ -1,4 +1,4 @@
impl typealias C1<A> = C1Impl<A>
actual typealias C1<A> = C1Impl<A>
class C1Impl<A> {
fun foo(a: A): List<A>? = null
}
@@ -1,3 +1,3 @@
header class ByTypeAlias {
expect class ByTypeAlias {
interface Nested
}
@@ -2,4 +2,4 @@ class ByTypeAliasImpl {
interface Nested
}
impl typealias ByTypeAlias = ByTypeAliasImpl
actual typealias ByTypeAlias = ByTypeAliasImpl
@@ -1,34 +1,34 @@
header fun f1()
expect fun f1()
header fun f2(name: String)
expect fun f2(name: String)
header fun f3(name: String)
header fun String.f3ext()
expect fun f3(name: String)
expect fun String.f3ext()
header fun f4(name: String)
expect fun f4(name: String)
header fun String.f5()
expect fun String.f5()
header fun f6(p1: String, p2: Int)
expect fun f6(p1: String, p2: Int)
header fun <T> f7()
expect fun <T> f7()
internal header fun f8()
private header fun f9()
public header fun f10()
internal expect fun f8()
private expect fun f9()
public expect fun f10()
header fun <T : Number> f11()
header fun <U : MutableList<String>> f12()
header fun <A, B : Comparable<A>> f13()
expect fun <T : Number> f11()
expect fun <U : MutableList<String>> f12()
expect fun <A, B : Comparable<A>> f13()
header inline fun <X> f14()
header inline fun <reified Y> f15()
expect inline fun <X> f14()
expect inline fun <reified Y> f15()
header fun f16(s: String)
expect fun f16(s: String)
header fun f17(vararg s: String)
header fun f18(s: Array<out String>)
header inline fun f19(s: () -> Unit)
header inline fun f20(s: () -> Unit)
header fun f21(c: suspend Unit.() -> Unit)
header fun f22(c: Unit.() -> Unit)
expect fun f17(vararg s: String)
expect fun f18(s: Array<out String>)
expect inline fun f19(s: () -> Unit)
expect inline fun f20(s: () -> Unit)
expect fun f21(c: suspend Unit.() -> Unit)
expect fun f22(c: Unit.() -> Unit)
+23 -23
View File
@@ -1,34 +1,34 @@
impl fun f1(): String = ""
actual fun f1(): String = ""
impl fun f2(otherName: String) {}
actual fun f2(otherName: String) {}
impl fun f3(name: Double) {}
impl fun Double.f3ext() {}
actual fun f3(name: Double) {}
actual fun Double.f3ext() {}
impl fun String.f4() {}
actual fun String.f4() {}
impl fun f5(name: String) {}
actual fun f5(name: String) {}
impl fun f6(p2: Int) {}
actual fun f6(p2: Int) {}
impl fun <K, V> f7() {}
actual fun <K, V> f7() {}
public impl fun f8() {}
internal impl fun f9() {}
private impl fun f10() {}
public actual fun f8() {}
internal actual fun f9() {}
private actual fun f10() {}
impl fun <T : Annotation> f11() {}
impl fun <U : MutableList<out String>> f12() {}
impl fun <A, B : Comparable<B>> f13() {}
actual fun <T : Annotation> f11() {}
actual fun <U : MutableList<out String>> f12() {}
actual fun <A, B : Comparable<B>> f13() {}
impl inline fun <reified X> f14() {}
impl inline fun <Y> f15() {}
actual inline fun <reified X> f14() {}
actual inline fun <Y> f15() {}
impl fun f16(s: String = "") {}
actual fun f16(s: String = "") {}
impl fun f17(s: Array<out String>) {}
impl fun f18(vararg s: String) {}
impl inline fun f19(crossinline s: () -> Unit) {}
impl inline fun f20(noinline s: () -> Unit) {}
impl fun f21(c: Unit.() -> Unit) {}
impl fun f22(c: suspend Unit.() -> Unit) {}
actual fun f17(s: Array<out String>) {}
actual fun f18(vararg s: String) {}
actual inline fun f19(crossinline s: () -> Unit) {}
actual inline fun f20(noinline s: () -> Unit) {}
actual fun f21(c: Unit.() -> Unit) {}
actual fun f22(c: suspend Unit.() -> Unit) {}
@@ -2,7 +2,7 @@
Exit code: OK
Output:
compiler/testData/multiplatform/incompatibleCallables/common.kt:33:19: warning: the feature "coroutines" is experimental (see: https://kotlinlang.org/docs/diagnostics/experimental-coroutines)
header fun f21(c: suspend Unit.() -> Unit)
expect fun f21(c: suspend Unit.() -> Unit)
^
-- JVM --
@@ -10,115 +10,115 @@ Exit code: COMPILATION_ERROR
Output:
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:1:1: error: 'impl' function 'f1' has no corresponding 'header' declaration
The following declaration is incompatible because return type is different:
public header fun f1(): Unit
public expect fun f1(): Unit
impl fun f1(): String = ""
actual fun f1(): String = ""
^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:3:1: error: 'impl' function 'f2' has no corresponding 'header' declaration
The following declaration is incompatible because parameter names are different:
public header fun f2(name: String): Unit
public expect fun f2(name: String): Unit
impl fun f2(otherName: String) {}
actual fun f2(otherName: String) {}
^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:5:1: error: 'impl' function 'f3' has no corresponding 'header' declaration
The following declaration is incompatible because parameter types are different:
public header fun f3(name: String): Unit
public expect fun f3(name: String): Unit
impl fun f3(name: Double) {}
actual fun f3(name: Double) {}
^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:6:1: error: 'impl' function 'f3ext' has no corresponding 'header' declaration
The following declaration is incompatible because parameter types are different:
public header fun String.f3ext(): Unit
public expect fun String.f3ext(): Unit
impl fun Double.f3ext() {}
actual fun Double.f3ext() {}
^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:8:1: error: 'impl' function 'f4' has no corresponding 'header' declaration
The following declaration is incompatible because parameter shapes are different (extension vs non-extension):
public header fun f4(name: String): Unit
public expect fun f4(name: String): Unit
impl fun String.f4() {}
actual fun String.f4() {}
^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:10:1: error: 'impl' function 'f5' has no corresponding 'header' declaration
The following declaration is incompatible because parameter shapes are different (extension vs non-extension):
public header fun String.f5(): Unit
public expect fun String.f5(): Unit
impl fun f5(name: String) {}
actual fun f5(name: String) {}
^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:12:1: error: 'impl' function 'f6' has no corresponding 'header' declaration
The following declaration is incompatible because number of value parameters is different:
public header fun f6(p1: String, p2: Int): Unit
public expect fun f6(p1: String, p2: Int): Unit
impl fun f6(p2: Int) {}
actual fun f6(p2: Int) {}
^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:14:1: error: 'impl' function 'f7' has no corresponding 'header' declaration
The following declaration is incompatible because number of type parameters is different:
public header fun <T> f7(): Unit
public expect fun <T> f7(): Unit
impl fun <K, V> f7() {}
actual fun <K, V> f7() {}
^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:16:1: error: 'impl' function 'f8' has no corresponding 'header' declaration
The following declaration is incompatible because visibility is different:
internal header fun f8(): Unit
internal expect fun f8(): Unit
public impl fun f8() {}
public actual fun f8() {}
^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:17:1: error: 'impl' function 'f9' has no corresponding 'header' declaration
The following declaration is incompatible because visibility is different:
private header fun f9(): Unit
private expect fun f9(): Unit
internal impl fun f9() {}
internal actual fun f9() {}
^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:18:1: error: 'impl' function 'f10' has no corresponding 'header' declaration
The following declaration is incompatible because visibility is different:
public header fun f10(): Unit
public expect fun f10(): Unit
private impl fun f10() {}
private actual fun f10() {}
^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:24:1: error: 'impl' function 'f14' has no corresponding 'header' declaration
The following declaration is incompatible because some type parameter is reified in one declaration and non-reified in the other:
public header inline fun <X> f14(): Unit
public expect inline fun <X> f14(): Unit
impl inline fun <reified X> f14() {}
actual inline fun <reified X> f14() {}
^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:27:1: error: 'impl' function 'f16' has no corresponding 'header' declaration
The following declaration is incompatible because some parameters have default values:
public header fun f16(s: String): Unit
public expect fun f16(s: String): Unit
impl fun f16(s: String = "") {}
actual fun f16(s: String = "") {}
^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:29:1: error: 'impl' function 'f17' has no corresponding 'header' declaration
The following declaration is incompatible because some value parameter is vararg in one declaration and non-vararg in the other:
public header fun f17(vararg s: String): Unit
public expect fun f17(vararg s: String): Unit
impl fun f17(s: Array<out String>) {}
actual fun f17(s: Array<out String>) {}
^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:30:1: error: 'impl' function 'f18' has no corresponding 'header' declaration
The following declaration is incompatible because some value parameter is vararg in one declaration and non-vararg in the other:
public header fun f18(s: Array<out String>): Unit
public expect fun f18(s: Array<out String>): Unit
impl fun f18(vararg s: String) {}
actual fun f18(vararg s: String) {}
^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:31:1: error: 'impl' function 'f19' has no corresponding 'header' declaration
The following declaration is incompatible because some value parameter is crossinline in one declaration and not crossinline in the other:
public header inline fun f19(s: () -> Unit): Unit
public expect inline fun f19(s: () -> Unit): Unit
impl inline fun f19(crossinline s: () -> Unit) {}
actual inline fun f19(crossinline s: () -> Unit) {}
^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:32:1: error: 'impl' function 'f20' has no corresponding 'header' declaration
The following declaration is incompatible because some value parameter is noinline in one declaration and not noinline in the other:
public header inline fun f20(s: () -> Unit): Unit
public expect inline fun f20(s: () -> Unit): Unit
impl inline fun f20(noinline s: () -> Unit) {}
actual inline fun f20(noinline s: () -> Unit) {}
^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:33:1: error: 'impl' function 'f21' has no corresponding 'header' declaration
The following declaration is incompatible because parameter types are different:
public header fun f21(c: suspend Unit.() -> Unit): Unit
public expect fun f21(c: suspend Unit.() -> Unit): Unit
impl fun f21(c: Unit.() -> Unit) {}
actual fun f21(c: Unit.() -> Unit) {}
^
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:34:1: error: 'impl' function 'f22' has no corresponding 'header' declaration
The following declaration is incompatible because parameter types are different:
public header fun f22(c: Unit.() -> Unit): Unit
public expect fun f22(c: Unit.() -> Unit): Unit
impl fun f22(c: suspend Unit.() -> Unit) {}
actual fun f22(c: suspend Unit.() -> Unit) {}
^
+16 -16
View File
@@ -1,22 +1,22 @@
header class PClass
header interface PInterface
header object PObject
header enum class PEnumClass
header annotation class PAnnotationClass
expect class PClass
expect interface PInterface
expect object PObject
expect enum class PEnumClass
expect annotation class PAnnotationClass
internal header object InternalObject
public header object PublicObject
private header object PrivateObject
internal expect object InternalObject
public expect object PublicObject
private expect object PrivateObject
open header class OpenClass
abstract header class AbstractClass
final header class FinalClass
open expect class OpenClass
abstract expect class AbstractClass
final expect class FinalClass
header class C1<A>
header class C2<B>
header class C3<D, E : D>
expect class C1<A>
expect class C2<B>
expect class C3<D, E : D>
header class C4<F>
expect class C4<F>
header abstract class ExtendsNumber : Number
expect abstract class ExtendsNumber : Number
+16 -16
View File
@@ -1,22 +1,22 @@
impl interface PClass
impl object PInterface
impl enum class PObject
impl annotation class PEnumClass
impl class PAnnotationClass
actual interface PClass
actual object PInterface
actual enum class PObject
actual annotation class PEnumClass
actual class PAnnotationClass
private impl object InternalObject
internal impl object PublicObject
public impl object PrivateObject
private actual object InternalObject
internal actual object PublicObject
public actual object PrivateObject
final impl class OpenClass
open impl class AbstractClass
abstract impl class FinalClass
final actual class OpenClass
open actual class AbstractClass
abstract actual class FinalClass
impl class C1<A, Extra>
impl class C2<out B>
impl class C3<D, E : D?>
actual class C1<A, Extra>
actual class C2<out B>
actual class C3<D, E : D?>
impl typealias C4<F> = C4Impl<F>
actual typealias C4<F> = C4Impl<F>
class C4Impl<F : Number>
impl abstract class ExtendsNumber : Any()
actual abstract class ExtendsNumber : Any()
@@ -5,87 +5,87 @@ Output:
-- JVM --
Exit code: COMPILATION_ERROR
Output:
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:1:16: error: 'impl' interface 'PClass' has no corresponding 'header' declaration
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:1:18: error: 'impl' interface 'PClass' has no corresponding 'header' declaration
The following declaration is incompatible because class kinds are different (class, interface, object, enum, annotation):
public final header class PClass
public final expect class PClass
impl interface PClass
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:2:6: error: 'impl' object 'PInterface' has no corresponding 'header' declaration
The following declaration is incompatible because class kinds are different (class, interface, object, enum, annotation):
public header interface PInterface
impl object PInterface
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:3:17: error: 'impl' enum class 'PObject' has no corresponding 'header' declaration
The following declaration is incompatible because class kinds are different (class, interface, object, enum, annotation):
public header object PObject
impl enum class PObject
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:4:23: error: 'impl' annotation class 'PEnumClass' has no corresponding 'header' declaration
The following declaration is incompatible because class kinds are different (class, interface, object, enum, annotation):
public final header enum class PEnumClass : Enum<PEnumClass>
impl annotation class PEnumClass
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:5:12: error: 'impl' class 'PAnnotationClass' has no corresponding 'header' declaration
The following declaration is incompatible because class kinds are different (class, interface, object, enum, annotation):
public final header annotation class PAnnotationClass : Annotation
impl class PAnnotationClass
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:7:14: error: 'impl' object 'InternalObject' has no corresponding 'header' declaration
The following declaration is incompatible because visibility is different:
internal header object InternalObject
private impl object InternalObject
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:8:15: error: 'impl' object 'PublicObject' has no corresponding 'header' declaration
The following declaration is incompatible because visibility is different:
public header object PublicObject
internal impl object PublicObject
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:9:13: error: 'impl' object 'PrivateObject' has no corresponding 'header' declaration
The following declaration is incompatible because visibility is different:
private header object PrivateObject
public impl object PrivateObject
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:11:18: error: 'impl' class 'OpenClass' has no corresponding 'header' declaration
The following declaration is incompatible because modality is different:
public open header class OpenClass
final impl class OpenClass
actual interface PClass
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:12:17: error: 'impl' class 'AbstractClass' has no corresponding 'header' declaration
The following declaration is incompatible because modality is different:
public abstract header class AbstractClass
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:2:8: error: 'impl' object 'PInterface' has no corresponding 'header' declaration
The following declaration is incompatible because class kinds are different (class, interface, object, enum, annotation):
public expect interface PInterface
open impl class AbstractClass
actual object PInterface
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:3:19: error: 'impl' enum class 'PObject' has no corresponding 'header' declaration
The following declaration is incompatible because class kinds are different (class, interface, object, enum, annotation):
public expect object PObject
actual enum class PObject
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:4:25: error: 'impl' annotation class 'PEnumClass' has no corresponding 'header' declaration
The following declaration is incompatible because class kinds are different (class, interface, object, enum, annotation):
public final expect enum class PEnumClass : Enum<PEnumClass>
actual annotation class PEnumClass
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:5:14: error: 'impl' class 'PAnnotationClass' has no corresponding 'header' declaration
The following declaration is incompatible because class kinds are different (class, interface, object, enum, annotation):
public final expect annotation class PAnnotationClass : Annotation
actual class PAnnotationClass
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:7:16: error: 'impl' object 'InternalObject' has no corresponding 'header' declaration
The following declaration is incompatible because visibility is different:
internal expect object InternalObject
private actual object InternalObject
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:8:17: error: 'impl' object 'PublicObject' has no corresponding 'header' declaration
The following declaration is incompatible because visibility is different:
public expect object PublicObject
internal actual object PublicObject
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:13:21: error: 'impl' class 'FinalClass' has no corresponding 'header' declaration
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:9:15: error: 'impl' object 'PrivateObject' has no corresponding 'header' declaration
The following declaration is incompatible because visibility is different:
private expect object PrivateObject
public actual object PrivateObject
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:11:20: error: 'impl' class 'OpenClass' has no corresponding 'header' declaration
The following declaration is incompatible because modality is different:
public final header class FinalClass
public open expect class OpenClass
abstract impl class FinalClass
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:15:12: error: 'impl' class 'C1' has no corresponding 'header' declaration
final actual class OpenClass
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:12:19: error: 'impl' class 'AbstractClass' has no corresponding 'header' declaration
The following declaration is incompatible because modality is different:
public abstract expect class AbstractClass
open actual class AbstractClass
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:13:23: error: 'impl' class 'FinalClass' has no corresponding 'header' declaration
The following declaration is incompatible because modality is different:
public final expect class FinalClass
abstract actual class FinalClass
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:15:14: error: 'impl' class 'C1' has no corresponding 'header' declaration
The following declaration is incompatible because number of type parameters is different:
public final header class C1<A>
public final expect class C1<A>
impl class C1<A, Extra>
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:16:12: error: 'impl' class 'C2' has no corresponding 'header' declaration
actual class C1<A, Extra>
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:16:14: error: 'impl' class 'C2' has no corresponding 'header' declaration
The following declaration is incompatible because declaration-site variances of type parameters are different:
public final header class C2<B>
public final expect class C2<B>
impl class C2<out B>
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:22:21: error: 'impl' class 'ExtendsNumber' has no corresponding 'header' declaration
The following declaration is incompatible because some supertypes are missing in the implementation:
public abstract header class ExtendsNumber : Number
actual class C2<out B>
^
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:22:23: error: 'impl' class 'ExtendsNumber' has no corresponding 'header' declaration
The following declaration is incompatible because some supertypes are missing in the actual declaration:
public abstract expect class ExtendsNumber : Number
impl abstract class ExtendsNumber : Any()
^
actual abstract class ExtendsNumber : Any()
^
@@ -1,9 +1,9 @@
header infix fun Int.plus(s: CharSequence): Int
expect infix fun Int.plus(s: CharSequence): Int
header operator fun Double.times(x: CharArray)
expect operator fun Double.times(x: CharArray)
header external fun f1()
expect external fun f1()
header inline fun f2()
expect inline fun f2()
header tailrec fun f3()
expect tailrec fun f3()
@@ -1,9 +1,9 @@
impl fun Int.plus(s: CharSequence): Int = 0
actual fun Int.plus(s: CharSequence): Int = 0
impl fun Double.times(x: CharArray) {}
actual fun Double.times(x: CharArray) {}
impl fun f1() {}
actual fun f1() {}
impl fun f2() {}
actual fun f2() {}
impl fun f3() {}
actual fun f3() {}
@@ -6,32 +6,32 @@ Output:
Exit code: COMPILATION_ERROR
Output:
compiler/testData/multiplatform/incompatibleFunctions/jvm.kt:1:1: error: 'impl' function 'plus' has no corresponding 'header' declaration
The following declaration is incompatible because some modifiers on header declaration are missing on the implementation (external, infix, inline, operator, tailrec):
public infix header fun Int.plus(s: CharSequence): Int
The following declaration is incompatible because some modifiers on expected declaration are missing on the actual one (external, infix, inline, operator, tailrec):
public infix expect fun Int.plus(s: CharSequence): Int
impl fun Int.plus(s: CharSequence): Int = 0
actual fun Int.plus(s: CharSequence): Int = 0
^
compiler/testData/multiplatform/incompatibleFunctions/jvm.kt:3:1: error: 'impl' function 'times' has no corresponding 'header' declaration
The following declaration is incompatible because some modifiers on header declaration are missing on the implementation (external, infix, inline, operator, tailrec):
public operator header fun Double.times(x: CharArray): Unit
The following declaration is incompatible because some modifiers on expected declaration are missing on the actual one (external, infix, inline, operator, tailrec):
public operator expect fun Double.times(x: CharArray): Unit
impl fun Double.times(x: CharArray) {}
actual fun Double.times(x: CharArray) {}
^
compiler/testData/multiplatform/incompatibleFunctions/jvm.kt:5:1: error: 'impl' function 'f1' has no corresponding 'header' declaration
The following declaration is incompatible because some modifiers on header declaration are missing on the implementation (external, infix, inline, operator, tailrec):
public external header fun f1(): Unit
The following declaration is incompatible because some modifiers on expected declaration are missing on the actual one (external, infix, inline, operator, tailrec):
public external expect fun f1(): Unit
impl fun f1() {}
actual fun f1() {}
^
compiler/testData/multiplatform/incompatibleFunctions/jvm.kt:7:1: error: 'impl' function 'f2' has no corresponding 'header' declaration
The following declaration is incompatible because some modifiers on header declaration are missing on the implementation (external, infix, inline, operator, tailrec):
public header inline fun f2(): Unit
The following declaration is incompatible because some modifiers on expected declaration are missing on the actual one (external, infix, inline, operator, tailrec):
public expect inline fun f2(): Unit
impl fun f2() {}
actual fun f2() {}
^
compiler/testData/multiplatform/incompatibleFunctions/jvm.kt:9:1: error: 'impl' function 'f3' has no corresponding 'header' declaration
The following declaration is incompatible because some modifiers on header declaration are missing on the implementation (external, infix, inline, operator, tailrec):
public header tailrec fun f3(): Unit
The following declaration is incompatible because some modifiers on expected declaration are missing on the actual one (external, infix, inline, operator, tailrec):
public expect tailrec fun f3(): Unit
impl fun f3() {}
actual fun f3() {}
^
@@ -1,19 +1,19 @@
header class O1 {
expect class O1 {
class N1
interface N2
object N3
}
header class O2 {
expect class O2 {
class N2
inner class I2
}
header class O3 {
expect class O3 {
object Companion
companion object Factory
}
header class O4 {
expect class O4 {
companion object
}
@@ -1,19 +1,19 @@
impl class O1 {
impl interface N1
impl object N2
impl class N3
actual class O1 {
actual interface N1
actual object N2
actual class N3
}
impl class O2 {
impl inner class N2
impl class I2
actual class O2 {
actual inner class N2
actual class I2
}
impl class O3 {
impl companion object {}
impl object Factory
actual class O3 {
actual companion object {}
actual object Factory
}
impl class O4 {
impl object Companion
actual class O4 {
actual object Companion
}
@@ -5,51 +5,51 @@ Output:
-- JVM --
Exit code: COMPILATION_ERROR
Output:
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:2:20: error: 'impl' interface 'N1' has no corresponding 'header' declaration
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:2:22: 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 final header class N1
public final expect class N1
impl interface N1
^
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
actual interface N1
^
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
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:3:12: 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 expect interface N2
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
actual object N2
^
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:4:18: 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 expect object N3
impl companion object {}
^
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:14:10: error: 'impl' object 'Factory' has no corresponding 'header' declaration
actual class N3
^
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:8:24: error: 'impl' class 'N2' has no corresponding 'header' declaration
The following declaration is incompatible because modifiers are different (companion, inner):
public header companion object Factory
public final expect class N2
impl object Factory
^
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:18:10: error: 'impl' object 'Companion' has no corresponding 'header' declaration
actual inner class N2
^
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:9:18: error: 'impl' class 'I2' has no corresponding 'header' declaration
The following declaration is incompatible because modifiers are different (companion, inner):
public header companion object
public final expect inner class I2
impl object Companion
^
actual class I2
^
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:13:22: error: 'impl' companion object 'Companion' has no corresponding 'header' declaration
The following declaration is incompatible because modifiers are different (companion, inner):
public expect object Companion
actual companion object {}
^
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:14:12: error: 'impl' object 'Factory' has no corresponding 'header' declaration
The following declaration is incompatible because modifiers are different (companion, inner):
public expect companion object Factory
actual object Factory
^
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:18:12: error: 'impl' object 'Companion' has no corresponding 'header' declaration
The following declaration is incompatible because modifiers are different (companion, inner):
public expect companion object
actual object Companion
^
@@ -1,2 +1,2 @@
header val pval: String
header var pvar: String
expect val pval: String
expect var pvar: String
@@ -1,2 +1,2 @@
impl var pval: String = ""
impl val pvar: String = ""
actual var pval: String = ""
actual val pvar: String = ""
@@ -7,13 +7,13 @@ Exit code: COMPILATION_ERROR
Output:
compiler/testData/multiplatform/incompatibleProperties/jvm.kt:1:1: error: 'impl' property 'pval' has no corresponding 'header' declaration
The following declaration is incompatible because property kinds are different (val vs var):
public header val pval: String
public expect val pval: String
impl var pval: String = ""
actual var pval: String = ""
^
compiler/testData/multiplatform/incompatibleProperties/jvm.kt:2:1: error: 'impl' property 'pvar' has no corresponding 'header' declaration
The following declaration is incompatible because property kinds are different (val vs var):
public header var pvar: String
public expect var pvar: String
impl val pvar: String = ""
actual val pvar: String = ""
^
@@ -1 +1 @@
header class Foo
expect class Foo
@@ -1,9 +1,9 @@
impl class Foo impl constructor() {
impl constructor(s: String) : this()
actual class Foo actual constructor() {
actual constructor(s: String) : this()
impl fun nonPlatformFun() {}
actual fun nonPlatformFun() {}
impl val nonPlatformVal = ""
actual val nonPlatformVal = ""
private fun nonImplFun() {}
private val nonImplVal = ""
@@ -5,15 +5,15 @@ Output:
-- JVM --
Exit code: COMPILATION_ERROR
Output:
compiler/testData/multiplatform/incorrectImplInClass/jvm.kt:2:10: error: 'impl' constructor of 'Foo' has no corresponding 'header' declaration
compiler/testData/multiplatform/incorrectImplInClass/jvm.kt:2:12: error: 'impl' constructor of 'Foo' has no corresponding 'header' declaration
The following declaration is incompatible because number of value parameters is different:
public constructor Foo()
impl constructor(s: String) : this()
^
actual constructor(s: String) : this()
^
compiler/testData/multiplatform/incorrectImplInClass/jvm.kt:4:5: error: 'impl' function 'nonPlatformFun' has no corresponding 'header' declaration
impl fun nonPlatformFun() {}
actual fun nonPlatformFun() {}
^
compiler/testData/multiplatform/incorrectImplInClass/jvm.kt:6:5: error: 'impl' property 'nonPlatformVal' has no corresponding 'header' declaration
impl val nonPlatformVal = ""
actual val nonPlatformVal = ""
^
+3 -3
View File
@@ -1,9 +1,9 @@
header class Foo {
expect class Foo {
fun f(s: String)
fun f(a: Any)
}
header fun g(s: String)
expect fun g(s: String)
header fun g(a: Any)
expect fun g(a: Any)
+3 -3
View File
@@ -1,5 +1,5 @@
impl class Foo {
impl fun f(s: String) {}
actual class Foo {
actual fun f(s: String) {}
}
impl fun g(a: Any) {}
actual fun g(a: Any) {}
+7 -7
View File
@@ -7,16 +7,16 @@ Exit code: COMPILATION_ERROR
Output:
compiler/testData/multiplatform/missingOverload/common.kt:7:1: error: 'header' function 'g' has no implementation in module
The following declaration is incompatible because parameter types are different:
public impl fun g(a: Any): Unit
public actual fun g(a: Any): Unit
header fun g(s: String)
expect fun g(s: String)
^
compiler/testData/multiplatform/missingOverload/jvm.kt:1:12: error: 'impl' class 'Foo' has no implementation of 'header' class members:
compiler/testData/multiplatform/missingOverload/jvm.kt:1:14: error: 'impl' class 'Foo' has no implementation of 'header' class members:
public final header fun f(a: Any): Unit
public final expect fun f(a: Any): Unit
The following declaration is incompatible because parameter types are different:
public final impl fun f(s: String): Unit
public final actual fun f(s: String): Unit
impl class Foo {
^
actual class Foo {
^
@@ -1,3 +1,3 @@
package test
header abstract class Writer protected constructor()
expect abstract class Writer protected constructor()
@@ -1,3 +1,3 @@
package test
impl typealias Writer = java.io.Writer
actual typealias Writer = java.io.Writer
@@ -14,5 +14,5 @@ compiler/testData/multiplatform/regressions/incompatibleClassScopesWithImplTypeA
The following declaration is incompatible because number of value parameters is different:
protected/*protected and package*/ constructor Writer(p0: Any!)
impl typealias Writer = java.io.Writer
actual typealias Writer = java.io.Writer
^
@@ -1,7 +1,7 @@
package test
header fun stringToByteArray(str: String): ByteArray
expect fun stringToByteArray(str: String): ByteArray
header var prop: String
expect var prop: String
fun ttt() {}
+2 -2
View File
@@ -1,5 +1,5 @@
package test
impl fun stringToByteArray(str: String): ByteArray = byteArrayOf()
actual fun stringToByteArray(str: String): ByteArray = byteArrayOf()
impl var prop: String = ""
actual var prop: String = ""
+1 -1
View File
@@ -1,4 +1,4 @@
header class Printer {
expect class Printer {
fun print(message: String)
}
+2 -2
View File
@@ -1,5 +1,5 @@
impl class Printer {
impl fun print(message: String) {
actual class Printer {
actual fun print(message: String) {
println("JS says: " + message)
}
}
+2 -2
View File
@@ -1,5 +1,5 @@
impl class Printer {
impl fun print(message: String) {
actual class Printer {
actual fun print(message: String) {
println("JVM says: " + message)
}
}
@@ -1,3 +1,3 @@
package test
header fun foo(s: String): Array<CharSequence?>
expect fun foo(s: String): Array<CharSequence?>