K1: Implement a checker that disallows to have different member scopes for expect open and its actual
^KT-22841 Fixed Review: https://jetbrains.team/p/kt/reviews/11603/timeline The commit also introduces `@AllowDifferentMembersInActual` annotation in stdlib which allows to suppress the diagnostic
This commit is contained in:
+376
@@ -307,6 +307,382 @@ public class FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated extends Abst
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/widerVisibilityInActualClassifier.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class ActualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker {
|
||||
@Test
|
||||
@TestMetadata("actualTypealias.kt")
|
||||
public void testActualTypealias() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/actualTypealias.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("actualizeFakeOverridePropertyToJavaMethod.kt")
|
||||
public void testActualizeFakeOverridePropertyToJavaMethod() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/actualizeFakeOverridePropertyToJavaMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("actualizePrimaryConstructorWithSecondaryConstructor.kt")
|
||||
public void testActualizePrimaryConstructorWithSecondaryConstructor() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/actualizePrimaryConstructorWithSecondaryConstructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("actualizeSecondaryConstructorWithPrimaryConstructor.kt")
|
||||
public void testActualizeSecondaryConstructorWithPrimaryConstructor() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/actualizeSecondaryConstructorWithPrimaryConstructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInActualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("allowDifferentMembersInActual_class.kt")
|
||||
public void testAllowDifferentMembersInActual_class() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/allowDifferentMembersInActual_class.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("allowDifferentMembersInActual_typealias.kt")
|
||||
public void testAllowDifferentMembersInActual_typealias() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/allowDifferentMembersInActual_typealias.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("changeClassTypeParameterNames.kt")
|
||||
public void testChangeClassTypeParameterNames() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/changeClassTypeParameterNames.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("changeFunctionTypeParameterNamesInOverride.kt")
|
||||
public void testChangeFunctionTypeParameterNamesInOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/changeFunctionTypeParameterNamesInOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("changeLateinitInOverride.kt")
|
||||
public void testChangeLateinitInOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/changeLateinitInOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("changeModalityInOverride.kt")
|
||||
public void testChangeModalityInOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/changeModalityInOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("changeModalityOfSubstitutedFakeOverride.kt")
|
||||
public void testChangeModalityOfSubstitutedFakeOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/changeModalityOfSubstitutedFakeOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("changeModalityOfToStringInOverride.kt")
|
||||
public void testChangeModalityOfToStringInOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/changeModalityOfToStringInOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("changeParameterNameInOverride.kt")
|
||||
public void testChangeParameterNameInOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/changeParameterNameInOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("changeSetterVisibilityInOverride.kt")
|
||||
public void testChangeSetterVisibilityInOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/changeSetterVisibilityInOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("changeVisibilityInOverride.kt")
|
||||
public void testChangeVisibilityInOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/changeVisibilityInOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("covariantFunctionOverride.kt")
|
||||
public void testCovariantFunctionOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/covariantFunctionOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("covariantOverrideGenericUpperBound.kt")
|
||||
public void testCovariantOverrideGenericUpperBound() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/covariantOverrideGenericUpperBound.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("covariantOverrideGenerics.kt")
|
||||
public void testCovariantOverrideGenerics() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/covariantOverrideGenerics.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("covariantPropertyOverride.kt")
|
||||
public void testCovariantPropertyOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/covariantPropertyOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("fakeOverrideChangedToRealOverride.kt")
|
||||
public void testFakeOverrideChangedToRealOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/fakeOverrideChangedToRealOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("finalClassIsActualizedByOpenClass.kt")
|
||||
public void testFinalClassIsActualizedByOpenClass() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/finalClassIsActualizedByOpenClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("finalMethodIsActualizedByOpenMethod.kt")
|
||||
public void testFinalMethodIsActualizedByOpenMethod() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/finalMethodIsActualizedByOpenMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("flexibleTypesMatching.kt")
|
||||
public void testFlexibleTypesMatching() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/flexibleTypesMatching.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectClass.kt")
|
||||
public void testInjectClass() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectContextReceiverOverload.kt")
|
||||
public void testInjectContextReceiverOverload() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectContextReceiverOverload.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectEmptySuperClass.kt")
|
||||
public void testInjectEmptySuperClass() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectEmptySuperClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectExtensionReceiverOverload.kt")
|
||||
public void testInjectExtensionReceiverOverload() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectExtensionReceiverOverload.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectGenericUpperBoundOverload.kt")
|
||||
public void testInjectGenericUpperBoundOverload() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectGenericUpperBoundOverload.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectMethod_internalMethod.kt")
|
||||
public void testInjectMethod_internalMethod() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectMethod_internalMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectMethod_privateMethod.kt")
|
||||
public void testInjectMethod_privateMethod() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectMethod_privateMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectMethod_protectedMethod.kt")
|
||||
public void testInjectMethod_protectedMethod() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectMethod_protectedMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectMethod_publicMethod.kt")
|
||||
public void testInjectMethod_publicMethod() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectMethod_publicMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectMethod_publicMethodInJava.kt")
|
||||
public void testInjectMethod_publicMethodInJava() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectMethod_publicMethodInJava.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectParameterOverload.kt")
|
||||
public void testInjectParameterOverload() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectParameterOverload.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectParameterOverloadWithGenerics.kt")
|
||||
public void testInjectParameterOverloadWithGenerics() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectParameterOverloadWithGenerics.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectPrimaryConstructor.kt")
|
||||
public void testInjectPrimaryConstructor() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectPrimaryConstructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectPrivateProperty.kt")
|
||||
public void testInjectPrivateProperty() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectPrivateProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectProperty.kt")
|
||||
public void testInjectProperty() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectPropertyWithTheSameSignatureAsExistingFunction.kt")
|
||||
public void testInjectPropertyWithTheSameSignatureAsExistingFunction() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectPropertyWithTheSameSignatureAsExistingFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectPublicFakeOverrideMethod.kt")
|
||||
public void testInjectPublicFakeOverrideMethod() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectPublicFakeOverrideMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectSecondaryConstructor.kt")
|
||||
public void testInjectSecondaryConstructor() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectSecondaryConstructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectSupertype_SupertypeIsExpectActualPair.kt")
|
||||
public void testInjectSupertype_SupertypeIsExpectActualPair() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectSupertype_SupertypeIsExpectActualPair.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectSupertype_SupertypeIsExpectActualPair_transitiveFakeOverride.kt")
|
||||
public void testInjectSupertype_SupertypeIsExpectActualPair_transitiveFakeOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectSupertype_SupertypeIsExpectActualPair_transitiveFakeOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectVarargParameterOverload.kt")
|
||||
public void testInjectVarargParameterOverload() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectVarargParameterOverload.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nestedExpectOpenClass.kt")
|
||||
public void testNestedExpectOpenClass() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/nestedExpectOpenClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("propertyKindOverride.kt")
|
||||
public void testPropertyKindOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/propertyKindOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("severalMismatches.kt")
|
||||
public void testSeveralMismatches() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/severalMismatches.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("substitutedFakeOverrideChangedToRealOverride.kt")
|
||||
public void testSubstitutedFakeOverrideChangedToRealOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/substitutedFakeOverrideChangedToRealOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("superTypesAreTheSameModuloActualTypealias.kt")
|
||||
public void testSuperTypesAreTheSameModuloActualTypealias() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/superTypesAreTheSameModuloActualTypealias.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("superTypesAreTheSameModuloTypealias1.kt")
|
||||
public void testSuperTypesAreTheSameModuloTypealias1() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/superTypesAreTheSameModuloTypealias1.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("superTypesAreTheSameModuloTypealias2.kt")
|
||||
public void testSuperTypesAreTheSameModuloTypealias2() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/superTypesAreTheSameModuloTypealias2.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("supertypeIsExpectActual_covariantOverrideOfInjectedFromSuper.kt")
|
||||
public void testSupertypeIsExpectActual_covariantOverrideOfInjectedFromSuper() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_covariantOverrideOfInjectedFromSuper.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("supertypeIsExpectActual_covariantOverrideOfInjectedFromSuper_transitiveSubstitutionFakeOverride.kt")
|
||||
public void testSupertypeIsExpectActual_covariantOverrideOfInjectedFromSuper_transitiveSubstitutionFakeOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_covariantOverrideOfInjectedFromSuper_transitiveSubstitutionFakeOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("supertypeIsExpectActual_injectMethod.kt")
|
||||
public void testSupertypeIsExpectActual_injectMethod() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_injectMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("supertypeIsExpectActual_injectMethod_transitiveSubstitutionFakeOverride.kt")
|
||||
public void testSupertypeIsExpectActual_injectMethod_transitiveSubstitutionFakeOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_injectMethod_transitiveSubstitutionFakeOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("supertypeIsExpectActual_injectSupertype.kt")
|
||||
public void testSupertypeIsExpectActual_injectSupertype() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_injectSupertype.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("supertypeIsExpectActual_injectSupertype_transitiveSubstitutionFakeOverride.kt")
|
||||
public void testSupertypeIsExpectActual_injectSupertype_transitiveSubstitutionFakeOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_injectSupertype_transitiveSubstitutionFakeOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("supertypeIsExpectActual_simpleOverride.kt")
|
||||
public void testSupertypeIsExpectActual_simpleOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_simpleOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("supertypeIsExpectActual_simpleOverride_transitiveSubstitutionFakeOverride.kt")
|
||||
public void testSupertypeIsExpectActual_simpleOverride_transitiveSubstitutionFakeOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_simpleOverride_transitiveSubstitutionFakeOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("supertypeIsExpectActual_supertypeIsActualTypealias_injectMethod.kt")
|
||||
public void testSupertypeIsExpectActual_supertypeIsActualTypealias_injectMethod() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_supertypeIsActualTypealias_injectMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("supertypeIsExpectActual_supertypeIsActualTypealias_injectMethod_transitiveSubstitutionFakeOverride.kt")
|
||||
public void testSupertypeIsExpectActual_supertypeIsActualTypealias_injectMethod_transitiveSubstitutionFakeOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_supertypeIsActualTypealias_injectMethod_transitiveSubstitutionFakeOverride.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/multiplatform/annotationMatching")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
+376
@@ -307,6 +307,382 @@ public class FirOldFrontendMPPDiagnosticsWithPsiTestGenerated extends AbstractFi
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/widerVisibilityInActualClassifier.kt");
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
public class ActualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker {
|
||||
@Test
|
||||
@TestMetadata("actualTypealias.kt")
|
||||
public void testActualTypealias() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/actualTypealias.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("actualizeFakeOverridePropertyToJavaMethod.kt")
|
||||
public void testActualizeFakeOverridePropertyToJavaMethod() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/actualizeFakeOverridePropertyToJavaMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("actualizePrimaryConstructorWithSecondaryConstructor.kt")
|
||||
public void testActualizePrimaryConstructorWithSecondaryConstructor() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/actualizePrimaryConstructorWithSecondaryConstructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("actualizeSecondaryConstructorWithPrimaryConstructor.kt")
|
||||
public void testActualizeSecondaryConstructorWithPrimaryConstructor() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/actualizeSecondaryConstructorWithPrimaryConstructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInActualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("allowDifferentMembersInActual_class.kt")
|
||||
public void testAllowDifferentMembersInActual_class() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/allowDifferentMembersInActual_class.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("allowDifferentMembersInActual_typealias.kt")
|
||||
public void testAllowDifferentMembersInActual_typealias() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/allowDifferentMembersInActual_typealias.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("changeClassTypeParameterNames.kt")
|
||||
public void testChangeClassTypeParameterNames() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/changeClassTypeParameterNames.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("changeFunctionTypeParameterNamesInOverride.kt")
|
||||
public void testChangeFunctionTypeParameterNamesInOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/changeFunctionTypeParameterNamesInOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("changeLateinitInOverride.kt")
|
||||
public void testChangeLateinitInOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/changeLateinitInOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("changeModalityInOverride.kt")
|
||||
public void testChangeModalityInOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/changeModalityInOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("changeModalityOfSubstitutedFakeOverride.kt")
|
||||
public void testChangeModalityOfSubstitutedFakeOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/changeModalityOfSubstitutedFakeOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("changeModalityOfToStringInOverride.kt")
|
||||
public void testChangeModalityOfToStringInOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/changeModalityOfToStringInOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("changeParameterNameInOverride.kt")
|
||||
public void testChangeParameterNameInOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/changeParameterNameInOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("changeSetterVisibilityInOverride.kt")
|
||||
public void testChangeSetterVisibilityInOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/changeSetterVisibilityInOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("changeVisibilityInOverride.kt")
|
||||
public void testChangeVisibilityInOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/changeVisibilityInOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("covariantFunctionOverride.kt")
|
||||
public void testCovariantFunctionOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/covariantFunctionOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("covariantOverrideGenericUpperBound.kt")
|
||||
public void testCovariantOverrideGenericUpperBound() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/covariantOverrideGenericUpperBound.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("covariantOverrideGenerics.kt")
|
||||
public void testCovariantOverrideGenerics() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/covariantOverrideGenerics.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("covariantPropertyOverride.kt")
|
||||
public void testCovariantPropertyOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/covariantPropertyOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("fakeOverrideChangedToRealOverride.kt")
|
||||
public void testFakeOverrideChangedToRealOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/fakeOverrideChangedToRealOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("finalClassIsActualizedByOpenClass.kt")
|
||||
public void testFinalClassIsActualizedByOpenClass() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/finalClassIsActualizedByOpenClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("finalMethodIsActualizedByOpenMethod.kt")
|
||||
public void testFinalMethodIsActualizedByOpenMethod() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/finalMethodIsActualizedByOpenMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("flexibleTypesMatching.kt")
|
||||
public void testFlexibleTypesMatching() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/flexibleTypesMatching.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectClass.kt")
|
||||
public void testInjectClass() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectContextReceiverOverload.kt")
|
||||
public void testInjectContextReceiverOverload() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectContextReceiverOverload.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectEmptySuperClass.kt")
|
||||
public void testInjectEmptySuperClass() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectEmptySuperClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectExtensionReceiverOverload.kt")
|
||||
public void testInjectExtensionReceiverOverload() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectExtensionReceiverOverload.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectGenericUpperBoundOverload.kt")
|
||||
public void testInjectGenericUpperBoundOverload() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectGenericUpperBoundOverload.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectMethod_internalMethod.kt")
|
||||
public void testInjectMethod_internalMethod() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectMethod_internalMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectMethod_privateMethod.kt")
|
||||
public void testInjectMethod_privateMethod() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectMethod_privateMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectMethod_protectedMethod.kt")
|
||||
public void testInjectMethod_protectedMethod() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectMethod_protectedMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectMethod_publicMethod.kt")
|
||||
public void testInjectMethod_publicMethod() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectMethod_publicMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectMethod_publicMethodInJava.kt")
|
||||
public void testInjectMethod_publicMethodInJava() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectMethod_publicMethodInJava.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectParameterOverload.kt")
|
||||
public void testInjectParameterOverload() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectParameterOverload.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectParameterOverloadWithGenerics.kt")
|
||||
public void testInjectParameterOverloadWithGenerics() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectParameterOverloadWithGenerics.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectPrimaryConstructor.kt")
|
||||
public void testInjectPrimaryConstructor() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectPrimaryConstructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectPrivateProperty.kt")
|
||||
public void testInjectPrivateProperty() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectPrivateProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectProperty.kt")
|
||||
public void testInjectProperty() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectPropertyWithTheSameSignatureAsExistingFunction.kt")
|
||||
public void testInjectPropertyWithTheSameSignatureAsExistingFunction() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectPropertyWithTheSameSignatureAsExistingFunction.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectPublicFakeOverrideMethod.kt")
|
||||
public void testInjectPublicFakeOverrideMethod() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectPublicFakeOverrideMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectSecondaryConstructor.kt")
|
||||
public void testInjectSecondaryConstructor() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectSecondaryConstructor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectSupertype_SupertypeIsExpectActualPair.kt")
|
||||
public void testInjectSupertype_SupertypeIsExpectActualPair() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectSupertype_SupertypeIsExpectActualPair.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectSupertype_SupertypeIsExpectActualPair_transitiveFakeOverride.kt")
|
||||
public void testInjectSupertype_SupertypeIsExpectActualPair_transitiveFakeOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectSupertype_SupertypeIsExpectActualPair_transitiveFakeOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("injectVarargParameterOverload.kt")
|
||||
public void testInjectVarargParameterOverload() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/injectVarargParameterOverload.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nestedExpectOpenClass.kt")
|
||||
public void testNestedExpectOpenClass() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/nestedExpectOpenClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("propertyKindOverride.kt")
|
||||
public void testPropertyKindOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/propertyKindOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("severalMismatches.kt")
|
||||
public void testSeveralMismatches() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/severalMismatches.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("substitutedFakeOverrideChangedToRealOverride.kt")
|
||||
public void testSubstitutedFakeOverrideChangedToRealOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/substitutedFakeOverrideChangedToRealOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("superTypesAreTheSameModuloActualTypealias.kt")
|
||||
public void testSuperTypesAreTheSameModuloActualTypealias() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/superTypesAreTheSameModuloActualTypealias.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("superTypesAreTheSameModuloTypealias1.kt")
|
||||
public void testSuperTypesAreTheSameModuloTypealias1() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/superTypesAreTheSameModuloTypealias1.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("superTypesAreTheSameModuloTypealias2.kt")
|
||||
public void testSuperTypesAreTheSameModuloTypealias2() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/superTypesAreTheSameModuloTypealias2.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("supertypeIsExpectActual_covariantOverrideOfInjectedFromSuper.kt")
|
||||
public void testSupertypeIsExpectActual_covariantOverrideOfInjectedFromSuper() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_covariantOverrideOfInjectedFromSuper.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("supertypeIsExpectActual_covariantOverrideOfInjectedFromSuper_transitiveSubstitutionFakeOverride.kt")
|
||||
public void testSupertypeIsExpectActual_covariantOverrideOfInjectedFromSuper_transitiveSubstitutionFakeOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_covariantOverrideOfInjectedFromSuper_transitiveSubstitutionFakeOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("supertypeIsExpectActual_injectMethod.kt")
|
||||
public void testSupertypeIsExpectActual_injectMethod() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_injectMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("supertypeIsExpectActual_injectMethod_transitiveSubstitutionFakeOverride.kt")
|
||||
public void testSupertypeIsExpectActual_injectMethod_transitiveSubstitutionFakeOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_injectMethod_transitiveSubstitutionFakeOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("supertypeIsExpectActual_injectSupertype.kt")
|
||||
public void testSupertypeIsExpectActual_injectSupertype() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_injectSupertype.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("supertypeIsExpectActual_injectSupertype_transitiveSubstitutionFakeOverride.kt")
|
||||
public void testSupertypeIsExpectActual_injectSupertype_transitiveSubstitutionFakeOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_injectSupertype_transitiveSubstitutionFakeOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("supertypeIsExpectActual_simpleOverride.kt")
|
||||
public void testSupertypeIsExpectActual_simpleOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_simpleOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("supertypeIsExpectActual_simpleOverride_transitiveSubstitutionFakeOverride.kt")
|
||||
public void testSupertypeIsExpectActual_simpleOverride_transitiveSubstitutionFakeOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_simpleOverride_transitiveSubstitutionFakeOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("supertypeIsExpectActual_supertypeIsActualTypealias_injectMethod.kt")
|
||||
public void testSupertypeIsExpectActual_supertypeIsActualTypealias_injectMethod() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_supertypeIsActualTypealias_injectMethod.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("supertypeIsExpectActual_supertypeIsActualTypealias_injectMethod_transitiveSubstitutionFakeOverride.kt")
|
||||
public void testSupertypeIsExpectActual_supertypeIsActualTypealias_injectMethod_transitiveSubstitutionFakeOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker/supertypeIsExpectActual_supertypeIsActualTypealias_injectMethod_transitiveSubstitutionFakeOverride.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/multiplatform/annotationMatching")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
|
||||
@@ -36,6 +36,7 @@ import org.jetbrains.kotlin.resolve.calls.util.BuilderLambdaLabelingInfo;
|
||||
import org.jetbrains.kotlin.resolve.deprecation.DescriptorBasedDeprecationInfo;
|
||||
import org.jetbrains.kotlin.resolve.multiplatform.ExpectActualAnnotationsIncompatibilityType;
|
||||
import org.jetbrains.kotlin.resolve.multiplatform.ExpectActualCompatibility.Incompatible;
|
||||
import org.jetbrains.kotlin.resolve.multiplatform.ExpectActualMemberDiff;
|
||||
import org.jetbrains.kotlin.serialization.deserialization.IncompatibleVersionErrorData;
|
||||
import org.jetbrains.kotlin.types.KotlinType;
|
||||
|
||||
@@ -839,6 +840,32 @@ public interface Errors {
|
||||
|
||||
DiagnosticFactory1<KtNamedDeclaration, MemberDescriptor> EXPECT_AND_ACTUAL_IN_THE_SAME_MODULE = DiagnosticFactory1.create(WARNING, DECLARATION_NAME);
|
||||
|
||||
DiagnosticFactory3<KtClassLikeDeclaration, ClassifierDescriptorWithTypeParameters, Set<ExpectActualMemberDiff<CallableMemberDescriptor, ClassDescriptor>>, ClassDescriptor>
|
||||
ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER =
|
||||
DiagnosticFactory3.create(ERROR, DECLARATION_NAME);
|
||||
DiagnosticFactory1<KtCallableDeclaration, ExpectActualMemberDiff<CallableMemberDescriptor, ClassDescriptor>>
|
||||
NON_ACTUAL_MEMBER_DECLARED_IN_EXPECT_NON_FINAL_CLASSIFIER_ACTUALIZATION = DiagnosticFactory1.create(ERROR, DECLARATION_NAME);
|
||||
DiagnosticFactory1<KtCallableDeclaration, ExpectActualMemberDiff<CallableMemberDescriptor, ClassDescriptor>>
|
||||
RETURN_TYPE_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION = DiagnosticFactory1.create(ERROR, DECLARATION_RETURN_TYPE);
|
||||
DiagnosticFactory1<KtCallableDeclaration, ExpectActualMemberDiff<CallableMemberDescriptor, ClassDescriptor>>
|
||||
MODALITY_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION = DiagnosticFactory1.create(ERROR, MODALITY_MODIFIER);
|
||||
DiagnosticFactory1<KtCallableDeclaration, ExpectActualMemberDiff<CallableMemberDescriptor, ClassDescriptor>>
|
||||
VISIBILITY_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION = DiagnosticFactory1.create(ERROR, VISIBILITY_MODIFIER);
|
||||
DiagnosticFactory1<KtPropertyAccessor, ExpectActualMemberDiff<CallableMemberDescriptor, ClassDescriptor>>
|
||||
SETTER_VISIBILITY_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION = DiagnosticFactory1.create(ERROR, VISIBILITY_MODIFIER);
|
||||
DiagnosticFactory1<KtCallableDeclaration, ExpectActualMemberDiff<CallableMemberDescriptor, ClassDescriptor>>
|
||||
PARAMETER_NAME_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION = DiagnosticFactory1.create(ERROR, DECLARATION_NAME);
|
||||
DiagnosticFactory1<KtCallableDeclaration, ExpectActualMemberDiff<CallableMemberDescriptor, ClassDescriptor>>
|
||||
PROPERTY_KIND_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION = DiagnosticFactory1.create(ERROR, VAL_OR_VAR_NODE);
|
||||
DiagnosticFactory1<KtCallableDeclaration, ExpectActualMemberDiff<CallableMemberDescriptor, ClassDescriptor>>
|
||||
LATEINIT_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION = DiagnosticFactory1.create(ERROR, LATEINIT_MODIFIER);
|
||||
DiagnosticFactory1<KtCallableDeclaration, ExpectActualMemberDiff<CallableMemberDescriptor, ClassDescriptor>>
|
||||
TYPE_PARAMETER_NAMES_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION = DiagnosticFactory1.create(ERROR, TYPE_PARAMETERS_OR_DECLARATION_SIGNATURE);
|
||||
|
||||
DiagnosticFactory3<KtClassLikeDeclaration, ClassifierDescriptorWithTypeParameters, List<Name>, ClassDescriptor>
|
||||
ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_SUPERTYPES_AS_NON_FINAL_EXPECT_CLASSIFIER =
|
||||
DiagnosticFactory3.create(ERROR, DECLARATION_NAME);
|
||||
|
||||
DiagnosticFactory0<PsiElement> OPTIONAL_EXPECTATION_NOT_ON_EXPECTED = DiagnosticFactory0.create(ERROR);
|
||||
DiagnosticFactory0<PsiElement> OPTIONAL_DECLARATION_OUTSIDE_OF_ANNOTATION_ENTRY = DiagnosticFactory0.create(ERROR);
|
||||
DiagnosticFactory0<PsiElement> OPTIONAL_DECLARATION_USAGE_IN_NON_COMMON_SOURCE = DiagnosticFactory0.create(ERROR);
|
||||
|
||||
+37
-1
@@ -395,6 +395,42 @@ public class DefaultErrorMessages {
|
||||
"{0}: expect and corresponding actual are declared in the same module, which will be prohibited in Kotlin 2.0. See https://youtrack.jetbrains.com/issue/KT-55177",
|
||||
CAPITALIZED_DECLARATION_NAME_WITH_KIND_AND_PLATFORM);
|
||||
|
||||
MAP.put(ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER,
|
||||
"{0}: actual class and its non-final expect class must declare exactly the same non-private members. " +
|
||||
"The following non-private members in actual class are mismatched:{1}\n" +
|
||||
"This error happens because the expect class ''{2}'' is non-final. " +
|
||||
"Also see https://youtrack.jetbrains.com/issue/KT-22841 for more details",
|
||||
CAPITALIZED_DECLARATION_NAME_WITH_KIND_AND_PLATFORM,
|
||||
ExpectActualScopeDiffsRenderer.TEXT,
|
||||
NAME);
|
||||
MAP.put(NON_ACTUAL_MEMBER_DECLARED_IN_EXPECT_NON_FINAL_CLASSIFIER_ACTUALIZATION,
|
||||
"{0}. Also see https://youtrack.jetbrains.com/issue/KT-22841 for more details", ExpectActualScopeDiffRenderer.INSTANCE);
|
||||
MAP.put(RETURN_TYPE_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION,
|
||||
"{0}. Also see https://youtrack.jetbrains.com/issue/KT-22841 for more details", ExpectActualScopeDiffRenderer.INSTANCE);
|
||||
MAP.put(MODALITY_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION,
|
||||
"{0}. Also see https://youtrack.jetbrains.com/issue/KT-22841 for more details", ExpectActualScopeDiffRenderer.INSTANCE);
|
||||
MAP.put(VISIBILITY_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION,
|
||||
"{0}. Also see https://youtrack.jetbrains.com/issue/KT-22841 for more details", ExpectActualScopeDiffRenderer.INSTANCE);
|
||||
MAP.put(PARAMETER_NAME_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION,
|
||||
"{0}. Also see https://youtrack.jetbrains.com/issue/KT-22841 for more details", ExpectActualScopeDiffRenderer.INSTANCE);
|
||||
MAP.put(PROPERTY_KIND_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION,
|
||||
"{0}. Also see https://youtrack.jetbrains.com/issue/KT-22841 for more details", ExpectActualScopeDiffRenderer.INSTANCE);
|
||||
MAP.put(LATEINIT_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION,
|
||||
"{0}. Also see https://youtrack.jetbrains.com/issue/KT-22841 for more details", ExpectActualScopeDiffRenderer.INSTANCE);
|
||||
MAP.put(SETTER_VISIBILITY_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION,
|
||||
"{0}. Also see https://youtrack.jetbrains.com/issue/KT-22841 for more details", ExpectActualScopeDiffRenderer.INSTANCE);
|
||||
MAP.put(TYPE_PARAMETER_NAMES_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION,
|
||||
"{0}. Also see https://youtrack.jetbrains.com/issue/KT-22841 for more details", ExpectActualScopeDiffRenderer.INSTANCE);
|
||||
|
||||
MAP.put(ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_SUPERTYPES_AS_NON_FINAL_EXPECT_CLASSIFIER,
|
||||
"{0}: actual class and its non-final expect class must declare exactly the same supertypes. " +
|
||||
"Actual class declares the following supertypes that are not presented in expect class: {1}. " +
|
||||
"This error happens because the expect class ''{2}'' is non-final. " +
|
||||
"Also see https://youtrack.jetbrains.com/issue/KT-22841 for more details",
|
||||
CAPITALIZED_DECLARATION_NAME_WITH_KIND_AND_PLATFORM,
|
||||
new ListRenderer<>(TO_STRING, (elem) -> "'" + elem + "'"),
|
||||
NAME);
|
||||
|
||||
MAP.put(OPTIONAL_EXPECTATION_NOT_ON_EXPECTED, "'@OptionalExpectation' can only be used on an expected annotation class");
|
||||
MAP.put(OPTIONAL_DECLARATION_OUTSIDE_OF_ANNOTATION_ENTRY, "Declaration annotated with '@OptionalExpectation' can only be used inside an annotation entry");
|
||||
MAP.put(OPTIONAL_DECLARATION_USAGE_IN_NON_COMMON_SOURCE, "Declaration annotated with '@OptionalExpectation' can only be used in common module sources");
|
||||
@@ -1287,7 +1323,7 @@ public class DefaultErrorMessages {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static DiagnosticParameterRenderer<List<Pair<MemberDescriptor, Map<Incompatible<MemberDescriptor>, Collection<MemberDescriptor>>>>> adaptGenerics2(DiagnosticParameterRenderer<List<? extends Pair<? extends MemberDescriptor, ? extends Map<ExpectActualCompatibility.Incompatible<? extends MemberDescriptor>, ? extends Collection<? extends MemberDescriptor>>>>> renderer) {
|
||||
public static DiagnosticParameterRenderer<List<Pair<MemberDescriptor, Map<Incompatible<MemberDescriptor>, Collection<MemberDescriptor>>>>> adaptGenerics2(DiagnosticParameterRenderer<List<? extends Pair<? extends MemberDescriptor, ? extends Map<Incompatible<? extends MemberDescriptor>, ? extends Collection<? extends MemberDescriptor>>>>> renderer) {
|
||||
return (obj, renderingContext) -> renderer.render((List)obj, renderingContext);
|
||||
}
|
||||
|
||||
|
||||
+47
@@ -16,9 +16,13 @@
|
||||
|
||||
package org.jetbrains.kotlin.diagnostics.rendering
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.MemberDescriptor
|
||||
import org.jetbrains.kotlin.resolve.multiplatform.ExpectActualCompatibility.Incompatible
|
||||
import org.jetbrains.kotlin.resolve.multiplatform.ExpectActualMemberDiff
|
||||
import java.text.MessageFormat
|
||||
|
||||
class PlatformIncompatibilityDiagnosticRenderer(
|
||||
private val mode: MultiplatformDiagnosticRenderingMode
|
||||
@@ -62,6 +66,49 @@ class IncompatibleExpectedActualClassScopesRenderer(
|
||||
}
|
||||
}
|
||||
|
||||
class ExpectActualScopeDiffsRenderer(
|
||||
private val mode: MultiplatformDiagnosticRenderingMode,
|
||||
) : DiagnosticParameterRenderer<Set<ExpectActualMemberDiff<CallableMemberDescriptor, ClassDescriptor>>> {
|
||||
override fun render(
|
||||
obj: Set<ExpectActualMemberDiff<CallableMemberDescriptor, ClassDescriptor>>,
|
||||
renderingContext: RenderingContext,
|
||||
): String {
|
||||
check(obj.isNotEmpty())
|
||||
return buildString {
|
||||
mode.renderList(this, obj.toList().map { diff ->
|
||||
{
|
||||
appendLine()
|
||||
appendLine(ExpectActualScopeDiffRenderer.render(diff, renderingContext))
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
@JvmField
|
||||
val TEXT = ExpectActualScopeDiffsRenderer(MultiplatformDiagnosticRenderingMode())
|
||||
}
|
||||
}
|
||||
|
||||
object ExpectActualScopeDiffRenderer : DiagnosticParameterRenderer<ExpectActualMemberDiff<CallableMemberDescriptor, ClassDescriptor>> {
|
||||
override fun render(
|
||||
obj: ExpectActualMemberDiff<CallableMemberDescriptor, ClassDescriptor>,
|
||||
renderingContext: RenderingContext,
|
||||
): String = MessageFormat.format(
|
||||
obj.kind.rawMessage,
|
||||
Renderers.DECLARATION_NAME_WITH_KIND.render(obj.actualMember, renderingContext),
|
||||
Renderers.NAME.render(obj.expectClass)
|
||||
)
|
||||
}
|
||||
|
||||
class ListRenderer<T>(
|
||||
private val elementRenderer: DiagnosticParameterRenderer<T>,
|
||||
private val elemProcessor: (String) -> String = { it },
|
||||
) : DiagnosticParameterRenderer<List<T>> {
|
||||
override fun render(obj: List<T>, renderingContext: RenderingContext): String =
|
||||
obj.joinToString { elemProcessor(elementRenderer.render(it, renderingContext)) }
|
||||
}
|
||||
|
||||
open class MultiplatformDiagnosticRenderingMode {
|
||||
open fun newLine(sb: StringBuilder) {
|
||||
sb.appendLine()
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.jetbrains.kotlin.types.DynamicTypesSettings
|
||||
|
||||
private val DEFAULT_DECLARATION_CHECKERS = listOf(
|
||||
ExpectActualInTheSameModuleChecker,
|
||||
ActualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker,
|
||||
DataClassDeclarationChecker(),
|
||||
ConstModifierChecker,
|
||||
UnderscoreChecker,
|
||||
|
||||
+360
@@ -0,0 +1,360 @@
|
||||
/*
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.resolve.checkers
|
||||
|
||||
import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.diagnostics.Errors
|
||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.resolve.BindingTrace
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.*
|
||||
import org.jetbrains.kotlin.resolve.multiplatform.*
|
||||
import org.jetbrains.kotlin.resolve.scopes.MemberScope
|
||||
import org.jetbrains.kotlin.resolve.source.KotlinSourceElement
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
import org.jetbrains.kotlin.types.model.TypeSubstitutorMarker
|
||||
import java.util.*
|
||||
import kotlin.contracts.ExperimentalContracts
|
||||
import kotlin.contracts.contract
|
||||
|
||||
object ActualClassifierMustHasTheSameMembersAsNonFinalExpectClassifierChecker : DeclarationChecker {
|
||||
override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) {
|
||||
val (actual, expect) = matchActualWithNonFinalExpect(declaration, descriptor, context) ?: return
|
||||
|
||||
// The explicit casts won't be necessary when we start compiling kotlin with K2. K1 doesn't build CFG properly
|
||||
declaration as KtClassLikeDeclaration
|
||||
descriptor as ClassifierDescriptorWithTypeParameters
|
||||
|
||||
checkSupertypes(actual, expect, context, declaration, descriptor)
|
||||
checkExpectActualScopeDiff(expect, actual, context, declaration, descriptor)
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkSupertypes(
|
||||
actual: ClassDescriptor,
|
||||
expect: ClassDescriptor,
|
||||
context: DeclarationCheckerContext,
|
||||
declaration: KtClassLikeDeclaration,
|
||||
descriptor: ClassifierDescriptorWithTypeParameters,
|
||||
) {
|
||||
val addedSupertypes = (actual.getSuperInterfaces() + listOfNotNull(actual.getSuperClassNotAny())).map(ClassDescriptor::fqNameSafe) -
|
||||
(expect.getSuperInterfaces() + listOfNotNull(expect.getSuperClassNotAny())).map(ClassDescriptor::fqNameSafe).toSet()
|
||||
|
||||
if (addedSupertypes.isNotEmpty()) {
|
||||
context.trace.report(
|
||||
Errors.ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_SUPERTYPES_AS_NON_FINAL_EXPECT_CLASSIFIER.on(
|
||||
declaration,
|
||||
descriptor,
|
||||
addedSupertypes.map(FqName::shortName),
|
||||
expect,
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkExpectActualScopeDiff(
|
||||
expect: ClassDescriptor,
|
||||
actual: ClassDescriptor,
|
||||
context: DeclarationCheckerContext,
|
||||
declaration: KtClassLikeDeclaration,
|
||||
descriptor: ClassifierDescriptorWithTypeParameters,
|
||||
) {
|
||||
val scopeDiff = calculateExpectActualScopeDiff(expect, actual)
|
||||
if (scopeDiff.isNotEmpty()) {
|
||||
context.trace.report(
|
||||
Errors.ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER.on(
|
||||
declaration,
|
||||
descriptor,
|
||||
scopeDiff,
|
||||
scopeDiff.first().expectClass, // All expect classes in scopeDiff are the same
|
||||
)
|
||||
)
|
||||
}
|
||||
if (descriptor !is TypeAliasDescriptor) {
|
||||
for (diff in scopeDiff) {
|
||||
// If it can't be reported, it's not a big deal, because this error is already
|
||||
// reported on the 'actual class' itself (see code above)
|
||||
context.trace.reportIfPossible(diff)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val allowDifferentMembersInActualFqn = FqName("kotlin.AllowDifferentMembersInActual")
|
||||
|
||||
@OptIn(ExperimentalContracts::class)
|
||||
internal fun matchActualWithNonFinalExpect(
|
||||
declaration: KtDeclaration,
|
||||
descriptor: DeclarationDescriptor,
|
||||
context: DeclarationCheckerContext,
|
||||
): Pair<ClassDescriptor, ClassDescriptor>? {
|
||||
contract {
|
||||
returnsNotNull() implies (declaration is KtClassLikeDeclaration)
|
||||
returnsNotNull() implies (descriptor is ClassifierDescriptorWithTypeParameters)
|
||||
}
|
||||
if (!context.languageVersionSettings.supportsFeature(LanguageFeature.MultiPlatformProjects)) return null
|
||||
if (declaration !is KtTypeAlias && declaration !is KtClassOrObject) return null
|
||||
if (descriptor !is TypeAliasDescriptor && descriptor !is ClassDescriptor) return null
|
||||
|
||||
// Common supertype of KtTypeAlias and KtClassOrObject is KtClassLikeDeclaration.
|
||||
// Common supertype of TypeAliasDescriptor and ClassDescriptor is ClassifierDescriptorWithTypeParameters.
|
||||
// The explicit casts won't be necessary when we start compiling kotlin with K2.
|
||||
declaration as KtClassLikeDeclaration
|
||||
descriptor as ClassifierDescriptorWithTypeParameters
|
||||
|
||||
if (!descriptor.isActual) return null
|
||||
|
||||
with(OptInUsageChecker) {
|
||||
if (declaration.isDeclarationAnnotatedWith(allowDifferentMembersInActualFqn, context.trace.bindingContext)) return null
|
||||
}
|
||||
|
||||
val actual = when (descriptor) {
|
||||
is ClassDescriptor -> descriptor
|
||||
is TypeAliasDescriptor -> descriptor.classDescriptor
|
||||
else -> error("ClassifierDescriptorWithTypeParameters has only two inheritors")
|
||||
} ?: return null
|
||||
// If actual is final then expect is final as well (otherwise another checker will report a diagnostic).
|
||||
// There is no need to waste time searching for the appropriate expect and checking its modality. This `if` is an optimization
|
||||
if (actual.modality == Modality.FINAL) return null
|
||||
|
||||
val expect = ExpectedActualResolver.findExpectedForActual(descriptor)
|
||||
?.get(ExpectActualCompatibility.Compatible)
|
||||
?.singleOrNull() as? ClassDescriptor // if actual has more than one expects then it will be reported by another checker
|
||||
?: return null
|
||||
|
||||
if (expect.modality == Modality.FINAL) return null
|
||||
return actual to expect
|
||||
}
|
||||
|
||||
private fun calculateExpectActualScopeDiff(
|
||||
expect: ClassDescriptor,
|
||||
actual: ClassDescriptor,
|
||||
): Set<ExpectActualMemberDiff<CallableMemberDescriptor, ClassDescriptor>> {
|
||||
val matchingContext = ClassicExpectActualMatchingContext(actual.module)
|
||||
val classTypeSubstitutor = matchingContext.createExpectActualTypeParameterSubstitutor(
|
||||
expect.declaredTypeParameters,
|
||||
actual.declaredTypeParameters,
|
||||
parentSubstitutor = null
|
||||
)
|
||||
|
||||
val expectClassCallables = expect.unsubstitutedMemberScope
|
||||
.extractNonPrivateCallables(classTypeSubstitutor, ExpectActual.EXPECT, matchingContext)
|
||||
val actualClassCallables = actual.unsubstitutedMemberScope
|
||||
.extractNonPrivateCallables(classTypeSubstitutor, ExpectActual.ACTUAL, matchingContext)
|
||||
.filter { it.descriptor.kind.isReal } // Filter out fake-overrides from actual because we compare list of supertypes separately anyway
|
||||
|
||||
val nameAndKindToExpectCallable = expectClassCallables.groupBy { it.name to it.kind }
|
||||
|
||||
return (actualClassCallables - expectClassCallables).asSequence()
|
||||
.flatMap { unmatchedActualCallable ->
|
||||
when (val expectCallablesWithTheSameNameAndKind =
|
||||
nameAndKindToExpectCallable[unmatchedActualCallable.name to unmatchedActualCallable.kind]) {
|
||||
null -> listOf(ExpectActualMemberDiff.Kind.NonPrivateCallableAdded)
|
||||
else -> expectCallablesWithTheSameNameAndKind.map {
|
||||
calculateExpectActualMemberDiffKind(
|
||||
expect = it,
|
||||
actual = unmatchedActualCallable,
|
||||
checkParameterNames = unmatchedActualCallable.descriptor.hasStableParameterNames()
|
||||
)
|
||||
}
|
||||
}.filterNotNull().map { kind -> ExpectActualMemberDiff(kind, unmatchedActualCallable.descriptor, expect) }
|
||||
}
|
||||
.toSet()
|
||||
}
|
||||
|
||||
private fun MemberScope.extractNonPrivateCallables(
|
||||
classTypeSubstitutor: TypeSubstitutorMarker,
|
||||
expectActual: ExpectActual,
|
||||
matchingContext: ClassicExpectActualMatchingContext,
|
||||
): Set<Callable> {
|
||||
val functions =
|
||||
getFunctionNames().asSequence().flatMap { getContributedFunctions(it, NoLookupLocation.WHEN_GET_ALL_DESCRIPTORS) }
|
||||
val properties =
|
||||
getVariableNames().asSequence().flatMap { getContributedVariables(it, NoLookupLocation.WHEN_GET_ALL_DESCRIPTORS) }
|
||||
return (functions + properties).filter { !Visibilities.isPrivate(it.visibility.delegate) }
|
||||
.map { descriptor -> Callable(descriptor, expectActual, classTypeSubstitutor, matchingContext) }
|
||||
.toSet()
|
||||
}
|
||||
|
||||
private data class Parameter(val name: Name, val type: KotlinType)
|
||||
private enum class Kind { FUNCTION, PROPERTY }
|
||||
private enum class ExpectActual { EXPECT, ACTUAL }
|
||||
private data class TypeParameter(val name: Name, val upperBounds: List<KotlinType>)
|
||||
private class Callable(
|
||||
val descriptor: CallableMemberDescriptor,
|
||||
val expectActual: ExpectActual,
|
||||
val classTypeSubstitutor: TypeSubstitutorMarker,
|
||||
val matchingContext: ClassicExpectActualMatchingContext,
|
||||
) {
|
||||
val name: Name = descriptor.name
|
||||
val kind: Kind = when (descriptor) {
|
||||
is PropertyDescriptor -> Kind.PROPERTY
|
||||
is FunctionDescriptor -> Kind.FUNCTION
|
||||
else -> error("Unknown kind $descriptor")
|
||||
}
|
||||
val isVarProperty: Boolean = descriptor is PropertyDescriptor && descriptor.isVar
|
||||
val isLateinitProperty: Boolean = descriptor is PropertyDescriptor && descriptor.isLateInit
|
||||
val modality: Modality = descriptor.modality
|
||||
val visibility: Visibility = descriptor.visibility.delegate
|
||||
val setterVisibility: Visibility? = (descriptor as? PropertyDescriptor)?.setter?.visibility?.delegate
|
||||
val parameters: List<Parameter> = descriptor.valueParameters.map { Parameter(it.name, it.type) }
|
||||
val returnType: KotlinType = descriptor.returnType ?: error("Can't get return type")
|
||||
val extensionReceiverType: KotlinType? = descriptor.extensionReceiverParameter?.type
|
||||
val typeParameters: List<TypeParameter> = descriptor.typeParameters.map { TypeParameter(it.name, it.upperBounds) }
|
||||
val contextReceiverTypes: List<KotlinType> = descriptor.contextReceiverParameters.map(ValueDescriptor::getType)
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (other !is Callable) return false
|
||||
check(classTypeSubstitutor === other.classTypeSubstitutor)
|
||||
check(matchingContext === other.matchingContext)
|
||||
return if (expectActual == other.expectActual) {
|
||||
name == other.name &&
|
||||
kind == other.kind &&
|
||||
isVarProperty == other.isVarProperty &&
|
||||
isLateinitProperty == other.isLateinitProperty &&
|
||||
modality == other.modality &&
|
||||
visibility == other.visibility &&
|
||||
setterVisibility == other.setterVisibility &&
|
||||
parameters == other.parameters &&
|
||||
returnType == other.returnType &&
|
||||
extensionReceiverType == other.extensionReceiverType &&
|
||||
typeParameters == other.typeParameters &&
|
||||
contextReceiverTypes == other.contextReceiverTypes
|
||||
} else {
|
||||
val (expect, actual) = if (expectActual == ExpectActual.EXPECT) this to other else other to this
|
||||
calculateExpectActualMemberDiffKind(expect, actual) == null
|
||||
}
|
||||
}
|
||||
|
||||
override fun hashCode(): Int = // Don't hash the types because type comparison is complicated
|
||||
Objects.hash(
|
||||
name,
|
||||
kind,
|
||||
isVarProperty,
|
||||
isLateinitProperty,
|
||||
modality,
|
||||
visibility,
|
||||
setterVisibility,
|
||||
parameters.map(Parameter::name),
|
||||
extensionReceiverType != null,
|
||||
typeParameters.map(TypeParameter::name),
|
||||
contextReceiverTypes.size,
|
||||
)
|
||||
}
|
||||
|
||||
private val CallableMemberDescriptor.psiIfReal: KtCallableDeclaration?
|
||||
get() = takeIf { it.kind.isReal }?.source?.let { it as? KotlinSourceElement }?.psi as? KtCallableDeclaration
|
||||
|
||||
private fun ClassicExpectActualMatchingContext.areCompatibleWithSubstitution(
|
||||
expect: KotlinType?,
|
||||
actual: KotlinType?,
|
||||
substitutor: TypeSubstitutorMarker,
|
||||
): Boolean = areCompatibleExpectActualTypes(expect?.let { substitutor.safeSubstitute(it) }, actual)
|
||||
|
||||
private fun ClassicExpectActualMatchingContext.areCompatibleListWithSubstitution(
|
||||
expect: List<KotlinType>,
|
||||
actual: List<KotlinType>,
|
||||
substitutor: TypeSubstitutorMarker,
|
||||
): Boolean = expect.size == actual.size && expect.asSequence().zip(actual.asSequence())
|
||||
.all { (a, b) -> areCompatibleWithSubstitution(a, b, substitutor) }
|
||||
|
||||
private fun ClassicExpectActualMatchingContext.areCompatibleUpperBoundsWithSubstitution(
|
||||
expect: List<List<KotlinType>>,
|
||||
actual: List<List<KotlinType>>,
|
||||
substitutor: TypeSubstitutorMarker,
|
||||
): Boolean = expect.size == actual.size && expect.asSequence().zip(actual.asSequence())
|
||||
.all { (a, b) -> areCompatibleListWithSubstitution(a, b, substitutor) }
|
||||
|
||||
private fun calculateExpectActualMemberDiffKind(
|
||||
expect: Callable,
|
||||
actual: Callable,
|
||||
checkParameterNames: Boolean = true,
|
||||
): ExpectActualMemberDiff.Kind? {
|
||||
check(expect.expectActual == ExpectActual.EXPECT)
|
||||
check(actual.expectActual == ExpectActual.ACTUAL)
|
||||
check(expect.classTypeSubstitutor === actual.classTypeSubstitutor)
|
||||
check(expect.matchingContext === actual.matchingContext)
|
||||
val substitutor = actual.matchingContext.createExpectActualTypeParameterSubstitutor(
|
||||
expect.descriptor.typeParameters,
|
||||
actual.descriptor.typeParameters,
|
||||
actual.classTypeSubstitutor
|
||||
)
|
||||
with(actual.matchingContext) {
|
||||
return when {
|
||||
expect.name != actual.name ||
|
||||
expect.kind != actual.kind ||
|
||||
!areCompatibleListWithSubstitution(
|
||||
expect.parameters.map(Parameter::type),
|
||||
actual.parameters.map(Parameter::type),
|
||||
substitutor
|
||||
) ||
|
||||
!areCompatibleUpperBoundsWithSubstitution(
|
||||
expect.typeParameters.map(TypeParameter::upperBounds),
|
||||
actual.typeParameters.map(TypeParameter::upperBounds),
|
||||
substitutor
|
||||
) ||
|
||||
!areCompatibleWithSubstitution(
|
||||
expect.extensionReceiverType,
|
||||
actual.extensionReceiverType,
|
||||
substitutor
|
||||
) ||
|
||||
!areCompatibleListWithSubstitution(
|
||||
expect.contextReceiverTypes,
|
||||
actual.contextReceiverTypes,
|
||||
substitutor
|
||||
) ->
|
||||
ExpectActualMemberDiff.Kind.NonPrivateCallableAdded
|
||||
|
||||
expect.isVarProperty != actual.isVarProperty -> ExpectActualMemberDiff.Kind.PropertyKindChangedInOverride
|
||||
|
||||
expect.isLateinitProperty != actual.isLateinitProperty -> ExpectActualMemberDiff.Kind.LateinitChangedInOverride
|
||||
|
||||
expect.modality != actual.modality -> ExpectActualMemberDiff.Kind.ModalityChangedInOverride
|
||||
|
||||
expect.visibility != actual.visibility -> ExpectActualMemberDiff.Kind.VisibilityChangedInOverride
|
||||
|
||||
expect.setterVisibility != actual.setterVisibility -> ExpectActualMemberDiff.Kind.SetterVisibilityChangedInOverride
|
||||
|
||||
checkParameterNames && expect.parameters.map(Parameter::name) != actual.parameters.map(Parameter::name) ->
|
||||
ExpectActualMemberDiff.Kind.ParameterNameChangedInOverride
|
||||
|
||||
expect.typeParameters.map(TypeParameter::name) != actual.typeParameters.map(TypeParameter::name) ->
|
||||
ExpectActualMemberDiff.Kind.TypeParameterNamesChangedInOverride
|
||||
|
||||
!areCompatibleWithSubstitution(expect.returnType, actual.returnType, substitutor) ->
|
||||
ExpectActualMemberDiff.Kind.ReturnTypeChangedInOverride
|
||||
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun BindingTrace.reportIfPossible(diff: ExpectActualMemberDiff<CallableMemberDescriptor, ClassDescriptor>) {
|
||||
val psi = diff.actualMember.psiIfReal ?: return
|
||||
val diagnostic = when (diff.kind) {
|
||||
ExpectActualMemberDiff.Kind.NonPrivateCallableAdded ->
|
||||
Errors.NON_ACTUAL_MEMBER_DECLARED_IN_EXPECT_NON_FINAL_CLASSIFIER_ACTUALIZATION.on(psi, diff)
|
||||
ExpectActualMemberDiff.Kind.ReturnTypeChangedInOverride ->
|
||||
Errors.RETURN_TYPE_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION.on(psi, diff)
|
||||
ExpectActualMemberDiff.Kind.ModalityChangedInOverride ->
|
||||
Errors.MODALITY_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION.on(psi, diff)
|
||||
ExpectActualMemberDiff.Kind.VisibilityChangedInOverride ->
|
||||
Errors.VISIBILITY_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION.on(psi, diff)
|
||||
ExpectActualMemberDiff.Kind.SetterVisibilityChangedInOverride ->
|
||||
Errors.SETTER_VISIBILITY_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION.on((psi as? KtProperty)?.setter ?: return, diff)
|
||||
ExpectActualMemberDiff.Kind.ParameterNameChangedInOverride ->
|
||||
Errors.PARAMETER_NAME_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION.on(psi, diff)
|
||||
ExpectActualMemberDiff.Kind.PropertyKindChangedInOverride ->
|
||||
Errors.PROPERTY_KIND_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION.on(psi, diff)
|
||||
ExpectActualMemberDiff.Kind.LateinitChangedInOverride ->
|
||||
Errors.LATEINIT_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION.on(psi, diff)
|
||||
ExpectActualMemberDiff.Kind.TypeParameterNamesChangedInOverride ->
|
||||
Errors.TYPE_PARAMETER_NAMES_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION.on(psi, diff)
|
||||
}
|
||||
report(diagnostic)
|
||||
}
|
||||
+3
@@ -1,4 +1,5 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// WITH_STDLIB
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
// IGNORE_BACKEND_K2: ANY
|
||||
// FIR status: outdated code (expect and actual in the same module)
|
||||
@@ -20,6 +21,8 @@ actual interface I {
|
||||
actual fun test(source: String = "actual")
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalMultiplatform::class)
|
||||
@AllowDifferentMembersInActual
|
||||
actual interface J : I {
|
||||
override fun test(source: String) {
|
||||
if (source != "actual") throw AssertionError(source)
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* Js backend is ignored because they use old test infrastructure which doesn't support HMPP
|
||||
*/
|
||||
|
||||
// WITH_STDLIB
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
|
||||
// TARGET_BACKEND: JVM
|
||||
@@ -25,6 +26,8 @@ fun getB(): B = B()
|
||||
|
||||
// MODULE: main()()(intermediate)
|
||||
// FILE: main.kt
|
||||
@OptIn(ExperimentalMultiplatform::class)
|
||||
@AllowDifferentMembersInActual
|
||||
actual open class A actual constructor() {
|
||||
fun bar(): String = "K"
|
||||
}
|
||||
|
||||
+5
@@ -1,4 +1,5 @@
|
||||
// IGNORE_BACKEND_K1: JS, JS_IR, JS_IR_ES6, NATIVE, WASM
|
||||
// WITH_STDLIB
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
|
||||
// MODULE: common
|
||||
@@ -17,12 +18,16 @@ class B : A()
|
||||
// MODULE: platform()()(common)
|
||||
// FILE: platform.kt
|
||||
|
||||
@OptIn(ExperimentalMultiplatform::class)
|
||||
@AllowDifferentMembersInActual
|
||||
actual interface S1 {
|
||||
fun o(): S = "O"
|
||||
val p: Boolean
|
||||
get() = true
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalMultiplatform::class)
|
||||
@AllowDifferentMembersInActual
|
||||
actual interface S2 {
|
||||
fun k() = "K"
|
||||
}
|
||||
|
||||
+7
@@ -1,4 +1,5 @@
|
||||
// IGNORE_BACKEND_K1: JS, JS_IR, JS_IR_ES6, NATIVE, WASM
|
||||
// WITH_STDLIB
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
|
||||
// MODULE: common
|
||||
@@ -17,6 +18,8 @@ class B : A()
|
||||
// MODULE: platform()()(common)
|
||||
// FILE: platform.kt
|
||||
|
||||
@OptIn(ExperimentalMultiplatform::class)
|
||||
@AllowDifferentMembersInActual
|
||||
actual interface S1 {
|
||||
fun s1() = "O"
|
||||
}
|
||||
@@ -25,9 +28,13 @@ interface S20 {
|
||||
fun s2() = "K"
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalMultiplatform::class)
|
||||
@AllowDifferentMembersInActual
|
||||
actual interface S2 : S20 {
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalMultiplatform::class)
|
||||
@AllowDifferentMembersInActual
|
||||
actual interface S : S1, S2 {
|
||||
fun s3() = s1() + s2()
|
||||
}
|
||||
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Foo {
|
||||
fun existingMethod()
|
||||
val existingParam: Int
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual typealias Foo = FooImpl
|
||||
|
||||
open class FooImpl {
|
||||
fun existingMethod() {}
|
||||
val existingParam: Int = 904
|
||||
|
||||
fun injectedMethod() {} // accidential override can happen with this injected fun. That's why it's prohibited
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Foo {
|
||||
fun existingMethod()
|
||||
val existingParam: Int
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual typealias <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER!>Foo<!> = FooImpl
|
||||
|
||||
open class FooImpl {
|
||||
fun existingMethod() {}
|
||||
val existingParam: Int = 904
|
||||
|
||||
fun injectedMethod() {} // accidential override can happen with this injected fun. That's why it's prohibited
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// FIR_IDENTICAL
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
open class Base() {
|
||||
open val foo: Int = 1
|
||||
}
|
||||
|
||||
expect open class Foo : Base {
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual typealias Foo = FooImpl
|
||||
|
||||
// FILE: Foo.java
|
||||
|
||||
public class FooImpl extends Base {
|
||||
@Override
|
||||
public int getFoo() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// FIR_IDENTICAL
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Foo() {
|
||||
fun existingFun()
|
||||
val existingParam: Int
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Foo {
|
||||
actual fun existingFun() {}
|
||||
actual val existingParam: Int = 904
|
||||
|
||||
actual constructor() {}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// FIR_IDENTICAL
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Foo {
|
||||
fun existingFun()
|
||||
val existingParam: Int
|
||||
|
||||
constructor()
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Foo actual constructor() {
|
||||
actual fun existingFun() {}
|
||||
actual val existingParam: Int = 904
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// FIR_IDENTICAL
|
||||
// WITH_STDLIB
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Foo {
|
||||
fun existingMethod()
|
||||
val existingParam: Int
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
@OptIn(kotlin.ExperimentalMultiplatform::class)
|
||||
@kotlin.AllowDifferentMembersInActual
|
||||
actual open class Foo {
|
||||
actual fun existingMethod() {}
|
||||
actual val existingParam: Int = 904
|
||||
|
||||
fun injectedMethod() {} // accidential override can happen with this injected fun. That's why it's prohibited
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
// FIR_IDENTICAL
|
||||
// WITH_STDLIB
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Foo {
|
||||
fun existingMethod()
|
||||
val existingParam: Int
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
@OptIn(kotlin.ExperimentalMultiplatform::class)
|
||||
@kotlin.AllowDifferentMembersInActual
|
||||
actual typealias Foo = FooImpl
|
||||
|
||||
open class FooImpl {
|
||||
fun existingMethod() {}
|
||||
val existingParam: Int = 904
|
||||
|
||||
fun injectedMethod() {} // accidential override can happen with this injected fun. That's why it's prohibited
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
// FIR_IDENTICAL
|
||||
// LANGUAGE: +ContextReceivers
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
open class Base<T> {
|
||||
open fun returnType(): T = null!!
|
||||
open fun parameterType(t: T) {}
|
||||
context(T)
|
||||
open fun contextReceiverType() {}
|
||||
open fun T.extensionReceiverType() {}
|
||||
}
|
||||
|
||||
expect open class Foo<E> : Base<E>
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Foo<R> : Base<R>() {
|
||||
override fun returnType(): R = null!!
|
||||
override fun parameterType(t: R) {}
|
||||
context(R)
|
||||
override fun contextReceiverType() {}
|
||||
override fun R.extensionReceiverType() {}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
open class Base {
|
||||
<!INCOMPATIBLE_MATCHING{JVM}!>open fun <T> foo(t: T) {}<!>
|
||||
}
|
||||
|
||||
<!INCOMPATIBLE_MATCHING{JVM}!>expect open class Foo : Base<!>
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Foo : Base() {
|
||||
override fun <R> foo(t: R) {}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
open class Base {
|
||||
open fun <T> foo(t: T) {}
|
||||
}
|
||||
|
||||
expect open class Foo : Base
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER!>class Foo<!> : Base() {
|
||||
override fun <!TYPE_PARAMETER_NAMES_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION!><R><!> foo(t: R) {}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
open class Base {
|
||||
<!INCOMPATIBLE_MATCHING{JVM}!>open var red1: String = ""<!>
|
||||
<!INCOMPATIBLE_MATCHING{JVM}!>open lateinit var red2: String<!>
|
||||
open lateinit var green: String
|
||||
}
|
||||
|
||||
<!INCOMPATIBLE_MATCHING{JVM}!>expect open class Foo : Base {
|
||||
}<!>
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Foo : Base() {
|
||||
override lateinit var red1: String
|
||||
override var red2: String = ""
|
||||
override lateinit var green: String
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
open class Base {
|
||||
open var red1: String = ""
|
||||
open lateinit var red2: String
|
||||
open lateinit var green: String
|
||||
}
|
||||
|
||||
expect open class Foo : Base {
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER!>class Foo<!> : Base() {
|
||||
override <!LATEINIT_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION!>lateinit<!> var red1: String
|
||||
override var <!LATEINIT_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION!>red2<!>: String = ""
|
||||
override lateinit var green: String
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
open class Base {
|
||||
<!INCOMPATIBLE_MATCHING{JVM}!>open fun foo() {}<!>
|
||||
}
|
||||
|
||||
<!INCOMPATIBLE_MATCHING{JVM}!>expect open class Foo : Base<!>
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Foo : Base() {
|
||||
final override fun foo() {}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
open class Base {
|
||||
open fun foo() {}
|
||||
}
|
||||
|
||||
expect open class Foo : Base
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER!>class Foo<!> : Base() {
|
||||
<!MODALITY_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION!>final<!> override fun foo() {}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
open class Base<T> {
|
||||
<!INCOMPATIBLE_MATCHING{JVM}!>open fun foo(t: T) {}<!>
|
||||
}
|
||||
|
||||
<!INCOMPATIBLE_MATCHING{JVM}!>expect open class Foo : Base<String><!>
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Foo : Base<String>() {
|
||||
final override fun foo(t: String) {}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
open class Base<T> {
|
||||
open fun foo(t: T) {}
|
||||
}
|
||||
|
||||
expect open class Foo : Base<String>
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER!>class Foo<!> : Base<String>() {
|
||||
<!MODALITY_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION!>final<!> override fun foo(t: String) {}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
<!INCOMPATIBLE_MATCHING{JVM}!>expect open class Foo<!>
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Foo {
|
||||
final override fun toString() = "Foo"
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Foo
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER!>class Foo<!> {
|
||||
<!MODALITY_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION!>final<!> override fun toString() = "Foo"
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
open class Base {
|
||||
<!INCOMPATIBLE_MATCHING{JVM}!>open fun foo(param: Int) {}<!>
|
||||
}
|
||||
|
||||
<!INCOMPATIBLE_MATCHING{JVM}!>expect open class Foo1 : Base<!>
|
||||
expect open class Foo2 : Base
|
||||
expect open class Foo3 {
|
||||
open fun foo(param: Int)
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Foo1 : Base() {
|
||||
override fun foo(paramNameChanged: Int) {}
|
||||
}
|
||||
|
||||
actual typealias Foo2 = Foo2Java
|
||||
actual typealias Foo3 = Foo3Java
|
||||
|
||||
// FILE: Foo2Java.java
|
||||
|
||||
public class Foo2Java extends Base {
|
||||
@Override
|
||||
public void foo(int paramNameChanged) {}
|
||||
}
|
||||
|
||||
// FILE: Foo3Java.java
|
||||
public class Foo3Java {
|
||||
public void foo(int paramNameChanged) {}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
open class Base {
|
||||
open fun foo(param: Int) {}
|
||||
}
|
||||
|
||||
expect open class Foo1 : Base
|
||||
expect open class Foo2 : Base
|
||||
expect open class Foo3 {
|
||||
open fun foo(param: Int)
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER!>class Foo1<!> : Base() {
|
||||
override fun <!PARAMETER_NAME_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION!>foo<!>(<!PARAMETER_NAME_CHANGED_ON_OVERRIDE!>paramNameChanged<!>: Int) {}
|
||||
}
|
||||
|
||||
actual typealias Foo2 = Foo2Java
|
||||
actual typealias Foo3 = Foo3Java
|
||||
|
||||
// FILE: Foo2Java.java
|
||||
|
||||
public class Foo2Java extends Base {
|
||||
@Override
|
||||
public void foo(int paramNameChanged) {}
|
||||
}
|
||||
|
||||
// FILE: Foo3Java.java
|
||||
public class Foo3Java {
|
||||
public void foo(int paramNameChanged) {}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
open class Base {
|
||||
<!INCOMPATIBLE_MATCHING{JVM}!>open var foo: String = ""
|
||||
protected set<!>
|
||||
}
|
||||
|
||||
<!INCOMPATIBLE_MATCHING{JVM}!>expect open class Foo : Base<!>
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Foo : Base() {
|
||||
override var foo: String = ""
|
||||
public set
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
open class Base {
|
||||
open var foo: String = ""
|
||||
protected set
|
||||
}
|
||||
|
||||
expect open class Foo : Base
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER!>class Foo<!> : Base() {
|
||||
override var foo: String = ""
|
||||
<!SETTER_VISIBILITY_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION!>public<!> set
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
open class Base {
|
||||
<!INCOMPATIBLE_MATCHING{JVM}!>protected open fun foo() {}<!>
|
||||
}
|
||||
|
||||
<!INCOMPATIBLE_MATCHING{JVM}!>expect open class Foo : Base<!>
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Foo : Base() {
|
||||
public override fun foo() {}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
open class Base {
|
||||
protected open fun foo() {}
|
||||
}
|
||||
|
||||
expect open class Foo : Base
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER!>class Foo<!> : Base() {
|
||||
<!VISIBILITY_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION!>public<!> override fun foo() {}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
open class Base {
|
||||
open val foo: String = ""
|
||||
<!INCOMPATIBLE_MATCHING{JVM}, INCOMPATIBLE_MATCHING{JVM}!>open fun foo(): Any = ""<!>
|
||||
}
|
||||
|
||||
<!INCOMPATIBLE_MATCHING{JVM}!>expect open class Foo : Base {
|
||||
}<!>
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Foo : Base() {
|
||||
override fun foo(): String = ""
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
open class Base {
|
||||
open val foo: String = ""
|
||||
open fun foo(): Any = ""
|
||||
}
|
||||
|
||||
expect open class Foo : Base {
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER!>class Foo<!> : Base() {
|
||||
override fun foo(): <!RETURN_TYPE_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION!>String<!> = ""
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
interface I
|
||||
|
||||
open class Base {
|
||||
<!INCOMPATIBLE_MATCHING{JVM}!>open fun foo(): I = null!!<!>
|
||||
}
|
||||
|
||||
<!INCOMPATIBLE_MATCHING{JVM}!>expect open class Foo<T : I> : Base {
|
||||
}<!>
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Foo<T : I> : Base() {
|
||||
override fun foo(): T = null!!
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
interface I
|
||||
|
||||
open class Base {
|
||||
open fun foo(): I = null!!
|
||||
}
|
||||
|
||||
expect open class Foo<T : I> : Base {
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER!>class Foo<!><T : I> : Base() {
|
||||
override fun foo(): <!RETURN_TYPE_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION!>T<!> = null!!
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
open class Base<R> {
|
||||
<!INCOMPATIBLE_MATCHING{JVM}!>open fun foo(): R = null!!<!>
|
||||
}
|
||||
|
||||
<!INCOMPATIBLE_MATCHING{JVM}!>expect open class Foo<R, T : R> : Base<R> {
|
||||
}<!>
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Foo<E, F : E> : Base<E>() {
|
||||
override fun foo(): F = null!!
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
open class Base<R> {
|
||||
open fun foo(): R = null!!
|
||||
}
|
||||
|
||||
expect open class Foo<R, T : R> : Base<R> {
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER!>class Foo<!><E, F : E> : Base<E>() {
|
||||
override fun foo(): <!RETURN_TYPE_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION!>F<!> = null!!
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
open class Base {
|
||||
<!INCOMPATIBLE_MATCHING{JVM}, INCOMPATIBLE_MATCHING{JVM}!>open val foo: Any = ""<!>
|
||||
open fun foo(): String = ""
|
||||
}
|
||||
|
||||
<!INCOMPATIBLE_MATCHING{JVM}!>expect open class Foo : Base<!>
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Foo : Base() {
|
||||
override val foo: String = ""
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
open class Base {
|
||||
open val foo: Any = ""
|
||||
open fun foo(): String = ""
|
||||
}
|
||||
|
||||
expect open class Foo : Base
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER!>class Foo<!> : Base() {
|
||||
override val foo: <!RETURN_TYPE_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION!>String<!> = ""
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// FIR_IDENTICAL
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
open class Base {
|
||||
open fun foo() {}
|
||||
}
|
||||
|
||||
expect open class Foo : Base
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Foo : Base() {
|
||||
override fun foo() {}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// FIR_IDENTICAL
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect class Foo
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Foo {
|
||||
fun injectedMethod() {}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Foo {
|
||||
fun foo()
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Foo {
|
||||
// Hypothetically, it's more restricting than necessary. I can't see how actualizing final -> open can breaking anything.
|
||||
// But technically, actual and expect scopes don't match
|
||||
actual open fun foo() {
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Foo {
|
||||
fun foo()
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER!>class Foo<!> {
|
||||
// Hypothetically, it's more restricting than necessary. I can't see how actualizing final -> open can breaking anything.
|
||||
// But technically, actual and expect scopes don't match
|
||||
actual <!MODALITY_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION!>open<!> fun foo() {
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Base {
|
||||
<!INCOMPATIBLE_MATCHING{JVM}!>open fun foo(): MutableList<String><!>
|
||||
}
|
||||
|
||||
<!INCOMPATIBLE_MATCHING{JVM}!>expect open class Foo : Base {
|
||||
|
||||
}<!>
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual typealias Base = BaseJava
|
||||
|
||||
actual open class Foo : Base() {
|
||||
// K1 doesn't report a diagnostic here because when it compares scopes it sees flexible type
|
||||
// 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.
|
||||
override fun foo(): List<String> {
|
||||
return super.foo()
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: BaseJava.java
|
||||
import java.util.List;
|
||||
|
||||
public class BaseJava {
|
||||
public List<String> foo() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Base {
|
||||
open fun foo(): MutableList<String>
|
||||
}
|
||||
|
||||
expect open class Foo : Base {
|
||||
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual typealias Base = BaseJava
|
||||
|
||||
actual open class Foo : Base() {
|
||||
// K1 doesn't report a diagnostic here because when it compares scopes it sees flexible type
|
||||
// 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.
|
||||
override fun foo(): List<String> {
|
||||
return super.foo()
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: BaseJava.java
|
||||
import java.util.List;
|
||||
|
||||
public class BaseJava {
|
||||
public List<String> foo() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// FIR_IDENTICAL
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Foo {
|
||||
fun existingFun()
|
||||
val existingParam: Int
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Foo {
|
||||
actual fun existingFun() {}
|
||||
actual val existingParam: Int = 904
|
||||
|
||||
class InjectedClass
|
||||
|
||||
// Injected classes can be considered as members (because they caputer `this`) => scopes are different
|
||||
// => the diagnostic should be reported.
|
||||
//
|
||||
// But since `override inner class` isn't possible in Kotlin, red code here is unnecessary
|
||||
inner class InjectedInnerClass
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// LANGUAGE: +ContextReceivers
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Foo {
|
||||
fun foo()
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Foo {
|
||||
actual fun foo() {}
|
||||
|
||||
context(Int)
|
||||
fun foo() {} // accidential override can happen with this injected fun. That's why it's prohibited
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// LANGUAGE: +ContextReceivers
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Foo {
|
||||
fun <!AMBIGUOUS_ACTUALS{JVM}!>foo<!>()
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER!>class Foo<!> {
|
||||
actual fun foo() {}
|
||||
|
||||
context(Int)
|
||||
fun <!ACTUAL_MISSING, NON_ACTUAL_MEMBER_DECLARED_IN_EXPECT_NON_FINAL_CLASSIFIER_ACTUALIZATION!>foo<!>() {} // accidential override can happen with this injected fun. That's why it's prohibited
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Foo {
|
||||
fun existingMethod()
|
||||
val existingParam: Int
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
open class InjectedEmptySuperClass()
|
||||
|
||||
actual open class Foo : InjectedEmptySuperClass() {
|
||||
actual fun existingMethod() {}
|
||||
actual val existingParam: Int = 904
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Foo {
|
||||
fun existingMethod()
|
||||
val existingParam: Int
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
open class InjectedEmptySuperClass()
|
||||
|
||||
actual open <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_SUPERTYPES_AS_NON_FINAL_EXPECT_CLASSIFIER!>class Foo<!> : InjectedEmptySuperClass() {
|
||||
actual fun existingMethod() {}
|
||||
actual val existingParam: Int = 904
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Foo {
|
||||
fun foo()
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Foo {
|
||||
actual fun foo() {}
|
||||
|
||||
fun Int.foo() {} // accidential override can happen with this injected fun. That's why it's prohibited
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Foo {
|
||||
fun foo()
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER!>class Foo<!> {
|
||||
actual fun foo() {}
|
||||
|
||||
fun Int.<!NON_ACTUAL_MEMBER_DECLARED_IN_EXPECT_NON_FINAL_CLASSIFIER_ACTUALIZATION!>foo<!>() {} // accidential override can happen with this injected fun. That's why it's prohibited
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
open class Base {
|
||||
fun <T> foo(t: T) {}
|
||||
}
|
||||
|
||||
expect open class Foo : Base
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Foo : Base() {
|
||||
fun <T : Comparable<T>> foo(t: T) {}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
open class Base {
|
||||
fun <T> foo(t: T) {}
|
||||
}
|
||||
|
||||
expect open class Foo : Base
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER!>class Foo<!> : Base() {
|
||||
fun <T : Comparable<T>> <!NON_ACTUAL_MEMBER_DECLARED_IN_EXPECT_NON_FINAL_CLASSIFIER_ACTUALIZATION!>foo<!>(t: T) {}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Foo {
|
||||
fun existingMethod()
|
||||
val existingParam: Int
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Foo {
|
||||
actual fun existingMethod() {}
|
||||
actual val existingParam: Int = 904
|
||||
|
||||
internal fun injectedMethod() {} // accidential override can happen with this injected fun. That's why it's prohibited
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Foo {
|
||||
fun existingMethod()
|
||||
val existingParam: Int
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER!>class Foo<!> {
|
||||
actual fun existingMethod() {}
|
||||
actual val existingParam: Int = 904
|
||||
|
||||
internal fun <!NON_ACTUAL_MEMBER_DECLARED_IN_EXPECT_NON_FINAL_CLASSIFIER_ACTUALIZATION!>injectedMethod<!>() {} // accidential override can happen with this injected fun. That's why it's prohibited
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// FIR_IDENTICAL
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Foo {
|
||||
fun existingMethod()
|
||||
val existingParam: Int
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Foo {
|
||||
actual fun existingMethod() {}
|
||||
actual val existingParam: Int = 904
|
||||
|
||||
private fun injected() {}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Foo {
|
||||
fun existingMethod()
|
||||
val existingParam: Int
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Foo {
|
||||
actual fun existingMethod() {}
|
||||
actual val existingParam: Int = 904
|
||||
|
||||
protected fun injectedMethod() {} // accidential override can happen with this injected fun. That's why it's prohibited
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Foo {
|
||||
fun existingMethod()
|
||||
val existingParam: Int
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER!>class Foo<!> {
|
||||
actual fun existingMethod() {}
|
||||
actual val existingParam: Int = 904
|
||||
|
||||
protected fun <!NON_ACTUAL_MEMBER_DECLARED_IN_EXPECT_NON_FINAL_CLASSIFIER_ACTUALIZATION!>injectedMethod<!>() {} // accidential override can happen with this injected fun. That's why it's prohibited
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Foo {
|
||||
fun existingMethod()
|
||||
val existingParam: Int
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Foo {
|
||||
actual fun existingMethod() {}
|
||||
actual val existingParam: Int = 904
|
||||
|
||||
fun injectedMethod() {} // accidential override can happen with this injected fun. That's why it's prohibited
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Foo {
|
||||
fun existingMethod()
|
||||
val existingParam: Int
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER!>class Foo<!> {
|
||||
actual fun existingMethod() {}
|
||||
actual val existingParam: Int = 904
|
||||
|
||||
fun <!NON_ACTUAL_MEMBER_DECLARED_IN_EXPECT_NON_FINAL_CLASSIFIER_ACTUALIZATION!>injectedMethod<!>() {} // accidential override can happen with this injected fun. That's why it's prohibited
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Foo {
|
||||
fun existingMethod()
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual typealias Foo = FooImpl
|
||||
|
||||
// FILE: Foo.java
|
||||
|
||||
public class FooImpl {
|
||||
public void existingMethod() {}
|
||||
|
||||
public void injectedMethod() {}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Foo {
|
||||
fun existingMethod()
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual typealias <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER!>Foo<!> = FooImpl
|
||||
|
||||
// FILE: Foo.java
|
||||
|
||||
public class FooImpl {
|
||||
public void existingMethod() {}
|
||||
|
||||
public void injectedMethod() {}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Foo {
|
||||
fun foo()
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Foo {
|
||||
actual fun foo() {}
|
||||
|
||||
fun foo(overloaded: Int) {} // accidential override can happen with this injected fun. That's why it's prohibited
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Foo {
|
||||
fun foo()
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER!>class Foo<!> {
|
||||
actual fun foo() {}
|
||||
|
||||
fun <!NON_ACTUAL_MEMBER_DECLARED_IN_EXPECT_NON_FINAL_CLASSIFIER_ACTUALIZATION!>foo<!>(overloaded: Int) {} // accidential override can happen with this injected fun. That's why it's prohibited
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
open class Base<T> {
|
||||
open fun foo(t: T) {}
|
||||
}
|
||||
|
||||
expect open class Foo<R> : Base<R>
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Foo<R>() : Base<R>() {
|
||||
fun <T> foo(t: T) {}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
open class Base<T> {
|
||||
open fun foo(t: T) {}
|
||||
}
|
||||
|
||||
expect open class Foo<R> : Base<R>
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER!>class Foo<!><R>() : Base<R>() {
|
||||
fun <T> <!NON_ACTUAL_MEMBER_DECLARED_IN_EXPECT_NON_FINAL_CLASSIFIER_ACTUALIZATION!>foo<!>(t: T) {}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// FIR_IDENTICAL
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Foo {
|
||||
fun existingFun()
|
||||
val existingParam: Int
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Foo(injectedConstructor: Int) {
|
||||
actual fun existingFun() {}
|
||||
actual val existingParam: Int = 904
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// FIR_IDENTICAL
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Foo {
|
||||
fun existingFun()
|
||||
val existingParam: Int
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Foo {
|
||||
actual fun existingFun() {}
|
||||
actual val existingParam: Int = 904
|
||||
|
||||
private val injectedProperty = 1
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Foo {
|
||||
fun existingFun()
|
||||
val existingParam: Int
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Foo {
|
||||
actual fun existingFun() {}
|
||||
actual val existingParam: Int = 904
|
||||
|
||||
val injectedProperty = 1
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Foo {
|
||||
fun existingFun()
|
||||
val existingParam: Int
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER!>class Foo<!> {
|
||||
actual fun existingFun() {}
|
||||
actual val existingParam: Int = 904
|
||||
|
||||
val <!NON_ACTUAL_MEMBER_DECLARED_IN_EXPECT_NON_FINAL_CLASSIFIER_ACTUALIZATION!>injectedProperty<!> = 1
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Foo {
|
||||
fun foo(): Int
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Foo {
|
||||
actual fun foo(): Int = 904
|
||||
|
||||
val foo: Int = 42
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Foo {
|
||||
fun foo(): Int
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER!>class Foo<!> {
|
||||
actual fun foo(): Int = 904
|
||||
|
||||
val <!NON_ACTUAL_MEMBER_DECLARED_IN_EXPECT_NON_FINAL_CLASSIFIER_ACTUALIZATION!>foo<!>: Int = 42
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Foo {
|
||||
fun existingMethod()
|
||||
val existingParam: Int
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
open class Injector {
|
||||
fun injectedMethod() {}
|
||||
}
|
||||
|
||||
actual open class Foo : Injector() {
|
||||
actual fun existingMethod() {}
|
||||
actual val existingParam: Int = 904
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Foo {
|
||||
fun existingMethod()
|
||||
val existingParam: Int
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
open class Injector {
|
||||
fun injectedMethod() {}
|
||||
}
|
||||
|
||||
actual open <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_SUPERTYPES_AS_NON_FINAL_EXPECT_CLASSIFIER!>class Foo<!> : Injector() {
|
||||
actual fun existingMethod() {}
|
||||
actual val existingParam: Int = 904
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// FIR_IDENTICAL
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Foo {
|
||||
fun existingFun()
|
||||
val existingParam: Int
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Foo {
|
||||
actual fun existingFun() {}
|
||||
actual val existingParam: Int = 904
|
||||
|
||||
constructor(injectedConstructor: Int) {}
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// WITH_STDLIB
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Base {
|
||||
fun injected()
|
||||
}
|
||||
|
||||
expect open class Foo {
|
||||
fun existingMethod()
|
||||
val existingParam: Int
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Base {
|
||||
actual fun injected() {}
|
||||
}
|
||||
|
||||
actual open class Foo : Base() {
|
||||
actual fun existingMethod() {}
|
||||
actual val existingParam: Int = 904
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
// WITH_STDLIB
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Base {
|
||||
fun injected()
|
||||
}
|
||||
|
||||
expect open class Foo {
|
||||
fun existingMethod()
|
||||
val existingParam: Int
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Base {
|
||||
actual fun injected() {}
|
||||
}
|
||||
|
||||
actual open <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_SUPERTYPES_AS_NON_FINAL_EXPECT_CLASSIFIER!>class Foo<!> : Base() {
|
||||
actual fun existingMethod() {}
|
||||
actual val existingParam: Int = 904
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
// WITH_STDLIB
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Base {
|
||||
fun injected()
|
||||
}
|
||||
|
||||
expect open class Foo {
|
||||
fun existingMethod()
|
||||
val existingParam: Int
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Base {
|
||||
actual fun injected() {}
|
||||
}
|
||||
|
||||
open class Transitive : Base()
|
||||
|
||||
actual open class Foo : Transitive() {
|
||||
actual fun existingMethod() {}
|
||||
actual val existingParam: Int = 904
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
// WITH_STDLIB
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Base {
|
||||
fun injected()
|
||||
}
|
||||
|
||||
expect open class Foo {
|
||||
fun existingMethod()
|
||||
val existingParam: Int
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Base {
|
||||
actual fun injected() {}
|
||||
}
|
||||
|
||||
open class Transitive : Base()
|
||||
|
||||
actual open <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_SUPERTYPES_AS_NON_FINAL_EXPECT_CLASSIFIER!>class Foo<!> : Transitive() {
|
||||
actual fun existingMethod() {}
|
||||
actual val existingParam: Int = 904
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
open class Base {
|
||||
open fun foo(t: String) {}
|
||||
}
|
||||
|
||||
expect open class Foo : Base
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Foo : Base() {
|
||||
open fun foo(vararg t: String) {} // injected
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
open class Base {
|
||||
open fun foo(t: String) {}
|
||||
}
|
||||
|
||||
expect open class Foo : Base
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER!>class Foo<!> : Base() {
|
||||
open fun <!NON_ACTUAL_MEMBER_DECLARED_IN_EXPECT_NON_FINAL_CLASSIFIER_ACTUALIZATION!>foo<!>(vararg t: String) {} // injected
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
// Rules for expect actual matching are ad-hoc for nested classes. That's why this test exist
|
||||
expect class Outer {
|
||||
open class Foo {
|
||||
fun existingMethod()
|
||||
val existingParam: Int
|
||||
}
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual class Outer {
|
||||
actual open class Foo {
|
||||
actual fun existingMethod() {}
|
||||
actual val existingParam: Int = 904
|
||||
|
||||
fun injectedMethod() {} // accidential override can happen with this injected fun. That's why it's prohibited
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
// Rules for expect actual matching are ad-hoc for nested classes. That's why this test exist
|
||||
expect class Outer {
|
||||
open class Foo {
|
||||
fun existingMethod()
|
||||
val existingParam: Int
|
||||
}
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual class Outer {
|
||||
actual open <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER!>class Foo<!> {
|
||||
actual fun existingMethod() {}
|
||||
actual val existingParam: Int = 904
|
||||
|
||||
fun <!NON_ACTUAL_MEMBER_DECLARED_IN_EXPECT_NON_FINAL_CLASSIFIER_ACTUALIZATION!>injectedMethod<!>() {} // accidential override can happen with this injected fun. That's why it's prohibited
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
open class Base {
|
||||
<!INCOMPATIBLE_MATCHING{JVM}!>open val foo: Int = 1<!>
|
||||
}
|
||||
|
||||
<!INCOMPATIBLE_MATCHING{JVM}!>expect open class Foo : Base<!>
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Foo : Base() {
|
||||
override var foo: Int = 1
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
open class Base {
|
||||
open val foo: Int = 1
|
||||
}
|
||||
|
||||
expect open class Foo : Base
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER!>class Foo<!> : Base() {
|
||||
override <!PROPERTY_KIND_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION!>var<!> foo: Int = 1
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
open class Base() {
|
||||
<!INCOMPATIBLE_MATCHING{JVM}!>open fun overrideReturnType(): Any = ""<!>
|
||||
<!INCOMPATIBLE_MATCHING{JVM}!>open fun overrideModality1(): Any = ""<!>
|
||||
<!INCOMPATIBLE_MATCHING{JVM}!>open fun overrideModality2(): Any = ""<!>
|
||||
<!INCOMPATIBLE_MATCHING{JVM}!>protected open fun overrideVisibility(): Any = ""<!>
|
||||
}
|
||||
|
||||
<!INCOMPATIBLE_MATCHING{JVM}!>expect open class Foo : Base {
|
||||
fun existingMethod()
|
||||
val existingParam: Int
|
||||
}<!>
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Foo : Base() {
|
||||
actual fun existingMethod() {}
|
||||
actual val existingParam: Int = 904
|
||||
|
||||
fun injectedMethod() {}
|
||||
val injectedProperty: Int = 42
|
||||
override fun overrideReturnType(): String = ""
|
||||
final override fun overrideModality1(): Any = ""
|
||||
final override fun overrideModality2(): Any = ""
|
||||
public override fun overrideVisibility(): Any = ""
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
open class Base() {
|
||||
open fun overrideReturnType(): Any = ""
|
||||
open fun overrideModality1(): Any = ""
|
||||
open fun overrideModality2(): Any = ""
|
||||
protected open fun overrideVisibility(): Any = ""
|
||||
}
|
||||
|
||||
expect open class Foo : Base {
|
||||
fun existingMethod()
|
||||
val existingParam: Int
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER!>class Foo<!> : Base() {
|
||||
actual fun existingMethod() {}
|
||||
actual val existingParam: Int = 904
|
||||
|
||||
fun <!NON_ACTUAL_MEMBER_DECLARED_IN_EXPECT_NON_FINAL_CLASSIFIER_ACTUALIZATION!>injectedMethod<!>() {}
|
||||
val <!NON_ACTUAL_MEMBER_DECLARED_IN_EXPECT_NON_FINAL_CLASSIFIER_ACTUALIZATION!>injectedProperty<!>: Int = 42
|
||||
override fun overrideReturnType(): <!RETURN_TYPE_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION!>String<!> = ""
|
||||
<!MODALITY_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION!>final<!> override fun overrideModality1(): Any = ""
|
||||
<!MODALITY_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION!>final<!> override fun overrideModality2(): Any = ""
|
||||
<!VISIBILITY_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION!>public<!> override fun overrideVisibility(): Any = ""
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// FIR_IDENTICAL
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
open class Base<T> {
|
||||
open fun foo(t: T) {}
|
||||
}
|
||||
|
||||
expect open class Foo : Base<String>
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Foo : Base<String>() {
|
||||
override fun foo(t: String) {}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// FIR_IDENTICAL
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Supertype()
|
||||
|
||||
expect open class Foo : Supertype {
|
||||
fun existingMethod()
|
||||
val existingParam: Int
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual typealias Supertype = SupertypeImpl
|
||||
|
||||
open class SupertypeImpl()
|
||||
|
||||
actual open class Foo : SupertypeImpl() {
|
||||
actual fun existingMethod() {}
|
||||
actual val existingParam: Int = 904
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// FIR_IDENTICAL
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
open class Supertype()
|
||||
typealias SupertypeAlias = Supertype
|
||||
|
||||
expect open class Foo : Supertype {
|
||||
fun existingMethod()
|
||||
val existingParam: Int
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Foo : SupertypeAlias() {
|
||||
actual fun existingMethod() {}
|
||||
actual val existingParam: Int = 904
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// FIR_IDENTICAL
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
open class Supertype()
|
||||
typealias SupertypeAlias = Supertype
|
||||
|
||||
expect open class Foo : SupertypeAlias {
|
||||
fun existingMethod()
|
||||
val existingParam: Int
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual open class Foo : Supertype() {
|
||||
actual fun existingMethod() {}
|
||||
actual val existingParam: Int = 904
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// WITH_STDLIB
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Base {
|
||||
fun existingMethodInBase()
|
||||
}
|
||||
|
||||
expect open class Foo : Base {
|
||||
fun existingMethod()
|
||||
val existingParam: Int
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
@OptIn(ExperimentalMultiplatform::class)
|
||||
@AllowDifferentMembersInActual
|
||||
actual open class Base {
|
||||
actual fun existingMethodInBase() {}
|
||||
open fun injected(): Any = ""
|
||||
}
|
||||
|
||||
actual open class Foo : Base() {
|
||||
actual fun existingMethod() {}
|
||||
actual val existingParam: Int = 904
|
||||
|
||||
override fun injected(): String = "" // covariant override
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
// WITH_STDLIB
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Base {
|
||||
fun existingMethodInBase()
|
||||
}
|
||||
|
||||
expect open class Foo : Base {
|
||||
fun existingMethod()
|
||||
val existingParam: Int
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
@OptIn(ExperimentalMultiplatform::class)
|
||||
@AllowDifferentMembersInActual
|
||||
actual open class Base {
|
||||
actual fun existingMethodInBase() {}
|
||||
open fun injected(): Any = ""
|
||||
}
|
||||
|
||||
actual open <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER!>class Foo<!> : Base() {
|
||||
actual fun existingMethod() {}
|
||||
actual val existingParam: Int = 904
|
||||
|
||||
override fun injected(): <!RETURN_TYPE_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION!>String<!> = "" // covariant override
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
// WITH_STDLIB
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Base<T>() {
|
||||
fun existingMethodInBase(param: T)
|
||||
}
|
||||
|
||||
open class Transitive : Base<String>()
|
||||
|
||||
expect open class Foo : Transitive {
|
||||
fun existingMethod()
|
||||
val existingParam: Int
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
@OptIn(ExperimentalMultiplatform::class)
|
||||
@AllowDifferentMembersInActual
|
||||
actual open class Base<T> {
|
||||
actual fun existingMethodInBase(param: T) {}
|
||||
open fun injected(param: T): Any = ""
|
||||
}
|
||||
|
||||
actual open class Foo : Transitive() {
|
||||
actual fun existingMethod() {}
|
||||
actual val existingParam: Int = 904
|
||||
|
||||
override fun injected(param: String): String = "" // covariant override
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
// WITH_STDLIB
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
expect open class Base<T>() {
|
||||
fun existingMethodInBase(param: T)
|
||||
}
|
||||
|
||||
open class Transitive : Base<String>()
|
||||
|
||||
expect open class Foo : Transitive {
|
||||
fun existingMethod()
|
||||
val existingParam: Int
|
||||
}
|
||||
|
||||
// MODULE: m2-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
@OptIn(ExperimentalMultiplatform::class)
|
||||
@AllowDifferentMembersInActual
|
||||
actual open class Base<T> {
|
||||
actual fun existingMethodInBase(param: T) {}
|
||||
open fun injected(param: T): Any = ""
|
||||
}
|
||||
|
||||
actual open <!ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_MEMBERS_AS_NON_FINAL_EXPECT_CLASSIFIER!>class Foo<!> : Transitive() {
|
||||
actual fun existingMethod() {}
|
||||
actual val existingParam: Int = 904
|
||||
|
||||
override fun injected(param: String): <!RETURN_TYPE_CHANGED_IN_NON_FINAL_EXPECT_CLASSIFIER_ACTUALIZATION!>String<!> = "" // covariant override
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user