[FIR] Fix disappeared ACTUAL_MISSING
^KT-59887 Fixed Review: https://jetbrains.team/p/kt/reviews/13244
This commit is contained in:
+2
-1
@@ -16,6 +16,7 @@ import org.jetbrains.kotlin.fir.contracts.FirResolvedContractDescription
|
|||||||
import org.jetbrains.kotlin.fir.contracts.impl.FirEmptyContractDescription
|
import org.jetbrains.kotlin.fir.contracts.impl.FirEmptyContractDescription
|
||||||
import org.jetbrains.kotlin.fir.declarations.*
|
import org.jetbrains.kotlin.fir.declarations.*
|
||||||
import org.jetbrains.kotlin.fir.declarations.utils.isActual
|
import org.jetbrains.kotlin.fir.declarations.utils.isActual
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.utils.isExpect
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall
|
import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirExpression
|
import org.jetbrains.kotlin.fir.expressions.FirExpression
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirResolvable
|
import org.jetbrains.kotlin.fir.expressions.FirResolvable
|
||||||
@@ -108,7 +109,7 @@ internal fun checkStatementsAreResolved(script: FirScript) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal fun checkExpectForActualIsResolved(memberDeclaration: FirMemberDeclaration) {
|
internal fun checkExpectForActualIsResolved(memberDeclaration: FirMemberDeclaration) {
|
||||||
if (!memberDeclaration.isActual) return
|
if (memberDeclaration.isExpect) return
|
||||||
|
|
||||||
checkWithAttachment(
|
checkWithAttachment(
|
||||||
condition = memberDeclaration.expectForActual != null,
|
condition = memberDeclaration.expectForActual != null,
|
||||||
|
|||||||
Vendored
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// LANGUAGE: +MultiPlatformProjects
|
||||||
fun main() {
|
fun main() {
|
||||||
println("Hello, Kotlin/Native!")
|
println("Hello, Kotlin/Native!")
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
@@ -10,6 +10,6 @@ FILE: [ResolvedTo(IMPORTS)] expectAndActualInTheSameFile.kt
|
|||||||
public? final? [ResolvedTo(RAW_FIR)] fun main(): R|kotlin/Unit| { LAZY_BLOCK }
|
public? final? [ResolvedTo(RAW_FIR)] fun main(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||||
public? final? expect [ResolvedTo(RAW_FIR)] fun f(): R|kotlin/Unit|
|
public? final? expect [ResolvedTo(RAW_FIR)] fun f(): R|kotlin/Unit|
|
||||||
public? final? [ResolvedTo(RAW_FIR)] fun test(): R|kotlin/Unit| { LAZY_BLOCK }
|
public? final? [ResolvedTo(RAW_FIR)] fun test(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||||
public final actual [ResolvedTo(BODY_RESOLVE)] fun f(): R|kotlin/Unit| {
|
public final actual [ResolvedTo(BODY_RESOLVE)] [ExpectForActualAttributeKey={}] fun f(): R|kotlin/Unit| {
|
||||||
<Unresolved name: println>#(String(Hello))
|
<Unresolved name: println>#(String(Hello))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// LANGUAGE: +MultiPlatformProjects
|
||||||
actual class Ac<caret>tual {
|
actual class Ac<caret>tual {
|
||||||
fun memberFun() {}
|
fun memberFun() {}
|
||||||
val a = 1
|
val a = 1
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ FILE: [ResolvedTo(IMPORTS)] actual.kt
|
|||||||
|
|
||||||
EXPECT_ACTUAL_MATCHING:
|
EXPECT_ACTUAL_MATCHING:
|
||||||
FILE: [ResolvedTo(IMPORTS)] actual.kt
|
FILE: [ResolvedTo(IMPORTS)] actual.kt
|
||||||
public final actual [ResolvedTo(EXPECT_ACTUAL_MATCHING)] class Actual : R|kotlin/Any| {
|
public final actual [ResolvedTo(EXPECT_ACTUAL_MATCHING)] [ExpectForActualAttributeKey={}] class Actual : R|kotlin/Any| {
|
||||||
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Actual] constructor(): R|Actual| {
|
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Actual] constructor(): R|Actual| {
|
||||||
LAZY_super<R|kotlin/Any|>
|
LAZY_super<R|kotlin/Any|>
|
||||||
}
|
}
|
||||||
@@ -184,7 +184,7 @@ FILE: [ResolvedTo(IMPORTS)] actual.kt
|
|||||||
|
|
||||||
CONTRACTS:
|
CONTRACTS:
|
||||||
FILE: [ResolvedTo(IMPORTS)] actual.kt
|
FILE: [ResolvedTo(IMPORTS)] actual.kt
|
||||||
public final actual [ResolvedTo(CONTRACTS)] class Actual : R|kotlin/Any| {
|
public final actual [ResolvedTo(CONTRACTS)] [ExpectForActualAttributeKey={}] class Actual : R|kotlin/Any| {
|
||||||
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Actual] constructor(): R|Actual| {
|
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Actual] constructor(): R|Actual| {
|
||||||
LAZY_super<R|kotlin/Any|>
|
LAZY_super<R|kotlin/Any|>
|
||||||
}
|
}
|
||||||
@@ -207,7 +207,7 @@ FILE: [ResolvedTo(IMPORTS)] actual.kt
|
|||||||
|
|
||||||
IMPLICIT_TYPES_BODY_RESOLVE:
|
IMPLICIT_TYPES_BODY_RESOLVE:
|
||||||
FILE: [ResolvedTo(IMPORTS)] actual.kt
|
FILE: [ResolvedTo(IMPORTS)] actual.kt
|
||||||
public final actual [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] class Actual : R|kotlin/Any| {
|
public final actual [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] [ExpectForActualAttributeKey={}] class Actual : R|kotlin/Any| {
|
||||||
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Actual] constructor(): R|Actual| {
|
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Actual] constructor(): R|Actual| {
|
||||||
LAZY_super<R|kotlin/Any|>
|
LAZY_super<R|kotlin/Any|>
|
||||||
}
|
}
|
||||||
@@ -230,7 +230,7 @@ FILE: [ResolvedTo(IMPORTS)] actual.kt
|
|||||||
|
|
||||||
ANNOTATION_ARGUMENTS:
|
ANNOTATION_ARGUMENTS:
|
||||||
FILE: [ResolvedTo(IMPORTS)] actual.kt
|
FILE: [ResolvedTo(IMPORTS)] actual.kt
|
||||||
public final actual [ResolvedTo(ANNOTATION_ARGUMENTS)] class Actual : R|kotlin/Any| {
|
public final actual [ResolvedTo(ANNOTATION_ARGUMENTS)] [ExpectForActualAttributeKey={}] class Actual : R|kotlin/Any| {
|
||||||
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Actual] constructor(): R|Actual| {
|
public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Actual] constructor(): R|Actual| {
|
||||||
LAZY_super<R|kotlin/Any|>
|
LAZY_super<R|kotlin/Any|>
|
||||||
}
|
}
|
||||||
@@ -253,14 +253,14 @@ FILE: [ResolvedTo(IMPORTS)] actual.kt
|
|||||||
|
|
||||||
BODY_RESOLVE:
|
BODY_RESOLVE:
|
||||||
FILE: [ResolvedTo(IMPORTS)] actual.kt
|
FILE: [ResolvedTo(IMPORTS)] actual.kt
|
||||||
public final actual [ResolvedTo(BODY_RESOLVE)] class Actual : R|kotlin/Any| {
|
public final actual [ResolvedTo(BODY_RESOLVE)] [ExpectForActualAttributeKey={}] class Actual : R|kotlin/Any| {
|
||||||
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=Actual] constructor(): R|Actual| {
|
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=Actual, ExpectForActualAttributeKey={}] constructor(): R|Actual| {
|
||||||
super<R|kotlin/Any|>()
|
super<R|kotlin/Any|>()
|
||||||
}
|
}
|
||||||
|
|
||||||
public final [ResolvedTo(STATUS)] fun memberFun(): R|kotlin/Unit| { LAZY_BLOCK }
|
public final [ResolvedTo(STATUS)] fun memberFun(): R|kotlin/Unit| { LAZY_BLOCK }
|
||||||
|
|
||||||
public final [ResolvedTo(BODY_RESOLVE)] val a: R|kotlin/Int| = Int(1)
|
public final [ResolvedTo(BODY_RESOLVE)] [ExpectForActualAttributeKey={}] val a: R|kotlin/Int| = Int(1)
|
||||||
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=Actual] get(): R|kotlin/Int|
|
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=Actual] get(): R|kotlin/Int|
|
||||||
|
|
||||||
public? final? actual [ResolvedTo(RAW_FIR)] class NestedActual : R|kotlin/Any| {
|
public? final? actual [ResolvedTo(RAW_FIR)] class NestedActual : R|kotlin/Any| {
|
||||||
@@ -276,23 +276,23 @@ FILE: [ResolvedTo(IMPORTS)] actual.kt
|
|||||||
|
|
||||||
FILE RAW TO BODY:
|
FILE RAW TO BODY:
|
||||||
FILE: [ResolvedTo(BODY_RESOLVE)] actual.kt
|
FILE: [ResolvedTo(BODY_RESOLVE)] actual.kt
|
||||||
public final actual [ResolvedTo(BODY_RESOLVE)] class Actual : R|kotlin/Any| {
|
public final actual [ResolvedTo(BODY_RESOLVE)] [ExpectForActualAttributeKey={}] class Actual : R|kotlin/Any| {
|
||||||
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=Actual] constructor(): R|Actual| {
|
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=Actual, ExpectForActualAttributeKey={}] constructor(): R|Actual| {
|
||||||
super<R|kotlin/Any|>()
|
super<R|kotlin/Any|>()
|
||||||
}
|
}
|
||||||
|
|
||||||
public final [ResolvedTo(BODY_RESOLVE)] fun memberFun(): R|kotlin/Unit| {
|
public final [ResolvedTo(BODY_RESOLVE)] [ExpectForActualAttributeKey={}] fun memberFun(): R|kotlin/Unit| {
|
||||||
}
|
}
|
||||||
|
|
||||||
public final [ResolvedTo(BODY_RESOLVE)] val a: R|kotlin/Int| = Int(1)
|
public final [ResolvedTo(BODY_RESOLVE)] [ExpectForActualAttributeKey={}] val a: R|kotlin/Int| = Int(1)
|
||||||
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=Actual] get(): R|kotlin/Int|
|
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=Actual] get(): R|kotlin/Int|
|
||||||
|
|
||||||
public final actual [ResolvedTo(BODY_RESOLVE)] class NestedActual : R|kotlin/Any| {
|
public final actual [ResolvedTo(BODY_RESOLVE)] [ExpectForActualAttributeKey={}] class NestedActual : R|kotlin/Any| {
|
||||||
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=NestedActual] constructor(): R|Actual.NestedActual| {
|
public [ResolvedTo(BODY_RESOLVE)] [ContainingClassKey=NestedActual, ExpectForActualAttributeKey={}] constructor(): R|Actual.NestedActual| {
|
||||||
super<R|kotlin/Any|>()
|
super<R|kotlin/Any|>()
|
||||||
}
|
}
|
||||||
|
|
||||||
public final [ResolvedTo(BODY_RESOLVE)] fun member2(): R|kotlin/Boolean| {
|
public final [ResolvedTo(BODY_RESOLVE)] [ExpectForActualAttributeKey={}] fun member2(): R|kotlin/Boolean| {
|
||||||
^member2 Boolean(false)
|
^member2 Boolean(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
@@ -87,6 +87,8 @@ sealed class FirModifier<Node : Any>(val node: Node, val token: KtModifierKeywor
|
|||||||
fun KtSourceElement?.getModifierList(): FirModifierList? {
|
fun KtSourceElement?.getModifierList(): FirModifierList? {
|
||||||
return when (this) {
|
return when (this) {
|
||||||
null -> null
|
null -> null
|
||||||
|
// todo this code is buggy. psi for fake declarations (e.g. ImplicitConstructor, EnumGeneratedDeclaration) means a completely different thing
|
||||||
|
// KT-63751
|
||||||
is KtPsiSourceElement -> (psi as? KtModifierListOwner)?.modifierList?.let { FirModifierList.FirPsiModifierList(it) }
|
is KtPsiSourceElement -> (psi as? KtModifierListOwner)?.modifierList?.let { FirModifierList.FirPsiModifierList(it) }
|
||||||
is KtLightSourceElement -> {
|
is KtLightSourceElement -> {
|
||||||
val modifierListNode = lighterASTNode.getChildren(treeStructure).find { it.tokenType == KtNodeTypes.MODIFIER_LIST }
|
val modifierListNode = lighterASTNode.getChildren(treeStructure).find { it.tokenType == KtNodeTypes.MODIFIER_LIST }
|
||||||
|
|||||||
+65
-22
@@ -12,18 +12,13 @@ import org.jetbrains.kotlin.descriptors.ClassKind
|
|||||||
import org.jetbrains.kotlin.diagnostics.DiagnosticReporter
|
import org.jetbrains.kotlin.diagnostics.DiagnosticReporter
|
||||||
import org.jetbrains.kotlin.diagnostics.SourceElementPositioningStrategies
|
import org.jetbrains.kotlin.diagnostics.SourceElementPositioningStrategies
|
||||||
import org.jetbrains.kotlin.diagnostics.reportOn
|
import org.jetbrains.kotlin.diagnostics.reportOn
|
||||||
import org.jetbrains.kotlin.fir.FirExpectActualMatchingContext
|
import org.jetbrains.kotlin.fir.*
|
||||||
import org.jetbrains.kotlin.fir.FirSession
|
|
||||||
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
|
||||||
import org.jetbrains.kotlin.fir.analysis.checkers.getModifierList
|
import org.jetbrains.kotlin.fir.analysis.checkers.getModifierList
|
||||||
|
import org.jetbrains.kotlin.fir.analysis.checkers.hasModifier
|
||||||
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
|
import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors
|
||||||
import org.jetbrains.kotlin.fir.declarations.*
|
import org.jetbrains.kotlin.fir.declarations.*
|
||||||
import org.jetbrains.kotlin.fir.declarations.utils.isActual
|
import org.jetbrains.kotlin.fir.declarations.utils.*
|
||||||
import org.jetbrains.kotlin.fir.declarations.utils.isExpect
|
|
||||||
import org.jetbrains.kotlin.fir.declarations.utils.isExternal
|
|
||||||
import org.jetbrains.kotlin.fir.declarations.utils.isTailRec
|
|
||||||
import org.jetbrains.kotlin.fir.expectActualMatchingContextFactory
|
|
||||||
import org.jetbrains.kotlin.fir.languageVersionSettings
|
|
||||||
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
|
import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol
|
||||||
import org.jetbrains.kotlin.fir.symbols.SymbolInternals
|
import org.jetbrains.kotlin.fir.symbols.SymbolInternals
|
||||||
import org.jetbrains.kotlin.fir.symbols.impl.*
|
import org.jetbrains.kotlin.fir.symbols.impl.*
|
||||||
@@ -51,12 +46,24 @@ object FirExpectActualDeclarationChecker : FirBasicDeclarationChecker() {
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This checker performs a more high level checking. It speaks in terms of "properties" and "functions".
|
||||||
|
// It doesn't make sense to check:
|
||||||
|
// - backing fields (fields can't be declared in expect declaration)
|
||||||
|
// - property accessors (they will be checked as part of the properties checking)
|
||||||
|
// - functions and setters parameters (they will be checked as part of the properties/functions checking)
|
||||||
|
// This if is added because hasModifier(KtTokens.ACTUAL_KEYWORD) mistakenly returns `true` for these declarations (KT-63751)
|
||||||
|
if (declaration is FirBackingField || declaration is FirPropertyAccessor || declaration is FirValueParameter) return
|
||||||
|
|
||||||
if (declaration.isExpect) {
|
if (declaration.isExpect) {
|
||||||
checkExpectDeclarationModifiers(declaration, context, reporter)
|
checkExpectDeclarationModifiers(declaration, context, reporter)
|
||||||
checkOptInAnnotation(declaration, declaration.symbol, context, reporter)
|
checkOptInAnnotation(declaration, declaration.symbol, context, reporter)
|
||||||
}
|
}
|
||||||
if (declaration.isActual) {
|
val matchingCompatibilityToMembersMap = declaration.symbol.expectForActual.orEmpty()
|
||||||
checkActualDeclarationHasExpected(declaration, context, reporter)
|
if ((ExpectActualMatchingCompatibility.MatchedSuccessfully in matchingCompatibilityToMembersMap || declaration.hasActualModifier()) &&
|
||||||
|
!declaration.isLocalMember // Reduce verbosity. WRONG_MODIFIER_TARGET will be reported anyway.
|
||||||
|
) {
|
||||||
|
checkActualDeclarationHasExpected(declaration, context, reporter, matchingCompatibilityToMembersMap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,10 +127,9 @@ object FirExpectActualDeclarationChecker : FirBasicDeclarationChecker() {
|
|||||||
declaration: FirMemberDeclaration,
|
declaration: FirMemberDeclaration,
|
||||||
context: CheckerContext,
|
context: CheckerContext,
|
||||||
reporter: DiagnosticReporter,
|
reporter: DiagnosticReporter,
|
||||||
checkActual: Boolean = true,
|
matchingCompatibilityToMembersMap: ExpectForActualMatchingData,
|
||||||
) {
|
) {
|
||||||
val symbol = declaration.symbol
|
val symbol = declaration.symbol
|
||||||
val matchingCompatibilityToMembersMap = symbol.expectForActual ?: return
|
|
||||||
val expectedSingleCandidate =
|
val expectedSingleCandidate =
|
||||||
matchingCompatibilityToMembersMap[ExpectActualMatchingCompatibility.MatchedSuccessfully]?.singleOrNull()
|
matchingCompatibilityToMembersMap[ExpectActualMatchingCompatibility.MatchedSuccessfully]?.singleOrNull()
|
||||||
val expectActualMatchingContext = context.session.expectActualMatchingContextFactory.create(
|
val expectActualMatchingContext = context.session.expectActualMatchingContextFactory.create(
|
||||||
@@ -146,10 +152,15 @@ object FirExpectActualDeclarationChecker : FirBasicDeclarationChecker() {
|
|||||||
checkAmbiguousExpects(symbol, matchingCompatibilityToMembersMap, symbol, context, reporter)
|
checkAmbiguousExpects(symbol, matchingCompatibilityToMembersMap, symbol, context, reporter)
|
||||||
|
|
||||||
val source = declaration.source
|
val source = declaration.source
|
||||||
if (!declaration.isActual) {
|
if (!declaration.hasActualModifier() &&
|
||||||
if (checkActual && ExpectActualMatchingCompatibility.MatchedSuccessfully in matchingCompatibilityToMembersMap) {
|
ExpectActualMatchingCompatibility.MatchedSuccessfully in matchingCompatibilityToMembersMap &&
|
||||||
reporter.reportOn(source, FirErrors.ACTUAL_MISSING, context)
|
(actualContainingClass == null || requireActualModifier(symbol, actualContainingClass, context.session)) &&
|
||||||
}
|
expectedSingleCandidate != null &&
|
||||||
|
// Don't require 'actual' keyword on fake-overrides actualizations.
|
||||||
|
// It's an inconsistency in the language design, but it's the way it works right now
|
||||||
|
!expectedSingleCandidate.isFakeOverride(expectContainingClass, expectActualMatchingContext)
|
||||||
|
) {
|
||||||
|
reporter.reportOn(source, FirErrors.ACTUAL_MISSING, context)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,8 +169,7 @@ object FirExpectActualDeclarationChecker : FirBasicDeclarationChecker() {
|
|||||||
reportClassScopesIncompatibility(symbol, expectedSingleCandidate, declaration, checkingCompatibility, reporter, source, context)
|
reportClassScopesIncompatibility(symbol, expectedSingleCandidate, declaration, checkingCompatibility, reporter, source, context)
|
||||||
}
|
}
|
||||||
|
|
||||||
ExpectActualMatchingCompatibility.MatchedSuccessfully !in matchingCompatibilityToMembersMap &&
|
ExpectActualMatchingCompatibility.MatchedSuccessfully !in matchingCompatibilityToMembersMap -> {
|
||||||
requireActualModifier(declaration.symbol, context.session) -> {
|
|
||||||
reporter.reportOn(
|
reporter.reportOn(
|
||||||
source,
|
source,
|
||||||
FirErrors.ACTUAL_WITHOUT_EXPECT,
|
FirErrors.ACTUAL_WITHOUT_EXPECT,
|
||||||
@@ -174,7 +184,7 @@ object FirExpectActualDeclarationChecker : FirBasicDeclarationChecker() {
|
|||||||
// A nicer diagnostic for functions with default params
|
// A nicer diagnostic for functions with default params
|
||||||
if (declaration is FirFunction && checkingCompatibility == ExpectActualCheckingCompatibility.ActualFunctionWithDefaultParameters) {
|
if (declaration is FirFunction && checkingCompatibility == ExpectActualCheckingCompatibility.ActualFunctionWithDefaultParameters) {
|
||||||
reporter.reportOn(declaration.source, FirErrors.ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS, context)
|
reporter.reportOn(declaration.source, FirErrors.ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS, context)
|
||||||
} else if (requireActualModifier(declaration.symbol, context.session)) {
|
} else {
|
||||||
reporter.reportOn(
|
reporter.reportOn(
|
||||||
source,
|
source,
|
||||||
FirErrors.ACTUAL_WITHOUT_EXPECT,
|
FirErrors.ACTUAL_WITHOUT_EXPECT,
|
||||||
@@ -254,6 +264,13 @@ object FirExpectActualDeclarationChecker : FirBasicDeclarationChecker() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun FirBasedSymbol<*>.isFakeOverride(
|
||||||
|
expectContainingClass: FirRegularClassSymbol?,
|
||||||
|
expectActualMatchingContext: FirExpectActualMatchingContext,
|
||||||
|
): Boolean = expectContainingClass != null &&
|
||||||
|
this@isFakeOverride is FirCallableSymbol<*> &&
|
||||||
|
with(expectActualMatchingContext) { this@isFakeOverride.isFakeOverride(expectContainingClass) }
|
||||||
|
|
||||||
private fun getCheckingCompatibility(
|
private fun getCheckingCompatibility(
|
||||||
actualSymbol: FirBasedSymbol<*>,
|
actualSymbol: FirBasedSymbol<*>,
|
||||||
expectSymbol: FirBasedSymbol<*>,
|
expectSymbol: FirBasedSymbol<*>,
|
||||||
@@ -309,14 +326,40 @@ object FirExpectActualDeclarationChecker : FirBasicDeclarationChecker() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// we don't require `actual` modifier on
|
// we don't require `actual` modifier on
|
||||||
|
// - implicit primary constructors
|
||||||
|
// - data class fake members
|
||||||
// - annotation constructors, because annotation classes can only have one constructor
|
// - annotation constructors, because annotation classes can only have one constructor
|
||||||
// - value class primary constructors, because value class must have primary constructor
|
// - value class primary constructors, because value class must have primary constructor
|
||||||
// - value parameter inside primary constructor of inline class, because inline class must have one value parameter
|
// - value parameter inside primary constructor of inline class, because inline class must have one value parameter
|
||||||
private fun requireActualModifier(declaration: FirBasedSymbol<*>, session: FirSession): Boolean {
|
private fun requireActualModifier(
|
||||||
return !declaration.isAnnotationConstructor(session) &&
|
declaration: FirBasedSymbol<*>,
|
||||||
!declaration.isPrimaryConstructorOfInlineOrValueClass(session)
|
actualContainingClass: FirRegularClassSymbol,
|
||||||
|
platformSession: FirSession
|
||||||
|
): Boolean {
|
||||||
|
return declaration.source?.kind != KtFakeSourceElementKind.ImplicitConstructor &&
|
||||||
|
declaration.origin != FirDeclarationOrigin.Synthetic.DataClassMember &&
|
||||||
|
!declaration.isAnnotationConstructor(platformSession) &&
|
||||||
|
!declaration.isPrimaryConstructorOfInlineOrValueClass(platformSession) &&
|
||||||
|
!isUnderlyingPropertyOfInlineClass(declaration, actualContainingClass, platformSession)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ideally, this function shouldn't exist KT-63751
|
||||||
|
private fun FirElement.hasActualModifier(): Boolean = when (source?.kind) {
|
||||||
|
KtFakeSourceElementKind.DataClassGeneratedMembers -> false
|
||||||
|
KtFakeSourceElementKind.EnumGeneratedDeclaration -> false
|
||||||
|
KtFakeSourceElementKind.ImplicitConstructor -> false
|
||||||
|
else -> hasModifier(KtTokens.ACTUAL_KEYWORD) || hasModifier(KtTokens.IMPL_KEYWORD)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun isUnderlyingPropertyOfInlineClass(
|
||||||
|
symbol: FirBasedSymbol<*>,
|
||||||
|
actualContainingClass: FirRegularClassSymbol,
|
||||||
|
platformSession: FirSession
|
||||||
|
): Boolean = actualContainingClass.isInline &&
|
||||||
|
symbol is FirPropertySymbol &&
|
||||||
|
symbol.receiverParameter == null &&
|
||||||
|
actualContainingClass.primaryConstructorSymbol(platformSession)?.valueParameterSymbols?.singleOrNull()?.name == symbol.name
|
||||||
|
|
||||||
private fun checkOptInAnnotation(
|
private fun checkOptInAnnotation(
|
||||||
declaration: FirMemberDeclaration,
|
declaration: FirMemberDeclaration,
|
||||||
expectDeclarationSymbol: FirBasedSymbol<*>,
|
expectDeclarationSymbol: FirBasedSymbol<*>,
|
||||||
|
|||||||
+2
-1
@@ -9,6 +9,7 @@ import org.jetbrains.kotlin.config.LanguageFeature
|
|||||||
import org.jetbrains.kotlin.fir.FirSession
|
import org.jetbrains.kotlin.fir.FirSession
|
||||||
import org.jetbrains.kotlin.fir.declarations.*
|
import org.jetbrains.kotlin.fir.declarations.*
|
||||||
import org.jetbrains.kotlin.fir.declarations.utils.isActual
|
import org.jetbrains.kotlin.fir.declarations.utils.isActual
|
||||||
|
import org.jetbrains.kotlin.fir.declarations.utils.isExpect
|
||||||
import org.jetbrains.kotlin.fir.expectActualMatchingContextFactory
|
import org.jetbrains.kotlin.fir.expectActualMatchingContextFactory
|
||||||
import org.jetbrains.kotlin.fir.expressions.FirStatement
|
import org.jetbrains.kotlin.fir.expressions.FirStatement
|
||||||
import org.jetbrains.kotlin.fir.languageVersionSettings
|
import org.jetbrains.kotlin.fir.languageVersionSettings
|
||||||
@@ -93,7 +94,7 @@ open class FirExpectActualMatcherTransformer(
|
|||||||
// ------------------------------------------------------
|
// ------------------------------------------------------
|
||||||
|
|
||||||
fun transformMemberDeclaration(memberDeclaration: FirMemberDeclaration) {
|
fun transformMemberDeclaration(memberDeclaration: FirMemberDeclaration) {
|
||||||
if (!memberDeclaration.isActual) return
|
if (memberDeclaration.isExpect) return
|
||||||
val actualSymbol = memberDeclaration.symbol
|
val actualSymbol = memberDeclaration.symbol
|
||||||
|
|
||||||
// Regardless of whether any `expect` symbols are found for `memberDeclaration`, it must be assigned an `expectForActual` map.
|
// Regardless of whether any `expect` symbols are found for `memberDeclaration`, it must be assigned an `expectForActual` map.
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ expect value class Wrapper(val obj: Any) {
|
|||||||
// FILE: test.kt
|
// FILE: test.kt
|
||||||
|
|
||||||
actual value class Wrapper(val obj: Any) {
|
actual value class Wrapper(val obj: Any) {
|
||||||
val prop: String
|
actual val prop: String
|
||||||
get() = "OK"
|
get() = "OK"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@ expect value class Wrapper(val obj: Any) {
|
|||||||
|
|
||||||
@JvmInline
|
@JvmInline
|
||||||
actual value class Wrapper(val obj: Any) {
|
actual value class Wrapper(val obj: Any) {
|
||||||
val prop: String
|
actual val prop: String
|
||||||
get() = "OK"
|
get() = "OK"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -32,7 +32,7 @@ expect class ImplicitlyActualizedByJvmDeclarationOnExpectOnly
|
|||||||
package kotlin
|
package kotlin
|
||||||
|
|
||||||
@OptIn(ExperimentalMultiplatform::class)
|
@OptIn(ExperimentalMultiplatform::class)
|
||||||
actual annotation class <!ACTUAL_WITHOUT_EXPECT, ACTUAL_WITHOUT_EXPECT!>OptionalExpectationOnExpectOnly<!>
|
actual annotation class <!ACTUAL_WITHOUT_EXPECT!>OptionalExpectationOnExpectOnly<!>
|
||||||
|
|
||||||
actual fun <!ACTUAL_WITHOUT_EXPECT!>skippedAnnotationsOnExpectOnly<!>() {}
|
actual fun <!ACTUAL_WITHOUT_EXPECT!>skippedAnnotationsOnExpectOnly<!>() {}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -10,6 +10,6 @@ open class Base {
|
|||||||
// MODULE: m2-jvm()()(m1-common)
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
actual open class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> : Base() {
|
actual open class Foo : Base() {
|
||||||
override fun <R> foo(t: R) {}
|
override fun <R> <!ACTUAL_WITHOUT_EXPECT!>foo<!>(t: R) {}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -10,6 +10,6 @@ expect open class Foo : Base
|
|||||||
// MODULE: m2-jvm()()(m1-common)
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
actual open class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> : Base() {
|
actual open class Foo : Base() {
|
||||||
override fun <R> foo(t: R) {}
|
override fun <R> <!ACTUAL_WITHOUT_EXPECT!>foo<!>(t: R) {}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -13,8 +13,8 @@ open class Base {
|
|||||||
// MODULE: m2-jvm()()(m1-common)
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
actual open class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> : Base() {
|
actual open class Foo : Base() {
|
||||||
override lateinit var red1: String
|
override lateinit var <!ACTUAL_WITHOUT_EXPECT!>red1<!>: String
|
||||||
override var red2: String = ""
|
override var <!ACTUAL_WITHOUT_EXPECT!>red2<!>: String = ""
|
||||||
override lateinit var green: String
|
override lateinit var green: String
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -13,8 +13,8 @@ expect open class Foo : Base {
|
|||||||
// MODULE: m2-jvm()()(m1-common)
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
actual open class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> : Base() {
|
actual open class Foo : Base() {
|
||||||
override lateinit var red1: String
|
override lateinit var <!ACTUAL_WITHOUT_EXPECT!>red1<!>: String
|
||||||
override var red2: String = ""
|
override var <!ACTUAL_WITHOUT_EXPECT!>red2<!>: String = ""
|
||||||
override lateinit var green: String
|
override lateinit var green: String
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -10,6 +10,6 @@ interface Base {
|
|||||||
// MODULE: m2-jvm()()(m1-common)
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
actual open class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> : Base {
|
actual open class Foo : Base {
|
||||||
final override fun foo() {}
|
final override fun <!ACTUAL_WITHOUT_EXPECT!>foo<!>() {}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -10,6 +10,6 @@ expect open <!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class Foo<!> : Base
|
|||||||
// MODULE: m2-jvm()()(m1-common)
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
actual open class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> : Base {
|
actual open class Foo : Base {
|
||||||
final override fun foo() {}
|
final override fun <!ACTUAL_WITHOUT_EXPECT!>foo<!>() {}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -12,6 +12,6 @@ interface Base {
|
|||||||
// Mismatched scope must be reported here. But it's false negative checker in K1.
|
// Mismatched scope must be reported here. But it's false negative checker in K1.
|
||||||
// For some reason, K1 says that modality of `exect_Foo.foo` is `abstract`.
|
// For some reason, K1 says that modality of `exect_Foo.foo` is `abstract`.
|
||||||
// https://youtrack.jetbrains.com/issue/KT-59739
|
// https://youtrack.jetbrains.com/issue/KT-59739
|
||||||
actual open class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> : Base {
|
actual open class Foo : Base {
|
||||||
override fun foo() {}
|
override fun <!ACTUAL_WITHOUT_EXPECT!>foo<!>() {}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -12,6 +12,6 @@ expect open <!ABSTRACT_MEMBER_NOT_IMPLEMENTED!>class Foo<!>() : Base
|
|||||||
// Mismatched scope must be reported here. But it's false negative checker in K1.
|
// Mismatched scope must be reported here. But it's false negative checker in K1.
|
||||||
// For some reason, K1 says that modality of `exect_Foo.foo` is `abstract`.
|
// For some reason, K1 says that modality of `exect_Foo.foo` is `abstract`.
|
||||||
// https://youtrack.jetbrains.com/issue/KT-59739
|
// https://youtrack.jetbrains.com/issue/KT-59739
|
||||||
actual open class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> : Base {
|
actual open class Foo : Base {
|
||||||
override fun foo() {}
|
override fun <!ACTUAL_WITHOUT_EXPECT!>foo<!>() {}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -9,6 +9,6 @@ interface Base {
|
|||||||
// MODULE: m2-jvm()()(m1-common)
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
actual abstract class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> : Base {
|
actual abstract class Foo : Base {
|
||||||
abstract override fun foo()
|
abstract override fun <!ACTUAL_WITHOUT_EXPECT!>foo<!>()
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -9,6 +9,6 @@ expect abstract class Foo() : Base
|
|||||||
// MODULE: m2-jvm()()(m1-common)
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
actual abstract class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> : Base {
|
actual abstract class Foo : Base {
|
||||||
abstract override fun foo()
|
abstract override fun <!ACTUAL_WITHOUT_EXPECT!>foo<!>()
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -10,6 +10,6 @@ open class Base {
|
|||||||
// MODULE: m2-jvm()()(m1-common)
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
actual open class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> : Base() {
|
actual open class Foo : Base() {
|
||||||
final override fun foo() {}
|
final override fun <!ACTUAL_WITHOUT_EXPECT!>foo<!>() {}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -10,6 +10,6 @@ expect open class Foo : Base
|
|||||||
// MODULE: m2-jvm()()(m1-common)
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
actual open class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> : Base() {
|
actual open class Foo : Base() {
|
||||||
final override fun foo() {}
|
final override fun <!ACTUAL_WITHOUT_EXPECT!>foo<!>() {}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -10,6 +10,6 @@ open class Base<T> {
|
|||||||
// MODULE: m2-jvm()()(m1-common)
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
actual open class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> : Base<String>() {
|
actual open class Foo : Base<String>() {
|
||||||
final override fun foo(t: String) {}
|
final override fun <!ACTUAL_WITHOUT_EXPECT!>foo<!>(t: String) {}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -10,6 +10,6 @@ expect open class Foo : Base<String>
|
|||||||
// MODULE: m2-jvm()()(m1-common)
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
actual open class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> : Base<String>() {
|
actual open class Foo : Base<String>() {
|
||||||
final override fun foo(t: String) {}
|
final override fun <!ACTUAL_WITHOUT_EXPECT!>foo<!>(t: String) {}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -6,6 +6,6 @@
|
|||||||
// MODULE: m2-jvm()()(m1-common)
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
actual open class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> {
|
actual open class Foo {
|
||||||
final override fun toString() = "Foo"
|
final override fun <!ACTUAL_WITHOUT_EXPECT!>toString<!>() = "Foo"
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -6,6 +6,6 @@ expect open class Foo
|
|||||||
// MODULE: m2-jvm()()(m1-common)
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
actual open class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> {
|
actual open class Foo {
|
||||||
final override fun toString() = "Foo"
|
final override fun <!ACTUAL_WITHOUT_EXPECT!>toString<!>() = "Foo"
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -14,8 +14,8 @@ expect open class Foo3 {
|
|||||||
// MODULE: m2-jvm()()(m1-common)
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
actual open class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo1<!> : Base() {
|
actual open class Foo1 : Base() {
|
||||||
override fun foo(paramNameChanged: Int) {}
|
override fun <!ACTUAL_WITHOUT_EXPECT!>foo<!>(paramNameChanged: Int) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
actual typealias Foo2 = Foo2Java
|
actual typealias Foo2 = Foo2Java
|
||||||
|
|||||||
+2
-2
@@ -14,8 +14,8 @@ expect open class Foo3 {
|
|||||||
// MODULE: m2-jvm()()(m1-common)
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
actual open class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo1<!> : Base() {
|
actual open class Foo1 : Base() {
|
||||||
override fun foo(paramNameChanged: Int) {}
|
override fun <!ACTUAL_WITHOUT_EXPECT!>foo<!>(paramNameChanged: Int) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
actual typealias Foo2 = Foo2Java
|
actual typealias Foo2 = Foo2Java
|
||||||
|
|||||||
+2
-2
@@ -11,6 +11,6 @@ open class Base {
|
|||||||
// MODULE: m2-jvm()()(m1-common)
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
actual open class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> : Base() {
|
actual open class Foo : Base() {
|
||||||
override fun foo(bar: IntArray) {}
|
override fun <!ACTUAL_WITHOUT_EXPECT!>foo<!>(bar: IntArray) {}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -11,6 +11,6 @@ expect open class Foo : Base {
|
|||||||
// MODULE: m2-jvm()()(m1-common)
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
actual open class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> : Base() {
|
actual open class Foo : Base() {
|
||||||
override fun foo(bar: IntArray) {}
|
override fun <!ACTUAL_WITHOUT_EXPECT!>foo<!>(bar: IntArray) {}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -10,6 +10,6 @@ open class Base {
|
|||||||
// MODULE: m2-jvm()()(m1-common)
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
actual open class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> : Base() {
|
actual open class Foo : Base() {
|
||||||
public override fun foo() {}
|
public override fun <!ACTUAL_WITHOUT_EXPECT!>foo<!>() {}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -10,6 +10,6 @@ expect open class Foo : Base
|
|||||||
// MODULE: m2-jvm()()(m1-common)
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
actual open class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> : Base() {
|
actual open class Foo : Base() {
|
||||||
public override fun foo() {}
|
public override fun <!ACTUAL_WITHOUT_EXPECT!>foo<!>() {}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -12,6 +12,6 @@ open class Base {
|
|||||||
// MODULE: m2-jvm()()(m1-common)
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
actual open class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> : Base() {
|
actual open class Foo : Base() {
|
||||||
override fun foo(): String = ""
|
override fun <!ACTUAL_WITHOUT_EXPECT!>foo<!>(): String = ""
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -12,6 +12,6 @@ expect open class Foo : Base {
|
|||||||
// MODULE: m2-jvm()()(m1-common)
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
actual open class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> : Base() {
|
actual open class Foo : Base() {
|
||||||
override fun foo(): String = ""
|
override fun <!ACTUAL_WITHOUT_EXPECT!>foo<!>(): String = ""
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -13,6 +13,6 @@ open class Base {
|
|||||||
// MODULE: m2-jvm()()(m1-common)
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
actual open class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!><T : I> : Base() {
|
actual open class Foo<T : I> : Base() {
|
||||||
override fun foo(): T = null!!
|
override fun <!ACTUAL_WITHOUT_EXPECT!>foo<!>(): T = null!!
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -13,6 +13,6 @@ expect open class Foo<T : I> : Base {
|
|||||||
// MODULE: m2-jvm()()(m1-common)
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
actual open class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!><T : I> : Base() {
|
actual open class Foo<T : I> : Base() {
|
||||||
override fun foo(): T = null!!
|
override fun <!ACTUAL_WITHOUT_EXPECT!>foo<!>(): T = null!!
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -11,6 +11,6 @@ open class Base<R> {
|
|||||||
// MODULE: m2-jvm()()(m1-common)
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
actual open class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!><E, F : E> : Base<E>() {
|
actual open class Foo<E, F : E> : Base<E>() {
|
||||||
override fun foo(): F = null!!
|
override fun <!ACTUAL_WITHOUT_EXPECT!>foo<!>(): F = null!!
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -11,6 +11,6 @@ expect open class Foo<R, T : R> : Base<R> {
|
|||||||
// MODULE: m2-jvm()()(m1-common)
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
actual open class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!><E, F : E> : Base<E>() {
|
actual open class Foo<E, F : E> : Base<E>() {
|
||||||
override fun foo(): F = null!!
|
override fun <!ACTUAL_WITHOUT_EXPECT!>foo<!>(): F = null!!
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -11,6 +11,6 @@ open class Base {
|
|||||||
// MODULE: m2-jvm()()(m1-common)
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
actual open class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> : Base() {
|
actual open class Foo : Base() {
|
||||||
override val foo: String = ""
|
override val <!ACTUAL_WITHOUT_EXPECT!>foo<!>: String = ""
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -11,6 +11,6 @@ expect open class Foo : Base
|
|||||||
// MODULE: m2-jvm()()(m1-common)
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
actual open class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> : Base() {
|
actual open class Foo : Base() {
|
||||||
override val foo: String = ""
|
override val <!ACTUAL_WITHOUT_EXPECT!>foo<!>: String = ""
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -14,11 +14,11 @@ expect open class Base {
|
|||||||
|
|
||||||
actual typealias Base = BaseJava
|
actual typealias Base = BaseJava
|
||||||
|
|
||||||
actual open class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> : Base() {
|
actual open class Foo : Base() {
|
||||||
// K1 doesn't report a diagnostic here because when it compares scopes it sees flexible type
|
// K1 doesn't report a diagnostic here because when it compares scopes it sees flexible type
|
||||||
// K2 will likely report a diagnostic here
|
// K2 will likely report a diagnostic here
|
||||||
// I don't think we can fix this 'K1 green -> K2 red'. It must be a rare case anyway.
|
// I don't think we can fix this 'K1 green -> K2 red'. It must be a rare case anyway.
|
||||||
override fun foo(): List<String> {
|
override fun <!ACTUAL_WITHOUT_EXPECT!>foo<!>(): List<String> {
|
||||||
return super.foo()
|
return super.foo()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -14,11 +14,11 @@ expect open class Foo : Base {
|
|||||||
|
|
||||||
actual typealias Base = BaseJava
|
actual typealias Base = BaseJava
|
||||||
|
|
||||||
actual open class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> : Base() {
|
actual open class Foo : Base() {
|
||||||
// K1 doesn't report a diagnostic here because when it compares scopes it sees flexible type
|
// K1 doesn't report a diagnostic here because when it compares scopes it sees flexible type
|
||||||
// K2 will likely report a diagnostic here
|
// K2 will likely report a diagnostic here
|
||||||
// I don't think we can fix this 'K1 green -> K2 red'. It must be a rare case anyway.
|
// I don't think we can fix this 'K1 green -> K2 red'. It must be a rare case anyway.
|
||||||
override fun foo(): List<String> {
|
override fun <!ACTUAL_WITHOUT_EXPECT!>foo<!>(): List<String> {
|
||||||
return super.foo()
|
return super.foo()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -15,5 +15,5 @@ actual open class Foo {
|
|||||||
// Expected: NON_ACTUAL_MEMBER_DECLARED_IN_EXPECT_NON_FINAL_CLASSIFIER_ACTUALIZATION_WARNING.
|
// Expected: NON_ACTUAL_MEMBER_DECLARED_IN_EXPECT_NON_FINAL_CLASSIFIER_ACTUALIZATION_WARNING.
|
||||||
// But it doesn't work because context receivers are not yet supported in expect actual matcher KT-61447
|
// But it doesn't work because context receivers are not yet supported in expect actual matcher KT-61447
|
||||||
context(Int)
|
context(Int)
|
||||||
fun foo() {}
|
fun <!ACTUAL_MISSING!>foo<!>() {}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -10,6 +10,6 @@ open class Base {
|
|||||||
// MODULE: m2-jvm()()(m1-common)
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
actual open class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> : Base() {
|
actual open class Foo : Base() {
|
||||||
override var foo: Int = 1
|
override var <!ACTUAL_WITHOUT_EXPECT!>foo<!>: Int = 1
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -10,6 +10,6 @@ expect open class Foo : Base
|
|||||||
// MODULE: m2-jvm()()(m1-common)
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
actual open class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> : Base() {
|
actual open class Foo : Base() {
|
||||||
override var foo: Int = 1
|
override var <!ACTUAL_WITHOUT_EXPECT!>foo<!>: Int = 1
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -16,14 +16,14 @@ open class Base() {
|
|||||||
// MODULE: m2-jvm()()(m1-common)
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
actual open class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> : Base() {
|
actual open class Foo : Base() {
|
||||||
actual fun existingMethod() {}
|
actual fun existingMethod() {}
|
||||||
actual val existingParam: Int = 904
|
actual val existingParam: Int = 904
|
||||||
|
|
||||||
fun injectedMethod() {}
|
fun injectedMethod() {}
|
||||||
val injectedProperty: Int = 42
|
val injectedProperty: Int = 42
|
||||||
override fun overrideReturnType(): String = ""
|
override fun <!ACTUAL_WITHOUT_EXPECT!>overrideReturnType<!>(): String = ""
|
||||||
final override fun overrideModality1(): Any = ""
|
final override fun <!ACTUAL_WITHOUT_EXPECT!>overrideModality1<!>(): Any = ""
|
||||||
final override fun overrideModality2(): Any = ""
|
final override fun <!ACTUAL_WITHOUT_EXPECT!>overrideModality2<!>(): Any = ""
|
||||||
public override fun overrideVisibility(): Any = ""
|
public override fun <!ACTUAL_WITHOUT_EXPECT!>overrideVisibility<!>(): Any = ""
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-5
@@ -16,14 +16,14 @@ expect open class Foo : Base {
|
|||||||
// MODULE: m2-jvm()()(m1-common)
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
actual open class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> : Base() {
|
actual open class Foo : Base() {
|
||||||
actual fun existingMethod() {}
|
actual fun existingMethod() {}
|
||||||
actual val existingParam: Int = 904
|
actual val existingParam: Int = 904
|
||||||
|
|
||||||
fun injectedMethod() {}
|
fun injectedMethod() {}
|
||||||
val injectedProperty: Int = 42
|
val injectedProperty: Int = 42
|
||||||
override fun overrideReturnType(): String = ""
|
override fun <!ACTUAL_WITHOUT_EXPECT!>overrideReturnType<!>(): String = ""
|
||||||
final override fun overrideModality1(): Any = ""
|
final override fun <!ACTUAL_WITHOUT_EXPECT!>overrideModality1<!>(): Any = ""
|
||||||
final override fun overrideModality2(): Any = ""
|
final override fun <!ACTUAL_WITHOUT_EXPECT!>overrideModality2<!>(): Any = ""
|
||||||
public override fun overrideVisibility(): Any = ""
|
public override fun <!ACTUAL_WITHOUT_EXPECT!>overrideVisibility<!>(): Any = ""
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-1
@@ -9,7 +9,11 @@ fun test() {}
|
|||||||
// MODULE: m1-jvm()()(m1-common)
|
// MODULE: m1-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
actual annotation class A(val x: Array<String>)
|
// return types are different in expect and actual (Array<out String> in expect vs Array<String> in actual).
|
||||||
|
// In K1, different return types are mistakenly considered as expect-actual mismatch ("strong incompatibility" in old terminology)
|
||||||
|
// In K2, different return types are considered as expect-actual incompatibility ("weak incompatibility" in old terminology)
|
||||||
|
// ACTUAL_MISSING is not reported only when there is a mismatch => K2 is correct
|
||||||
|
actual annotation class A(val <!ACTUAL_MISSING!>x<!>: Array<String>)
|
||||||
|
|
||||||
@A(<!ARGUMENT_TYPE_MISMATCH!>"abc"<!>, <!TOO_MANY_ARGUMENTS!>"foo"<!>, <!TOO_MANY_ARGUMENTS!>"bar"<!>)
|
@A(<!ARGUMENT_TYPE_MISMATCH!>"abc"<!>, <!TOO_MANY_ARGUMENTS!>"foo"<!>, <!TOO_MANY_ARGUMENTS!>"bar"<!>)
|
||||||
fun test2() {}
|
fun test2() {}
|
||||||
|
|||||||
+4
@@ -9,6 +9,10 @@ fun test() {}
|
|||||||
// MODULE: m1-jvm()()(m1-common)
|
// MODULE: m1-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
|
// return types are different in expect and actual (Array<out String> in expect vs Array<String> in actual).
|
||||||
|
// In K1, different return types are mistakenly considered as expect-actual mismatch ("strong incompatibility" in old terminology)
|
||||||
|
// In K2, different return types are considered as expect-actual incompatibility ("weak incompatibility" in old terminology)
|
||||||
|
// ACTUAL_MISSING is not reported only when there is a mismatch => K2 is correct
|
||||||
actual annotation class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>A<!>(val x: Array<String>)
|
actual annotation class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>A<!>(val x: Array<String>)
|
||||||
|
|
||||||
@A(<!TYPE_MISMATCH!>"abc"<!>, <!TOO_MANY_ARGUMENTS!>"foo"<!>, <!TOO_MANY_ARGUMENTS!>"bar"<!>)
|
@A(<!TYPE_MISMATCH!>"abc"<!>, <!TOO_MANY_ARGUMENTS!>"foo"<!>, <!TOO_MANY_ARGUMENTS!>"bar"<!>)
|
||||||
|
|||||||
+5
-1
@@ -9,7 +9,11 @@ fun test() {}
|
|||||||
// MODULE: m1-jvm()()(m1-common)
|
// MODULE: m1-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
actual annotation class A(val x: Array<String>)
|
// return types are different in expect and actual (Array<out String> in expect vs Array<String> in actual).
|
||||||
|
// In K1, different return types are mistakenly considered as expect-actual mismatch ("strong incompatibility" in old terminology)
|
||||||
|
// In K2, different return types are considered as expect-actual incompatibility ("weak incompatibility" in old terminology)
|
||||||
|
// ACTUAL_MISSING is not reported only when there is a mismatch => K2 is correct
|
||||||
|
actual annotation class A<!ACTUAL_WITHOUT_EXPECT!>(val <!ACTUAL_MISSING!>x<!>: Array<String>)<!>
|
||||||
|
|
||||||
@A(<!ARGUMENT_TYPE_MISMATCH!>"abc"<!>, <!TOO_MANY_ARGUMENTS!>"foo"<!>, <!TOO_MANY_ARGUMENTS!>"bar"<!>)
|
@A(<!ARGUMENT_TYPE_MISMATCH!>"abc"<!>, <!TOO_MANY_ARGUMENTS!>"foo"<!>, <!TOO_MANY_ARGUMENTS!>"bar"<!>)
|
||||||
fun test2() {}
|
fun test2() {}
|
||||||
|
|||||||
+4
@@ -9,6 +9,10 @@ fun test() {}
|
|||||||
// MODULE: m1-jvm()()(m1-common)
|
// MODULE: m1-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
|
// return types are different in expect and actual (Array<out String> in expect vs Array<String> in actual).
|
||||||
|
// In K1, different return types are mistakenly considered as expect-actual mismatch ("strong incompatibility" in old terminology)
|
||||||
|
// In K2, different return types are considered as expect-actual incompatibility ("weak incompatibility" in old terminology)
|
||||||
|
// ACTUAL_MISSING is not reported only when there is a mismatch => K2 is correct
|
||||||
actual annotation class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>A<!>(val x: Array<String>)
|
actual annotation class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>A<!>(val x: Array<String>)
|
||||||
|
|
||||||
@A(<!TYPE_MISMATCH!>"abc"<!>, <!TOO_MANY_ARGUMENTS!>"foo"<!>, <!TOO_MANY_ARGUMENTS!>"bar"<!>)
|
@A(<!TYPE_MISMATCH!>"abc"<!>, <!TOO_MANY_ARGUMENTS!>"foo"<!>, <!TOO_MANY_ARGUMENTS!>"bar"<!>)
|
||||||
|
|||||||
+5
-1
@@ -9,7 +9,11 @@ fun test() {}
|
|||||||
// MODULE: m1-jvm()()(m1-common)
|
// MODULE: m1-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
actual annotation class A(val x: Array<String>)
|
// return types are different in expect and actual (Array<out String> in expect vs Array<String> in actual).
|
||||||
|
// In K1, different return types are mistakenly considered as expect-actual mismatch ("strong incompatibility" in old terminology)
|
||||||
|
// In K2, different return types are considered as expect-actual incompatibility ("weak incompatibility" in old terminology)
|
||||||
|
// ACTUAL_MISSING is not reported only when there is a mismatch => K2 is correct
|
||||||
|
actual annotation class A<!ACTUAL_WITHOUT_EXPECT!>(val <!ACTUAL_MISSING!>x<!>: Array<String>)<!>
|
||||||
|
|
||||||
@A(<!ARGUMENT_TYPE_MISMATCH!>"abc"<!>, <!TOO_MANY_ARGUMENTS!>"foo"<!>, <!TOO_MANY_ARGUMENTS!>"bar"<!>)
|
@A(<!ARGUMENT_TYPE_MISMATCH!>"abc"<!>, <!TOO_MANY_ARGUMENTS!>"foo"<!>, <!TOO_MANY_ARGUMENTS!>"bar"<!>)
|
||||||
fun test2() {}
|
fun test2() {}
|
||||||
|
|||||||
+2
-2
@@ -28,10 +28,10 @@ expect class M01 {
|
|||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
actual object E01
|
actual object E01
|
||||||
actual object <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>E02<!>
|
actual object <!ACTUAL_WITHOUT_EXPECT!>E02<!>
|
||||||
actual object <!ACTUAL_WITHOUT_EXPECT!>E03<!>
|
actual object <!ACTUAL_WITHOUT_EXPECT!>E03<!>
|
||||||
|
|
||||||
actual object <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>E04<!>
|
actual object <!ACTUAL_WITHOUT_EXPECT!>E04<!>
|
||||||
|
|
||||||
actual object <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>E05<!>
|
actual object <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>E05<!>
|
||||||
actual object <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>E06<!>
|
actual object <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>E06<!>
|
||||||
|
|||||||
+2
-2
@@ -28,10 +28,10 @@ expect annotation class ANNO01
|
|||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
actual object E01
|
actual object E01
|
||||||
actual object <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>E02<!>
|
actual object <!ACTUAL_WITHOUT_EXPECT!>E02<!>
|
||||||
actual object <!ACTUAL_WITHOUT_EXPECT!>E03<!>
|
actual object <!ACTUAL_WITHOUT_EXPECT!>E03<!>
|
||||||
|
|
||||||
actual object <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>E04<!>
|
actual object <!ACTUAL_WITHOUT_EXPECT!>E04<!>
|
||||||
|
|
||||||
actual object <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>E05<!>
|
actual object <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>E05<!>
|
||||||
actual object <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>E06<!>
|
actual object <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>E06<!>
|
||||||
|
|||||||
+2
-2
@@ -37,7 +37,7 @@ actual class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Bar1<!>(val s: String)
|
|||||||
actual class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Bar2<!>(val p: String = "value", i: Int)
|
actual class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Bar2<!>(val p: String = "value", i: Int)
|
||||||
actual typealias <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Bar3<!> = JavaBar
|
actual typealias <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Bar3<!> = JavaBar
|
||||||
actual class Bar4(val s: String) {
|
actual class Bar4(val s: String) {
|
||||||
constructor() : this("")
|
<!ACTUAL_MISSING!>constructor() : this("")<!>
|
||||||
}
|
}
|
||||||
|
|
||||||
actual class Bar5 {
|
actual class Bar5 {
|
||||||
@@ -45,7 +45,7 @@ actual class Bar5 {
|
|||||||
constructor(s: String)
|
constructor(s: String)
|
||||||
}
|
}
|
||||||
|
|
||||||
class Bar6 {
|
class <!ACTUAL_MISSING!>Bar6<!> {
|
||||||
actual constructor()
|
actual constructor()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -37,7 +37,7 @@ actual class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Bar1<!>(val s: String)
|
|||||||
actual class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Bar2<!>(val p: String = "value", i: Int)
|
actual class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Bar2<!>(val p: String = "value", i: Int)
|
||||||
actual typealias <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Bar3<!> = JavaBar
|
actual typealias <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Bar3<!> = JavaBar
|
||||||
actual class Bar4(val s: String) {
|
actual class Bar4(val s: String) {
|
||||||
constructor() : this("")
|
<!ACTUAL_MISSING!>constructor() : this("")<!>
|
||||||
}
|
}
|
||||||
|
|
||||||
actual class Bar5 {
|
actual class Bar5 {
|
||||||
@@ -45,8 +45,8 @@ actual class Bar5 {
|
|||||||
constructor(s: String)
|
constructor(s: String)
|
||||||
}
|
}
|
||||||
|
|
||||||
class Bar6 {
|
class <!ACTUAL_MISSING!>Bar6<!> {
|
||||||
<!ACTUAL_WITHOUT_EXPECT!>actual constructor()<!>
|
actual constructor()
|
||||||
}
|
}
|
||||||
|
|
||||||
actual class Bar7 actual constructor(s: String) {
|
actual class Bar7 actual constructor(s: String) {
|
||||||
|
|||||||
-13
@@ -1,13 +0,0 @@
|
|||||||
// MODULE: m1-common
|
|
||||||
// FILE: common.kt
|
|
||||||
|
|
||||||
expect class A {
|
|
||||||
fun foo()
|
|
||||||
}
|
|
||||||
|
|
||||||
// MODULE: m1-jvm()()(m1-common)
|
|
||||||
// FILE: jvm.kt
|
|
||||||
|
|
||||||
class A {
|
|
||||||
actual fun <!ACTUAL_WITHOUT_EXPECT!>foo<!>() {}
|
|
||||||
}
|
|
||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// MODULE: m1-common
|
// MODULE: m1-common
|
||||||
// FILE: common.kt
|
// FILE: common.kt
|
||||||
|
|
||||||
|
|||||||
compiler/testData/diagnostics/tests/multiplatform/headerClass/equalsOverrideInActualInterface.fir.kt
Vendored
+2
-2
@@ -2,6 +2,6 @@
|
|||||||
<!EXPECT_ACTUAL_INCOMPATIBILITY{JVM}, EXPECT_ACTUAL_INCOMPATIBILITY{JVM}!>expect interface Base<!>
|
<!EXPECT_ACTUAL_INCOMPATIBILITY{JVM}, EXPECT_ACTUAL_INCOMPATIBILITY{JVM}!>expect interface Base<!>
|
||||||
|
|
||||||
// MODULE: m1-jvm()()(m1-common)
|
// MODULE: m1-jvm()()(m1-common)
|
||||||
actual interface <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Base<!> {
|
actual interface Base {
|
||||||
override fun equals(other: Any?): Boolean
|
override fun <!ACTUAL_WITHOUT_EXPECT!>equals<!>(other: Any?): Boolean
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+2
-2
@@ -2,6 +2,6 @@
|
|||||||
expect interface Base
|
expect interface Base
|
||||||
|
|
||||||
// MODULE: m1-jvm()()(m1-common)
|
// MODULE: m1-jvm()()(m1-common)
|
||||||
actual interface <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Base<!> {
|
actual interface Base {
|
||||||
override fun equals(other: Any?): Boolean
|
override fun <!ACTUAL_WITHOUT_EXPECT!>equals<!>(other: Any?): Boolean
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -15,13 +15,13 @@ expect open class Foo3
|
|||||||
|
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
interface Foo1
|
interface <!ACTUAL_MISSING!>Foo1<!>
|
||||||
actual interface <!ACTUAL_WITHOUT_EXPECT!>Foo2<!>
|
actual interface <!ACTUAL_WITHOUT_EXPECT!>Foo2<!>
|
||||||
|
|
||||||
actual var <!ACTUAL_WITHOUT_EXPECT!>s<!>: String = "value"
|
actual var <!ACTUAL_WITHOUT_EXPECT!>s<!>: String = "value"
|
||||||
|
|
||||||
fun foo2(): Int = 0
|
fun <!ACTUAL_MISSING!>foo2<!>(): Int = 0
|
||||||
|
|
||||||
actual class <!ACTUAL_WITHOUT_EXPECT, PACKAGE_OR_CLASSIFIER_REDECLARATION!>Foo3<!>
|
actual class <!ACTUAL_WITHOUT_EXPECT, PACKAGE_OR_CLASSIFIER_REDECLARATION!>Foo3<!>
|
||||||
|
|
||||||
class <!PACKAGE_OR_CLASSIFIER_REDECLARATION!>Foo3<!>
|
class <!ACTUAL_MISSING, PACKAGE_OR_CLASSIFIER_REDECLARATION!>Foo3<!>
|
||||||
|
|||||||
+1
-1
@@ -31,5 +31,5 @@ actual class DerivedExplicit : Base() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
actual class DerivedExplicitCheck : Base() {
|
actual class DerivedExplicitCheck : Base() {
|
||||||
override fun foo() {}
|
override fun <!ACTUAL_MISSING!>foo<!>() {}
|
||||||
}
|
}
|
||||||
|
|||||||
-34
@@ -1,34 +0,0 @@
|
|||||||
// MODULE: m1-common
|
|
||||||
// FILE: common.kt
|
|
||||||
|
|
||||||
expect class Foo1 {
|
|
||||||
val x: String
|
|
||||||
}
|
|
||||||
|
|
||||||
expect class Foo2 {
|
|
||||||
val x: String
|
|
||||||
}
|
|
||||||
|
|
||||||
expect class Foo3 {
|
|
||||||
val x: String
|
|
||||||
}
|
|
||||||
|
|
||||||
// MODULE: m2-jvm()()(m1-common)
|
|
||||||
|
|
||||||
// FILE: jvm.kt
|
|
||||||
|
|
||||||
open class Open {
|
|
||||||
open val x = "42"
|
|
||||||
}
|
|
||||||
|
|
||||||
actual open class Foo1 : Open() {
|
|
||||||
override val x = super.x
|
|
||||||
}
|
|
||||||
|
|
||||||
actual open class Foo2 : Open()
|
|
||||||
|
|
||||||
open class WithFinal {
|
|
||||||
val x = "42"
|
|
||||||
}
|
|
||||||
|
|
||||||
actual open class Foo3 : WithFinal()
|
|
||||||
+1
@@ -1,3 +1,4 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
// MODULE: m1-common
|
// MODULE: m1-common
|
||||||
// FILE: common.kt
|
// FILE: common.kt
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
-1
@@ -41,5 +41,5 @@ actual class C {
|
|||||||
actual class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>D<!>
|
actual class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>D<!>
|
||||||
|
|
||||||
actual class E {
|
actual class E {
|
||||||
class N
|
class <!ACTUAL_MISSING!>N<!>
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
@@ -41,5 +41,5 @@ actual class C {
|
|||||||
actual class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>D<!>
|
actual class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>D<!>
|
||||||
|
|
||||||
actual class E {
|
actual class E {
|
||||||
class N
|
class <!ACTUAL_MISSING!>N<!>
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -9,7 +9,7 @@
|
|||||||
// MODULE: m2-jvm()()(m1-common)
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
actual class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> {
|
actual class Foo {
|
||||||
fun bar(): String = "bar"
|
fun <!ACTUAL_MISSING!>bar<!>(): String = "bar"
|
||||||
fun bas(g: Int) {}
|
fun <!ACTUAL_MISSING!>bas<!>(g: Int) {}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -9,7 +9,7 @@ expect class Foo {
|
|||||||
// MODULE: m2-jvm()()(m1-common)
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
actual class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> {
|
actual class Foo {
|
||||||
fun bar(): String = "bar"
|
fun <!ACTUAL_MISSING!>bar<!>(): String = "bar"
|
||||||
fun bas(g: Int) {}
|
fun <!ACTUAL_MISSING!>bas<!>(g: Int) {}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -16,8 +16,8 @@ expect class A private constructor() {
|
|||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
actual class A actual private constructor() {
|
actual class A actual private constructor() {
|
||||||
private fun foo() {}
|
private fun <!ACTUAL_MISSING!>foo<!>() {}
|
||||||
private val bar: String = ""
|
private val <!ACTUAL_MISSING!>bar<!>: String = ""
|
||||||
actual private fun Int.memExt(): Any = 0
|
actual private fun Int.memExt(): Any = 0
|
||||||
|
|
||||||
actual private class Nested
|
actual private class Nested
|
||||||
|
|||||||
Vendored
+1
-1
@@ -20,7 +20,7 @@ expect inline class NonInlineActual(val x: Int)
|
|||||||
actual inline class Foo1(val x: Int) {
|
actual inline class Foo1(val x: Int) {
|
||||||
actual fun bar(): String = "Hello"
|
actual fun bar(): String = "Hello"
|
||||||
}
|
}
|
||||||
actual inline class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS, NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo2<!>(val x: String)
|
actual inline class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo2<!>(val <!ACTUAL_WITHOUT_EXPECT!>x<!>: String)
|
||||||
actual <!ABSENCE_OF_PRIMARY_CONSTRUCTOR_FOR_VALUE_CLASS!>inline<!> class Foo3
|
actual <!ABSENCE_OF_PRIMARY_CONSTRUCTOR_FOR_VALUE_CLASS!>inline<!> class Foo3
|
||||||
|
|
||||||
actual inline class <!ACTUAL_WITHOUT_EXPECT!>NonInlineExpect<!>(val x: Int)
|
actual inline class <!ACTUAL_WITHOUT_EXPECT!>NonInlineExpect<!>(val x: Int)
|
||||||
|
|||||||
+2
-2
@@ -15,6 +15,6 @@ public class Foo {
|
|||||||
|
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
class <!PACKAGE_OR_CLASSIFIER_REDECLARATION!>Foo<!><T>(t: T) {
|
class <!ACTUAL_MISSING, PACKAGE_OR_CLASSIFIER_REDECLARATION!>Foo<!><T>(t: T) {
|
||||||
fun foo() {}
|
fun <!ACTUAL_MISSING!>foo<!>() {}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -15,6 +15,6 @@ public class Foo {
|
|||||||
|
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
class <!PACKAGE_OR_CLASSIFIER_REDECLARATION!>Foo<!><T>(t: T) {
|
class <!ACTUAL_MISSING, PACKAGE_OR_CLASSIFIER_REDECLARATION!>Foo<!><T>(t: T) {
|
||||||
fun foo() {}
|
fun <!ACTUAL_MISSING!>foo<!>() {}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -7,5 +7,5 @@ interface A
|
|||||||
// MODULE: m2-jvm()()(m1-common)
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
fun <T : A> foo(t: T): T = TODO()
|
fun <T : A> <!ACTUAL_MISSING!>foo<!>(t: T): T = TODO()
|
||||||
fun <T> foo(t: T): String = TODO()
|
fun <T> foo(t: T): String = TODO()
|
||||||
|
|||||||
+1
-1
@@ -7,5 +7,5 @@ expect fun <T : A> foo(t: T): String
|
|||||||
// MODULE: m2-jvm()()(m1-common)
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
// FILE: jvm.kt
|
// FILE: jvm.kt
|
||||||
|
|
||||||
fun <T : A> foo(t: T): T = TODO()
|
fun <T : A> <!ACTUAL_MISSING!>foo<!>(t: T): T = TODO()
|
||||||
fun <T> foo(t: T): String = TODO()
|
fun <T> foo(t: T): String = TODO()
|
||||||
|
|||||||
+2
-2
@@ -18,8 +18,8 @@ internal expect open class Other {
|
|||||||
|
|
||||||
// MODULE: platform-jvm()()(common)
|
// MODULE: platform-jvm()()(common)
|
||||||
public actual open class Some { // should be allowed
|
public actual open class Some { // should be allowed
|
||||||
public class ProtectedNested // should be allowed
|
public class <!ACTUAL_MISSING!>ProtectedNested<!> // should be allowed
|
||||||
public class InternalNested // should be allowed
|
public class <!ACTUAL_MISSING!>InternalNested<!> // should be allowed
|
||||||
|
|
||||||
public actual fun publicFun() {} // should be allowed
|
public actual fun publicFun() {} // should be allowed
|
||||||
public actual fun internalFun() {} // should be allowed
|
public actual fun internalFun() {} // should be allowed
|
||||||
|
|||||||
+4
-1
@@ -3,5 +3,8 @@ Exit code: OK
|
|||||||
Output:
|
Output:
|
||||||
|
|
||||||
-- JVM --
|
-- JVM --
|
||||||
Exit code: OK
|
Exit code: COMPILATION_ERROR
|
||||||
Output:
|
Output:
|
||||||
|
compiler/testData/multiplatform/simpleNoImplKeywordOnTopLevelFunction/jvm.kt:3:5: error: declaration must be marked with 'actual'.
|
||||||
|
fun foo(s: String): Array<CharSequence?> = arrayOf(s)
|
||||||
|
^
|
||||||
|
|||||||
+3
-3
@@ -5,6 +5,6 @@ Output:
|
|||||||
-- JVM --
|
-- JVM --
|
||||||
Exit code: COMPILATION_ERROR
|
Exit code: COMPILATION_ERROR
|
||||||
Output:
|
Output:
|
||||||
compiler/testData/multiplatform/weakIncompatibilityWithoutActualModifier/common.kt:1:1: error: expect declaration `Foo` is incompatible with actual `Foo` because class kinds are different (class, interface, object, enum, annotation)
|
compiler/testData/multiplatform/weakIncompatibilityWithoutActualModifier/jvm.kt:1:11: error: declaration must be marked with 'actual'.
|
||||||
expect class Foo
|
interface Foo
|
||||||
^
|
^
|
||||||
|
|||||||
+2
-2
@@ -1,2 +1,2 @@
|
|||||||
class My
|
actual class My
|
||||||
fun bar() {}
|
actual fun bar() {}
|
||||||
Vendored
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
class My
|
actual class My
|
||||||
fun bar() {
|
actual fun bar() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user