Report NO_ACTUAL_FOR_EXPECT etc. on relevant declaration
So #KT-20398 Fixed
This commit is contained in:
@@ -578,10 +578,10 @@ public interface Errors {
|
||||
|
||||
DiagnosticFactory3<KtNamedDeclaration, MemberDescriptor, ModuleDescriptor,
|
||||
Map<Incompatible, Collection<MemberDescriptor>>> NO_ACTUAL_FOR_EXPECT =
|
||||
DiagnosticFactory3.create(ERROR, DECLARATION_SIGNATURE);
|
||||
DiagnosticFactory3.create(ERROR, INCOMPATIBLE_DECLARATION);
|
||||
DiagnosticFactory2<KtNamedDeclaration, MemberDescriptor,
|
||||
Map<Incompatible, Collection<MemberDescriptor>>> ACTUAL_WITHOUT_EXPECT =
|
||||
DiagnosticFactory2.create(ERROR, DECLARATION_SIGNATURE);
|
||||
DiagnosticFactory2.create(ERROR, INCOMPATIBLE_DECLARATION);
|
||||
|
||||
DiagnosticFactory2<KtNamedDeclaration, ClassDescriptor,
|
||||
List<Pair<MemberDescriptor, Map<Incompatible, Collection<MemberDescriptor>>>>> NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS =
|
||||
|
||||
@@ -21,13 +21,14 @@ import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.PsiNameIdentifierOwner
|
||||
import com.intellij.psi.tree.TokenSet
|
||||
import org.jetbrains.kotlin.KtNodeTypes
|
||||
import org.jetbrains.kotlin.diagnostics.Errors.ACTUAL_WITHOUT_EXPECT
|
||||
import org.jetbrains.kotlin.diagnostics.Errors.NO_ACTUAL_FOR_EXPECT
|
||||
import org.jetbrains.kotlin.lexer.KtModifierKeywordToken
|
||||
import org.jetbrains.kotlin.lexer.KtTokens
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.psiUtil.endOffset
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getElementTextWithContext
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType
|
||||
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
||||
import org.jetbrains.kotlin.psi.psiUtil.*
|
||||
import org.jetbrains.kotlin.resolve.checkers.ExpectedActualDeclarationChecker.Compatibility.Incompatible
|
||||
import org.jetbrains.kotlin.resolve.checkers.ExpectedActualDeclarationChecker.Compatibility.Incompatible.*
|
||||
import org.jetbrains.kotlin.utils.sure
|
||||
|
||||
object PositioningStrategies {
|
||||
@@ -107,6 +108,79 @@ object PositioningStrategies {
|
||||
}
|
||||
}
|
||||
|
||||
private val ParametrizedDiagnostic<out KtNamedDeclaration>.firstIncompatibility: Incompatible?
|
||||
get() {
|
||||
val map = when (factory) {
|
||||
NO_ACTUAL_FOR_EXPECT ->
|
||||
NO_ACTUAL_FOR_EXPECT.cast(this).c
|
||||
ACTUAL_WITHOUT_EXPECT ->
|
||||
ACTUAL_WITHOUT_EXPECT.cast(this).b
|
||||
else ->
|
||||
return null
|
||||
}
|
||||
return map.keys.firstOrNull()
|
||||
}
|
||||
|
||||
private val propertyKindTokens = TokenSet.create(KtTokens.VAL_KEYWORD, KtTokens.VAR_KEYWORD)
|
||||
|
||||
private val classKindTokens = TokenSet.create(KtTokens.CLASS_KEYWORD, KtTokens.OBJECT_KEYWORD, KtTokens.INTERFACE_KEYWORD)
|
||||
|
||||
@JvmField val INCOMPATIBLE_DECLARATION: PositioningStrategy<KtNamedDeclaration> = object : DeclarationHeader<KtNamedDeclaration>() {
|
||||
override fun markDiagnostic(diagnostic: ParametrizedDiagnostic<out KtNamedDeclaration>): List<TextRange> {
|
||||
val element = diagnostic.psiElement
|
||||
val callableDeclaration = element as? KtCallableDeclaration
|
||||
val incompatibility = diagnostic.firstIncompatibility
|
||||
return when (incompatibility) {
|
||||
null, Unknown, is ClassScopes, EnumEntries -> null
|
||||
ClassKind -> {
|
||||
val startElement =
|
||||
element.modifierList?.getModifier(KtTokens.ENUM_KEYWORD)
|
||||
?: element.modifierList?.getModifier(KtTokens.ANNOTATION_KEYWORD)
|
||||
val endElement =
|
||||
element.node.findChildByType(classKindTokens)?.psi
|
||||
?: element.nameIdentifier
|
||||
if (startElement != null && endElement != null) {
|
||||
return markRange(startElement, endElement)
|
||||
}
|
||||
else {
|
||||
endElement
|
||||
}
|
||||
}
|
||||
TypeParameterNames, TypeParameterCount,
|
||||
TypeParameterUpperBounds, TypeParameterVariance, TypeParameterReified -> {
|
||||
(element as? KtTypeParameterListOwner)?.typeParameterList
|
||||
}
|
||||
ParameterShape -> {
|
||||
callableDeclaration?.let { it.receiverTypeReference ?: it.valueParameterList }
|
||||
}
|
||||
ParameterCount, ParameterTypes, ParameterNames,
|
||||
ValueParameterHasDefault, ValueParameterVararg,
|
||||
ValueParameterNoinline, ValueParameterCrossinline -> {
|
||||
callableDeclaration?.valueParameterList
|
||||
}
|
||||
ReturnType -> {
|
||||
callableDeclaration?.typeReference
|
||||
}
|
||||
FunctionModifiersDifferent, FunctionModifiersNotSubset,
|
||||
PropertyModifiers, ClassModifiers -> {
|
||||
element.modifierList
|
||||
}
|
||||
PropertyKind -> {
|
||||
element.node.findChildByType(propertyKindTokens)?.psi
|
||||
}
|
||||
Supertypes -> {
|
||||
(element as? KtClassOrObject)?.getSuperTypeList()
|
||||
}
|
||||
Modality -> {
|
||||
element.modalityModifier()
|
||||
}
|
||||
Visibility -> {
|
||||
element.visibilityModifier()
|
||||
}
|
||||
}?.let { markElement(it) } ?: ACTUAL_DECLARATION_NAME.mark(element)
|
||||
}
|
||||
}
|
||||
|
||||
@JvmField val DECLARATION_NAME: PositioningStrategy<KtNamedDeclaration> = object : DeclarationHeader<KtNamedDeclaration>() {
|
||||
override fun mark(element: KtNamedDeclaration): List<TextRange> {
|
||||
val nameIdentifier = element.nameIdentifier
|
||||
|
||||
Vendored
+3
-3
@@ -3,16 +3,16 @@
|
||||
// FILE: common.kt
|
||||
package common
|
||||
|
||||
<!JS:NO_ACTUAL_FOR_EXPECT, JVM:NO_ACTUAL_FOR_EXPECT!>expect fun foo()<!>
|
||||
expect fun <!JS:NO_ACTUAL_FOR_EXPECT, JVM:NO_ACTUAL_FOR_EXPECT!>foo<!>()
|
||||
|
||||
// MODULE: m2-jvm(m1-common)
|
||||
// FILE: jvm.kt
|
||||
package jvm
|
||||
|
||||
<!ACTUAL_WITHOUT_EXPECT!>actual fun foo()<!> {}
|
||||
actual fun <!ACTUAL_WITHOUT_EXPECT!>foo<!>() {}
|
||||
|
||||
// MODULE: m3-js(m1-common)
|
||||
// FILE: js.kt
|
||||
package js
|
||||
|
||||
<!ACTUAL_WITHOUT_EXPECT!>actual fun foo()<!> {}
|
||||
actual fun <!ACTUAL_WITHOUT_EXPECT!>foo<!>() {}
|
||||
|
||||
Vendored
+1
-1
@@ -9,4 +9,4 @@ expect fun foo()
|
||||
|
||||
<!NON_MEMBER_FUNCTION_NO_BODY!>actual fun foo()<!>
|
||||
|
||||
<!NON_MEMBER_FUNCTION_NO_BODY, ACTUAL_WITHOUT_EXPECT!>actual fun bar()<!>
|
||||
<!NON_MEMBER_FUNCTION_NO_BODY!>actual fun <!ACTUAL_WITHOUT_EXPECT!>bar<!>()<!>
|
||||
|
||||
+1
-1
@@ -2,4 +2,4 @@
|
||||
// MODULE: m1-jvm
|
||||
// FILE: jvm.kt
|
||||
|
||||
<!ACTUAL_WITHOUT_EXPECT!>actual fun foo()<!> { }
|
||||
actual fun <!ACTUAL_WITHOUT_EXPECT!>foo<!>() { }
|
||||
|
||||
@@ -8,7 +8,7 @@ expect fun nonInlineFun()
|
||||
// MODULE: m2-jvm(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
<!ACTUAL_WITHOUT_EXPECT!>actual fun inlineFun()<!> { }
|
||||
<!ACTUAL_WITHOUT_EXPECT!>actual<!> fun inlineFun() { }
|
||||
actual fun nonInlineFun() { }
|
||||
|
||||
// MODULE: m3-js(m1-common)
|
||||
|
||||
+4
-4
@@ -18,10 +18,10 @@ expect fun f8(vararg x: Any)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual inline fun f1(noinline s: () -> String) {}
|
||||
<!ACTUAL_WITHOUT_EXPECT!>actual inline fun f2(noinline s: () -> String)<!> {}
|
||||
actual inline fun f2<!ACTUAL_WITHOUT_EXPECT!>(noinline s: () -> String)<!> {}
|
||||
actual inline fun f3(s: () -> String) {}
|
||||
actual inline fun f4(crossinline s: () -> String) {}
|
||||
<!ACTUAL_WITHOUT_EXPECT!>actual inline fun f5(crossinline s: () -> String)<!> {}
|
||||
actual inline fun f5<!ACTUAL_WITHOUT_EXPECT!>(crossinline s: () -> String)<!> {}
|
||||
actual inline fun f6(s: () -> String) {}
|
||||
<!ACTUAL_WITHOUT_EXPECT!>actual fun f7(vararg x: Any)<!> {}
|
||||
<!ACTUAL_WITHOUT_EXPECT!>actual fun f8(x: Any)<!> {}
|
||||
actual fun f7<!ACTUAL_WITHOUT_EXPECT!>(vararg x: Any)<!> {}
|
||||
actual fun f8<!ACTUAL_WITHOUT_EXPECT!>(x: Any)<!> {}
|
||||
|
||||
+2
-2
@@ -5,9 +5,9 @@ Output:
|
||||
-- JVM --
|
||||
Exit code: COMPILATION_ERROR
|
||||
Output:
|
||||
compiler/testData/multiplatform/classScopes/constructorIncorrectSignature/jvm.kt:2:12: error: actual constructor of 'Foo' has no corresponding expected declaration
|
||||
compiler/testData/multiplatform/classScopes/constructorIncorrectSignature/jvm.kt:2:23: error: actual constructor of 'Foo' has no corresponding expected declaration
|
||||
The following declaration is incompatible because parameter types are different:
|
||||
public constructor Foo(s: String)
|
||||
|
||||
actual constructor(s: Array<String>)
|
||||
^
|
||||
^
|
||||
|
||||
+2
-2
@@ -5,9 +5,9 @@ Output:
|
||||
-- JVM --
|
||||
Exit code: COMPILATION_ERROR
|
||||
Output:
|
||||
compiler/testData/multiplatform/classScopes/functionIncorrectSignature/jvm.kt:2:5: error: actual function 'function' has no corresponding expected declaration
|
||||
compiler/testData/multiplatform/classScopes/functionIncorrectSignature/jvm.kt:2:40: error: actual function 'function' has no corresponding expected declaration
|
||||
The following declaration is incompatible because return type is different:
|
||||
public final expect fun function(b: ByteArray): Int
|
||||
|
||||
actual fun function(b: ByteArray): Long = b.size.toLong()
|
||||
^
|
||||
^
|
||||
|
||||
@@ -8,54 +8,54 @@ expect fun f21(c: suspend Unit.() -> Unit)
|
||||
-- JVM --
|
||||
Exit code: COMPILATION_ERROR
|
||||
Output:
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:1:1: error: actual function 'f1' has no corresponding expected declaration
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:1:18: error: actual function 'f1' has no corresponding expected declaration
|
||||
The following declaration is incompatible because return type is different:
|
||||
public expect fun f1(): Unit
|
||||
|
||||
actual fun f1(): String = ""
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:3:1: error: actual function 'f2' has no corresponding expected declaration
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:3:14: error: actual function 'f2' has no corresponding expected declaration
|
||||
The following declaration is incompatible because parameter names are different:
|
||||
public expect fun f2(name: String): Unit
|
||||
|
||||
actual fun f2(otherName: String) {}
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:5:1: error: actual function 'f3' has no corresponding expected declaration
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:5:14: error: actual function 'f3' has no corresponding expected declaration
|
||||
The following declaration is incompatible because parameter types are different:
|
||||
public expect fun f3(name: String): Unit
|
||||
|
||||
actual fun f3(name: Double) {}
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:6:1: error: actual function 'f3ext' has no corresponding expected declaration
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:6:24: error: actual function 'f3ext' has no corresponding expected declaration
|
||||
The following declaration is incompatible because parameter types are different:
|
||||
public expect fun String.f3ext(): Unit
|
||||
|
||||
actual fun Double.f3ext() {}
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:8:1: error: actual function 'f4' has no corresponding expected declaration
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:8:12: error: actual function 'f4' has no corresponding expected declaration
|
||||
The following declaration is incompatible because parameter shapes are different (extension vs non-extension):
|
||||
public expect fun f4(name: String): Unit
|
||||
|
||||
actual fun String.f4() {}
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:10:1: error: actual function 'f5' has no corresponding expected declaration
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:10:14: error: actual function 'f5' has no corresponding expected declaration
|
||||
The following declaration is incompatible because parameter shapes are different (extension vs non-extension):
|
||||
public expect fun String.f5(): Unit
|
||||
|
||||
actual fun f5(name: String) {}
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:12:1: error: actual function 'f6' has no corresponding expected declaration
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:12:14: error: actual function 'f6' has no corresponding expected declaration
|
||||
The following declaration is incompatible because number of value parameters is different:
|
||||
public expect fun f6(p1: String, p2: Int): Unit
|
||||
|
||||
actual fun f6(p2: Int) {}
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:14:1: error: actual function 'f7' has no corresponding expected declaration
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:14:12: error: actual function 'f7' has no corresponding expected declaration
|
||||
The following declaration is incompatible because number of type parameters is different:
|
||||
public expect fun <T> f7(): Unit
|
||||
|
||||
actual fun <K, V> f7() {}
|
||||
^
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:16:1: error: actual function 'f8' has no corresponding expected declaration
|
||||
The following declaration is incompatible because visibility is different:
|
||||
internal expect fun f8(): Unit
|
||||
@@ -74,51 +74,51 @@ The following declaration is incompatible because visibility is different:
|
||||
|
||||
private actual fun f10() {}
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:24:1: error: actual function 'f14' has no corresponding expected declaration
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:24: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:1: error: actual function 'f16' has no corresponding expected declaration
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:27: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:1: error: actual function 'f17' has no corresponding expected declaration
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:29: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:1: error: actual function 'f18' has no corresponding expected declaration
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:30: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:1: error: actual function 'f19' has no corresponding expected declaration
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:31: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:1: error: actual function 'f20' has no corresponding expected declaration
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:32: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:1: error: actual function 'f21' has no corresponding expected declaration
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:33: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:1: error: actual function 'f22' has no corresponding expected declaration
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleCallables/jvm.kt:34: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
|
||||
|
||||
actual fun f22(c: suspend Unit.() -> Unit) {}
|
||||
^
|
||||
^
|
||||
|
||||
+26
-26
@@ -5,87 +5,87 @@ Output:
|
||||
-- JVM --
|
||||
Exit code: COMPILATION_ERROR
|
||||
Output:
|
||||
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:1:18: error: actual interface 'PClass' has no corresponding expected declaration
|
||||
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:1:8: error: actual interface 'PClass' has no corresponding expected declaration
|
||||
The following declaration is incompatible because class kinds are different (class, interface, object, enum, annotation):
|
||||
public final expect class PClass
|
||||
|
||||
actual interface PClass
|
||||
^
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:2:8: error: actual object 'PInterface' has no corresponding expected declaration
|
||||
The following declaration is incompatible because class kinds are different (class, interface, object, enum, annotation):
|
||||
public expect interface PInterface
|
||||
|
||||
actual object PInterface
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:3:19: error: actual enum class 'PObject' has no corresponding expected declaration
|
||||
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:3:8: error: actual enum class 'PObject' has no corresponding expected 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: actual annotation class 'PEnumClass' has no corresponding expected declaration
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:4:8: error: actual annotation class 'PEnumClass' has no corresponding expected 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: actual class 'PAnnotationClass' has no corresponding expected declaration
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:5:8: error: actual class 'PAnnotationClass' has no corresponding expected 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: actual object 'InternalObject' has no corresponding expected declaration
|
||||
^
|
||||
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:17: error: actual object 'PublicObject' has no corresponding expected declaration
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:8: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:15: error: actual object 'PrivateObject' has no corresponding expected declaration
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:9:1: error: actual object 'PrivateObject' has no corresponding expected 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: actual class 'OpenClass' has no corresponding expected declaration
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:11: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:19: error: actual class 'AbstractClass' has no corresponding expected declaration
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:12: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:23: error: actual class 'FinalClass' has no corresponding expected declaration
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:13: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:14: error: actual class 'C1' has no corresponding expected declaration
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:15: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:14: error: actual class 'C2' has no corresponding expected declaration
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:16: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:23: error: actual class 'ExtendsNumber' has no corresponding expected declaration
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleClasses/jvm.kt:22: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
|
||||
|
||||
actual abstract class ExtendsNumber : Any()
|
||||
^
|
||||
^
|
||||
|
||||
@@ -5,51 +5,51 @@ Output:
|
||||
-- JVM --
|
||||
Exit code: COMPILATION_ERROR
|
||||
Output:
|
||||
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:2:22: error: actual interface 'N1' has no corresponding expected declaration
|
||||
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:2:12: error: actual interface 'N1' has no corresponding expected declaration
|
||||
The following declaration is incompatible because class kinds are different (class, interface, object, enum, annotation):
|
||||
public final expect class N1
|
||||
|
||||
actual interface N1
|
||||
^
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:3:12: error: actual object 'N2' has no corresponding expected declaration
|
||||
The following declaration is incompatible because class kinds are different (class, interface, object, enum, annotation):
|
||||
public expect interface N2
|
||||
|
||||
actual object N2
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:4:18: error: actual class 'N3' has no corresponding expected declaration
|
||||
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:4:12: error: actual class 'N3' has no corresponding expected declaration
|
||||
The following declaration is incompatible because class kinds are different (class, interface, object, enum, annotation):
|
||||
public expect object N3
|
||||
|
||||
actual class N3
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:8:24: error: actual class 'N2' has no corresponding expected declaration
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:8:5: error: actual class 'N2' has no corresponding expected declaration
|
||||
The following declaration is incompatible because modifiers are different (companion, inner):
|
||||
public final expect class N2
|
||||
|
||||
actual inner class N2
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:9:18: error: actual class 'I2' has no corresponding expected declaration
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:9:5: error: actual class 'I2' has no corresponding expected declaration
|
||||
The following declaration is incompatible because modifiers are different (companion, inner):
|
||||
public final expect inner class I2
|
||||
|
||||
actual class I2
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:13:22: error: actual companion object 'Companion' has no corresponding expected declaration
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:13:5: error: actual companion object 'Companion' has no corresponding expected 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: actual object 'Factory' has no corresponding expected declaration
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:14:5: error: actual object 'Factory' has no corresponding expected 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: actual object 'Companion' has no corresponding expected declaration
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleNestedClasses/jvm.kt:18:5: error: actual object 'Companion' has no corresponding expected declaration
|
||||
The following declaration is incompatible because modifiers are different (companion, inner):
|
||||
public expect companion object
|
||||
|
||||
actual object Companion
|
||||
^
|
||||
^
|
||||
|
||||
@@ -5,15 +5,15 @@ Output:
|
||||
-- JVM --
|
||||
Exit code: COMPILATION_ERROR
|
||||
Output:
|
||||
compiler/testData/multiplatform/incompatibleProperties/jvm.kt:1:1: error: actual property 'pval' has no corresponding expected declaration
|
||||
compiler/testData/multiplatform/incompatibleProperties/jvm.kt:1:8: error: actual property 'pval' has no corresponding expected declaration
|
||||
The following declaration is incompatible because property kinds are different (val vs var):
|
||||
public expect val pval: String
|
||||
|
||||
actual var pval: String = ""
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleProperties/jvm.kt:2:1: error: actual property 'pvar' has no corresponding expected declaration
|
||||
^
|
||||
compiler/testData/multiplatform/incompatibleProperties/jvm.kt:2:8: error: actual property 'pvar' has no corresponding expected declaration
|
||||
The following declaration is incompatible because property kinds are different (val vs var):
|
||||
public expect var pvar: String
|
||||
|
||||
actual val pvar: String = ""
|
||||
^
|
||||
^
|
||||
|
||||
@@ -5,15 +5,15 @@ Output:
|
||||
-- JVM --
|
||||
Exit code: COMPILATION_ERROR
|
||||
Output:
|
||||
compiler/testData/multiplatform/incorrectImplInClass/jvm.kt:1:25: error: actual constructor of 'Foo' has no corresponding expected declaration
|
||||
compiler/testData/multiplatform/incorrectImplInClass/jvm.kt:1:18: error: actual constructor of 'Foo' has no corresponding expected declaration
|
||||
actual class Foo actual constructor() {
|
||||
^
|
||||
compiler/testData/multiplatform/incorrectImplInClass/jvm.kt:2:12: error: actual constructor of 'Foo' has no corresponding expected declaration
|
||||
^
|
||||
compiler/testData/multiplatform/incorrectImplInClass/jvm.kt:2:5: error: actual constructor of 'Foo' has no corresponding expected declaration
|
||||
actual constructor(s: String) : this()
|
||||
^
|
||||
compiler/testData/multiplatform/incorrectImplInClass/jvm.kt:4:5: error: actual function 'nonPlatformFun' has no corresponding expected declaration
|
||||
^
|
||||
compiler/testData/multiplatform/incorrectImplInClass/jvm.kt:4:16: error: actual function 'nonPlatformFun' has no corresponding expected declaration
|
||||
actual fun nonPlatformFun() {}
|
||||
^
|
||||
compiler/testData/multiplatform/incorrectImplInClass/jvm.kt:6:5: error: actual property 'nonPlatformVal' has no corresponding expected declaration
|
||||
^
|
||||
compiler/testData/multiplatform/incorrectImplInClass/jvm.kt:6:16: error: actual property 'nonPlatformVal' has no corresponding expected declaration
|
||||
actual val nonPlatformVal = ""
|
||||
^
|
||||
^
|
||||
|
||||
@@ -5,12 +5,12 @@ Output:
|
||||
-- JVM --
|
||||
Exit code: COMPILATION_ERROR
|
||||
Output:
|
||||
compiler/testData/multiplatform/missingOverload/common.kt:7:1: error: expected function 'g' has no actual declaration in module
|
||||
compiler/testData/multiplatform/missingOverload/common.kt:7:13: error: expected function 'g' has no actual declaration in module
|
||||
The following declaration is incompatible because parameter types are different:
|
||||
public actual fun g(a: Any): Unit
|
||||
|
||||
expect fun g(s: String)
|
||||
^
|
||||
^
|
||||
compiler/testData/multiplatform/missingOverload/jvm.kt:1:14: error: actual class 'Foo' has no corresponding members for expected class members:
|
||||
|
||||
public final expect fun f(a: Any): Unit
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
<error descr="[NO_ACTUAL_FOR_EXPECT] Expected function 'foo' has no actual declaration in module jvm_base for JVM">expect fun foo(): Int</error>
|
||||
expect fun <error descr="[NO_ACTUAL_FOR_EXPECT] Expected function 'foo' has no actual declaration in module jvm_base for JVM">foo</error>(): Int
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
expect fun foo(arg: Int): Int
|
||||
|
||||
<error>expect fun foo(): Int</error>
|
||||
expect fun foo<error>()</error>: Int
|
||||
|
||||
Reference in New Issue
Block a user