Forbid private 'expect' declarations
#KT-19170 Fixed
This commit is contained in:
@@ -14,7 +14,6 @@ expect fun f6(p1: String, p2: Int)
|
||||
expect fun <T> f7()
|
||||
|
||||
internal expect fun f8()
|
||||
private expect fun f9()
|
||||
public expect fun f10()
|
||||
|
||||
expect fun <T : Number> f11()
|
||||
|
||||
@@ -14,8 +14,7 @@ actual fun f6(p2: Int) {}
|
||||
actual fun <K, V> f7() {}
|
||||
|
||||
public actual fun f8() {}
|
||||
internal actual fun f9() {}
|
||||
private actual fun f10() {}
|
||||
internal actual fun f10() {}
|
||||
|
||||
actual fun <T : Annotation> f11() {}
|
||||
actual fun <U : MutableList<out String>> f12() {}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
-- Common --
|
||||
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)
|
||||
compiler/testData/multiplatform/incompatibleCallables/common.kt:32:19: warning: the feature "coroutines" is experimental (see: https://kotlinlang.org/docs/diagnostics/experimental-coroutines)
|
||||
expect fun f21(c: suspend Unit.() -> Unit)
|
||||
^
|
||||
|
||||
@@ -62,61 +62,55 @@ The following declaration is incompatible because visibility is different:
|
||||
|
||||
public actual fun f8() {}
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:17:1: error: actual function 'f9' has no corresponding expected declaration
|
||||
The following declaration is incompatible because visibility is different:
|
||||
private expect fun f9(): Unit
|
||||
|
||||
internal actual fun f9() {}
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:18:1: error: actual function 'f10' has no corresponding expected declaration
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:17:1: error: actual function 'f10' has no corresponding expected declaration
|
||||
The following declaration is incompatible because visibility is different:
|
||||
public expect fun f10(): Unit
|
||||
|
||||
private actual fun f10() {}
|
||||
internal actual fun f10() {}
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:24:19: error: actual function 'f14' has no corresponding expected declaration
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:23:19: error: actual function 'f14' has no corresponding expected declaration
|
||||
The following declaration is incompatible because some type parameter is reified in one declaration and non-reified in the other:
|
||||
public expect inline fun <X> f14(): Unit
|
||||
|
||||
actual inline fun <reified X> f14() {}
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:27:15: error: actual function 'f16' has no corresponding expected declaration
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:26:15: error: actual function 'f16' has no corresponding expected declaration
|
||||
The following declaration is incompatible because some parameters have default values:
|
||||
public expect fun f16(s: String): Unit
|
||||
|
||||
actual fun f16(s: String = "") {}
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:29:15: error: actual function 'f17' has no corresponding expected declaration
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:28:15: error: actual function 'f17' has no corresponding expected declaration
|
||||
The following declaration is incompatible because some value parameter is vararg in one declaration and non-vararg in the other:
|
||||
public expect fun f17(vararg s: String): Unit
|
||||
|
||||
actual fun f17(s: Array<out String>) {}
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:30:15: error: actual function 'f18' has no corresponding expected declaration
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:29:15: error: actual function 'f18' has no corresponding expected declaration
|
||||
The following declaration is incompatible because some value parameter is vararg in one declaration and non-vararg in the other:
|
||||
public expect fun f18(s: Array<out String>): Unit
|
||||
|
||||
actual fun f18(vararg s: String) {}
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:31:22: error: actual function 'f19' has no corresponding expected declaration
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:30:22: error: actual function 'f19' has no corresponding expected declaration
|
||||
The following declaration is incompatible because some value parameter is crossinline in one declaration and not crossinline in the other:
|
||||
public expect inline fun f19(s: () -> Unit): Unit
|
||||
|
||||
actual inline fun f19(crossinline s: () -> Unit) {}
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:32:22: error: actual function 'f20' has no corresponding expected declaration
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:31:22: error: actual function 'f20' has no corresponding expected declaration
|
||||
The following declaration is incompatible because some value parameter is noinline in one declaration and not noinline in the other:
|
||||
public expect inline fun f20(s: () -> Unit): Unit
|
||||
|
||||
actual inline fun f20(noinline s: () -> Unit) {}
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:33:15: error: actual function 'f21' has no corresponding expected declaration
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:32:15: error: actual function 'f21' has no corresponding expected declaration
|
||||
The following declaration is incompatible because parameter types are different:
|
||||
public expect fun f21(c: suspend Unit.() -> Unit): Unit
|
||||
|
||||
actual fun f21(c: Unit.() -> Unit) {}
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:34:15: error: actual function 'f22' has no corresponding expected declaration
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:33:15: error: actual function 'f22' has no corresponding expected declaration
|
||||
The following declaration is incompatible because parameter types are different:
|
||||
public expect fun f22(c: Unit.() -> Unit): Unit
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ expect annotation class PAnnotationClass
|
||||
|
||||
internal expect object InternalObject
|
||||
public expect object PublicObject
|
||||
private expect object PrivateObject
|
||||
|
||||
open expect class OpenClass
|
||||
abstract expect class AbstractClass
|
||||
|
||||
@@ -4,9 +4,8 @@ actual enum class PObject
|
||||
actual annotation class PEnumClass
|
||||
actual class PAnnotationClass
|
||||
|
||||
private actual object InternalObject
|
||||
internal actual object PublicObject
|
||||
public actual object PrivateObject
|
||||
public actual object InternalObject
|
||||
|
||||
final actual class OpenClass
|
||||
open actual class AbstractClass
|
||||
|
||||
+10
-16
@@ -35,55 +35,49 @@ The following declaration is incompatible because class kinds are different (cla
|
||||
|
||||
actual class PAnnotationClass
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:7:1: error: actual object 'InternalObject' has no corresponding expected 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:1: error: actual object 'PublicObject' has no corresponding expected declaration
|
||||
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:7:1: error: actual object 'PublicObject' has no corresponding expected declaration
|
||||
The following declaration is incompatible because visibility is different:
|
||||
public expect object PublicObject
|
||||
|
||||
internal actual object PublicObject
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:9:1: error: actual object 'PrivateObject' has no corresponding expected declaration
|
||||
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:8:1: error: actual object 'InternalObject' has no corresponding expected declaration
|
||||
The following declaration is incompatible because visibility is different:
|
||||
private expect object PrivateObject
|
||||
internal expect object InternalObject
|
||||
|
||||
public actual object PrivateObject
|
||||
public actual object InternalObject
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:11:1: error: actual class 'OpenClass' has no corresponding expected declaration
|
||||
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:10:1: error: actual class 'OpenClass' has no corresponding expected declaration
|
||||
The following declaration is incompatible because modality is different:
|
||||
public open expect class OpenClass
|
||||
|
||||
final actual class OpenClass
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:12:1: error: actual class 'AbstractClass' has no corresponding expected declaration
|
||||
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:11:1: error: actual class 'AbstractClass' has no corresponding expected 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:1: error: actual class 'FinalClass' has no corresponding expected declaration
|
||||
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:12:1: error: actual class 'FinalClass' has no corresponding expected 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:16: error: actual class 'C1' has no corresponding expected declaration
|
||||
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:14:16: error: actual class 'C1' has no corresponding expected declaration
|
||||
The following declaration is incompatible because number of type parameters is different:
|
||||
public final expect class C1<A>
|
||||
|
||||
actual class C1<A, Extra>
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:16:16: error: actual class 'C2' has no corresponding expected declaration
|
||||
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:15:16: error: actual class 'C2' has no corresponding expected declaration
|
||||
The following declaration is incompatible because declaration-site variances of type parameters are different:
|
||||
public final expect class C2<B>
|
||||
|
||||
actual class C2<out B>
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:22:39: error: actual class 'ExtendsNumber' has no corresponding expected declaration
|
||||
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:21:39: error: actual class 'ExtendsNumber' has no corresponding expected declaration
|
||||
The following declaration is incompatible because some supertypes are missing in the actual declaration:
|
||||
public abstract expect class ExtendsNumber : Number
|
||||
|
||||
|
||||
Reference in New Issue
Block a user