[FIR] Fix missing ACTUAL_WITHOUT_EXPECT when expect is fake-override
^KT-65270 Fixed KT review: https://jetbrains.team/p/kt/reviews/14064/timeline IJ review: https://jetbrains.team/p/ij/reviews/124657/timeline
This commit is contained in:
+6
@@ -24777,6 +24777,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualTypealias_defaultParamsIncompatibility.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("actualWithoutExpectWhenExpectIsFakeOverride.kt")
|
||||
public void testActualWithoutExpectWhenExpectIsFakeOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualWithoutExpectWhenExpectIsFakeOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInMultiplatform() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/multiplatform"), Pattern.compile("^(.+)\\.(kt|kts)$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
|
||||
|
||||
+6
@@ -24777,6 +24777,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualTypealias_defaultParamsIncompatibility.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("actualWithoutExpectWhenExpectIsFakeOverride.kt")
|
||||
public void testActualWithoutExpectWhenExpectIsFakeOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualWithoutExpectWhenExpectIsFakeOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInMultiplatform() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/multiplatform"), Pattern.compile("^(.+)\\.(kt|kts)$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
|
||||
|
||||
+6
@@ -62,6 +62,12 @@ public class FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated extends Abst
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualTypealias_defaultParamsIncompatibility.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("actualWithoutExpectWhenExpectIsFakeOverride.kt")
|
||||
public void testActualWithoutExpectWhenExpectIsFakeOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualWithoutExpectWhenExpectIsFakeOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInMultiplatform() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/multiplatform"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), TargetBackend.JVM_IR, true);
|
||||
|
||||
+6
@@ -62,6 +62,12 @@ public class FirOldFrontendMPPDiagnosticsWithPsiTestGenerated extends AbstractFi
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualTypealias_defaultParamsIncompatibility.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("actualWithoutExpectWhenExpectIsFakeOverride.kt")
|
||||
public void testActualWithoutExpectWhenExpectIsFakeOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualWithoutExpectWhenExpectIsFakeOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInMultiplatform() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/multiplatform"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), TargetBackend.JVM_IR, true);
|
||||
|
||||
+4
-1
@@ -174,7 +174,10 @@ object FirExpectActualDeclarationChecker : FirBasicDeclarationChecker(MppChecker
|
||||
reportClassScopesIncompatibility(symbol, expectedSingleCandidate, declaration, checkingCompatibility, reporter, source, context)
|
||||
}
|
||||
|
||||
ExpectActualMatchingCompatibility.MatchedSuccessfully !in matchingCompatibilityToMembersMap -> {
|
||||
ExpectActualMatchingCompatibility.MatchedSuccessfully !in matchingCompatibilityToMembersMap ||
|
||||
expectedSingleCandidate != null &&
|
||||
declaration.hasActualModifier() &&
|
||||
expectedSingleCandidate.isFakeOverride(expectContainingClass, expectActualMatchingContext) -> {
|
||||
reporter.reportOn(
|
||||
source,
|
||||
FirErrors.ACTUAL_WITHOUT_EXPECT,
|
||||
|
||||
compiler/testData/diagnostics/tests/multiplatform/actualWithoutExpectWhenExpectIsFakeOverride.fir.kt
Vendored
+33
@@ -0,0 +1,33 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
fun foo() {}
|
||||
class Foo
|
||||
|
||||
open class Base {
|
||||
open fun foo() {}
|
||||
}
|
||||
expect class Bar : Base {
|
||||
}
|
||||
|
||||
expect open class ExpectBase {
|
||||
open fun foo()
|
||||
}
|
||||
expect class Baz : ExpectBase
|
||||
|
||||
// MODULE: m1-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
actual fun <!ACTUAL_WITHOUT_EXPECT!>foo<!>() {}
|
||||
actual class <!ACTUAL_WITHOUT_EXPECT!>Foo<!>
|
||||
|
||||
actual class Bar : Base() {
|
||||
actual override fun <!ACTUAL_WITHOUT_EXPECT!>foo<!>() {}
|
||||
}
|
||||
|
||||
actual open class ExpectBase {
|
||||
actual open fun foo() {}
|
||||
}
|
||||
actual class Baz : ExpectBase() {
|
||||
actual override fun <!ACTUAL_WITHOUT_EXPECT!>foo<!>() {}
|
||||
}
|
||||
Vendored
+33
@@ -0,0 +1,33 @@
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
|
||||
<!CONFLICTING_OVERLOADS{JVM}!>fun foo()<!> {}
|
||||
class <!PACKAGE_OR_CLASSIFIER_REDECLARATION{JVM}!>Foo<!>
|
||||
|
||||
open class Base {
|
||||
open fun foo() {}
|
||||
}
|
||||
expect class Bar : Base {
|
||||
}
|
||||
|
||||
expect open class ExpectBase {
|
||||
open fun foo()
|
||||
}
|
||||
expect class Baz : ExpectBase
|
||||
|
||||
// MODULE: m1-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
|
||||
<!CONFLICTING_OVERLOADS!>actual fun <!ACTUAL_WITHOUT_EXPECT!>foo<!>()<!> {}
|
||||
actual class <!ACTUAL_WITHOUT_EXPECT, PACKAGE_OR_CLASSIFIER_REDECLARATION!>Foo<!>
|
||||
|
||||
actual class Bar : Base() {
|
||||
actual override fun <!ACTUAL_WITHOUT_EXPECT!>foo<!>() {}
|
||||
}
|
||||
|
||||
actual open class ExpectBase {
|
||||
actual open fun foo() {}
|
||||
}
|
||||
actual class Baz : ExpectBase() {
|
||||
actual override fun <!ACTUAL_WITHOUT_EXPECT!>foo<!>() {}
|
||||
}
|
||||
Generated
+6
@@ -24777,6 +24777,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualTypealias_defaultParamsIncompatibility.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("actualWithoutExpectWhenExpectIsFakeOverride.kt")
|
||||
public void testActualWithoutExpectWhenExpectIsFakeOverride() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/actualWithoutExpectWhenExpectIsFakeOverride.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllFilesPresentInMultiplatform() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/multiplatform"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
|
||||
|
||||
Reference in New Issue
Block a user