[FIR] Consider @PlatformDependent annotation everywhere (including JS and Native)

^KT-57858 Fixed

Remove FirEmptyOverridesBackwardCompatibilityHelper since it's not used anymore

Remove overridesMemberWithPlatformDependent.kt test file since it becomes redundant
This commit is contained in:
Ivan Kochurkin
2023-09-15 14:47:15 +02:00
committed by Space Team
parent 1026cdf035
commit 3cd4f7c3aa
27 changed files with 110 additions and 82 deletions
@@ -1,13 +0,0 @@
/*
* 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.fir.analysis
import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext
import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol
object FirEmptyOverridesBackwardCompatibilityHelper : FirOverridesBackwardCompatibilityHelper() {
override fun overrideCanBeOmitted(overriddenMemberSymbols: List<FirCallableSymbol<*>>, context: CheckerContext): Boolean = false
}
@@ -8,7 +8,7 @@ package org.jetbrains.kotlin.fir.session
import org.jetbrains.annotations.TestOnly
import org.jetbrains.kotlin.config.*
import org.jetbrains.kotlin.fir.*
import org.jetbrains.kotlin.fir.analysis.FirEmptyOverridesBackwardCompatibilityHelper
import org.jetbrains.kotlin.fir.analysis.FirDefaultOverridesBackwardCompatibilityHelper
import org.jetbrains.kotlin.fir.analysis.FirOverridesBackwardCompatibilityHelper
import org.jetbrains.kotlin.fir.extensions.FirExtensionRegistrar
import org.jetbrains.kotlin.fir.extensions.FirExtensionService
@@ -137,6 +137,6 @@ object FirSessionFactoryHelper {
register(FirVisibilityChecker::class, FirVisibilityChecker.Default)
register(ConeCallConflictResolverFactory::class, DefaultCallConflictResolverFactory)
register(FirPlatformClassMapper::class, FirPlatformClassMapper.Default)
register(FirOverridesBackwardCompatibilityHelper::class, FirEmptyOverridesBackwardCompatibilityHelper)
register(FirOverridesBackwardCompatibilityHelper::class, FirDefaultOverridesBackwardCompatibilityHelper)
}
}
@@ -353,6 +353,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
runTest("compiler/testData/codegen/box/annotations/parameters.kt");
}
@Test
@TestMetadata("platformDependent.kt")
public void testPlatformDependent() throws Exception {
runTest("compiler/testData/codegen/box/annotations/platformDependent.kt");
}
@Test
@TestMetadata("propertyWithPropertyInInitializerAsParameter.kt")
public void testPropertyWithPropertyInInitializerAsParameter() throws Exception {
@@ -353,6 +353,12 @@ public class FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated
runTest("compiler/testData/codegen/box/annotations/parameters.kt");
}
@Test
@TestMetadata("platformDependent.kt")
public void testPlatformDependent() throws Exception {
runTest("compiler/testData/codegen/box/annotations/platformDependent.kt");
}
@Test
@TestMetadata("propertyWithPropertyInInitializerAsParameter.kt")
public void testPropertyWithPropertyInInitializerAsParameter() throws Exception {
@@ -353,6 +353,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
runTest("compiler/testData/codegen/box/annotations/parameters.kt");
}
@Test
@TestMetadata("platformDependent.kt")
public void testPlatformDependent() throws Exception {
runTest("compiler/testData/codegen/box/annotations/platformDependent.kt");
}
@Test
@TestMetadata("propertyWithPropertyInInitializerAsParameter.kt")
public void testPropertyWithPropertyInInitializerAsParameter() throws Exception {
@@ -1,21 +1,26 @@
// IGNORE_BACKEND_K1: JS, JS_IR, JS_IR_ES6, WASM, NATIVE
// ISSUE: KT-57858
// FILE: Sub.kt
package kotlin.internal
@Target(AnnotationTarget.FUNCTION)
annotation class PlatformDependent
// FILE: Main.kt
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
import kotlin.internal.PlatformDependent
interface I {
@PlatformDependent
fun f() {}
fun f(): String = "FAIL"
}
class C : I {
fun <!VIRTUAL_MEMBER_HIDDEN!>f<!>() {}
fun f() = "OK"
}
fun box() = C().f()
@@ -1,21 +0,0 @@
// ISSUE: KT-57858
// FILE: Sub.kt
package kotlin.internal
@Target(AnnotationTarget.FUNCTION)
annotation class PlatformDependent
// FILE: Main.kt
@file:Suppress("INVISIBLE_MEMBER", <!ERROR_SUPPRESSION!>"INVISIBLE_REFERENCE"<!>)
import kotlin.internal.PlatformDependent
interface I {
@PlatformDependent
fun f() {}
}
class C : I {
fun <!VIRTUAL_MEMBER_HIDDEN!>f<!>() {}
}
@@ -1,14 +0,0 @@
// FIR_IDENTICAL
// ISSUE: KT-57858
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
import kotlin.internal.PlatformDependent
interface I {
@PlatformDependent
fun f() {}
}
class C : I {
fun <!VIRTUAL_MEMBER_HIDDEN!>f<!>() {}
}
@@ -305,6 +305,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/annotations/parameters.kt");
}
@Test
@TestMetadata("platformDependent.kt")
public void testPlatformDependent() throws Exception {
runTest("compiler/testData/codegen/box/annotations/platformDependent.kt");
}
@Test
@TestMetadata("propertyWithPropertyInInitializerAsParameter.kt")
public void testPropertyWithPropertyInInitializerAsParameter() throws Exception {
@@ -353,6 +353,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/annotations/parameters.kt");
}
@Test
@TestMetadata("platformDependent.kt")
public void testPlatformDependent() throws Exception {
runTest("compiler/testData/codegen/box/annotations/platformDependent.kt");
}
@Test
@TestMetadata("propertyWithPropertyInInitializerAsParameter.kt")
public void testPropertyWithPropertyInInitializerAsParameter() throws Exception {
@@ -353,6 +353,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
runTest("compiler/testData/codegen/box/annotations/parameters.kt");
}
@Test
@TestMetadata("platformDependent.kt")
public void testPlatformDependent() throws Exception {
runTest("compiler/testData/codegen/box/annotations/platformDependent.kt");
}
@Test
@TestMetadata("propertyWithPropertyInInitializerAsParameter.kt")
public void testPropertyWithPropertyInInitializerAsParameter() throws Exception {
@@ -308,6 +308,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/annotations/parameters.kt");
}
@TestMetadata("platformDependent.kt")
public void testPlatformDependent() throws Exception {
runTest("compiler/testData/codegen/box/annotations/platformDependent.kt");
}
@TestMetadata("propertyWithPropertyInInitializerAsParameter.kt")
public void testPropertyWithPropertyInInitializerAsParameter() throws Exception {
runTest("compiler/testData/codegen/box/annotations/propertyWithPropertyInInitializerAsParameter.kt");
@@ -59,6 +59,12 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/annotations/nestedClassesInAnnotations.kt");
}
@Test
@TestMetadata("platformDependent.kt")
public void testPlatformDependent() throws Exception {
runTest("compiler/testData/codegen/box/annotations/platformDependent.kt");
}
@Test
@TestMetadata("resolveWithLowPriorityAnnotation.kt")
public void testResolveWithLowPriorityAnnotation() throws Exception {
@@ -59,6 +59,12 @@ public class FirJsES6CodegenBoxTestGenerated extends AbstractFirJsES6CodegenBoxT
runTest("compiler/testData/codegen/box/annotations/nestedClassesInAnnotations.kt");
}
@Test
@TestMetadata("platformDependent.kt")
public void testPlatformDependent() throws Exception {
runTest("compiler/testData/codegen/box/annotations/platformDependent.kt");
}
@Test
@TestMetadata("resolveWithLowPriorityAnnotation.kt")
public void testResolveWithLowPriorityAnnotation() throws Exception {
@@ -79,12 +79,6 @@ public class FirPsiJsOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiJ
runTest("compiler/testData/diagnostics/testsWithJsStdLib/noImpl.kt");
}
@Test
@TestMetadata("overridesMemberWithPlatformDependent.kt")
public void testOverridesMemberWithPlatformDependent() throws Exception {
runTest("compiler/testData/diagnostics/testsWithJsStdLib/overridesMemberWithPlatformDependent.kt");
}
@Test
@TestMetadata("platformDependent.kt")
public void testPlatformDependent() throws Exception {
@@ -79,12 +79,6 @@ public class DiagnosticsWithJsStdLibTestGenerated extends AbstractDiagnosticsTes
runTest("compiler/testData/diagnostics/testsWithJsStdLib/noImpl.kt");
}
@Test
@TestMetadata("overridesMemberWithPlatformDependent.kt")
public void testOverridesMemberWithPlatformDependent() throws Exception {
runTest("compiler/testData/diagnostics/testsWithJsStdLib/overridesMemberWithPlatformDependent.kt");
}
@Test
@TestMetadata("platformDependent.kt")
public void testPlatformDependent() throws Exception {
@@ -59,6 +59,12 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/annotations/nestedClassesInAnnotations.kt");
}
@Test
@TestMetadata("platformDependent.kt")
public void testPlatformDependent() throws Exception {
runTest("compiler/testData/codegen/box/annotations/platformDependent.kt");
}
@Test
@TestMetadata("resolveWithLowPriorityAnnotation.kt")
public void testResolveWithLowPriorityAnnotation() throws Exception {
@@ -59,6 +59,12 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes
runTest("compiler/testData/codegen/box/annotations/nestedClassesInAnnotations.kt");
}
@Test
@TestMetadata("platformDependent.kt")
public void testPlatformDependent() throws Exception {
runTest("compiler/testData/codegen/box/annotations/platformDependent.kt");
}
@Test
@TestMetadata("resolveWithLowPriorityAnnotation.kt")
public void testResolveWithLowPriorityAnnotation() throws Exception {
@@ -70,6 +70,12 @@ public class FirNativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTe
runTest("compiler/testData/codegen/box/annotations/nestedClassesInAnnotations.kt");
}
@Test
@TestMetadata("platformDependent.kt")
public void testPlatformDependent() throws Exception {
runTest("compiler/testData/codegen/box/annotations/platformDependent.kt");
}
@Test
@TestMetadata("resolveWithLowPriorityAnnotation.kt")
public void testResolveWithLowPriorityAnnotation() throws Exception {
@@ -76,6 +76,12 @@ public class FirNativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenB
runTest("compiler/testData/codegen/box/annotations/nestedClassesInAnnotations.kt");
}
@Test
@TestMetadata("platformDependent.kt")
public void testPlatformDependent() throws Exception {
runTest("compiler/testData/codegen/box/annotations/platformDependent.kt");
}
@Test
@TestMetadata("resolveWithLowPriorityAnnotation.kt")
public void testResolveWithLowPriorityAnnotation() throws Exception {
@@ -68,6 +68,12 @@ public class NativeCodegenBoxTestGenerated extends AbstractNativeCodegenBoxTest
runTest("compiler/testData/codegen/box/annotations/nestedClassesInAnnotations.kt");
}
@Test
@TestMetadata("platformDependent.kt")
public void testPlatformDependent() throws Exception {
runTest("compiler/testData/codegen/box/annotations/platformDependent.kt");
}
@Test
@TestMetadata("resolveWithLowPriorityAnnotation.kt")
public void testResolveWithLowPriorityAnnotation() throws Exception {
@@ -71,6 +71,12 @@ public class NativeCodegenBoxTestNoPLGenerated extends AbstractNativeCodegenBoxT
runTest("compiler/testData/codegen/box/annotations/nestedClassesInAnnotations.kt");
}
@Test
@TestMetadata("platformDependent.kt")
public void testPlatformDependent() throws Exception {
runTest("compiler/testData/codegen/box/annotations/platformDependent.kt");
}
@Test
@TestMetadata("resolveWithLowPriorityAnnotation.kt")
public void testResolveWithLowPriorityAnnotation() throws Exception {
@@ -72,12 +72,6 @@ public class DiagnosticsNativeTestGenerated extends AbstractDiagnosticsNativeTes
runTest("compiler/testData/diagnostics/nativeTests/objCRefinement.kt");
}
@Test
@TestMetadata("overridesMemberWithPlatformDependent.kt")
public void testOverridesMemberWithPlatformDependent() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/overridesMemberWithPlatformDependent.kt");
}
@Test
@TestMetadata("sharedImmutable.kt")
public void testSharedImmutable() throws Exception {
@@ -76,12 +76,6 @@ public class FirLightTreeOldFrontendNativeDiagnosticsTestGenerated extends Abstr
runTest("compiler/testData/diagnostics/nativeTests/objCRefinement.kt");
}
@Test
@TestMetadata("overridesMemberWithPlatformDependent.kt")
public void testOverridesMemberWithPlatformDependent() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/overridesMemberWithPlatformDependent.kt");
}
@Test
@TestMetadata("sharedImmutable.kt")
public void testSharedImmutable() throws Exception {
@@ -76,12 +76,6 @@ public class FirPsiOldFrontendNativeDiagnosticsTestGenerated extends AbstractFir
runTest("compiler/testData/diagnostics/nativeTests/objCRefinement.kt");
}
@Test
@TestMetadata("overridesMemberWithPlatformDependent.kt")
public void testOverridesMemberWithPlatformDependent() throws Exception {
runTest("compiler/testData/diagnostics/nativeTests/overridesMemberWithPlatformDependent.kt");
}
@Test
@TestMetadata("sharedImmutable.kt")
public void testSharedImmutable() throws Exception {
@@ -59,6 +59,12 @@ public class FirWasmCodegenBoxTestGenerated extends AbstractFirWasmCodegenBoxTes
runTest("compiler/testData/codegen/box/annotations/nestedClassesInAnnotations.kt");
}
@Test
@TestMetadata("platformDependent.kt")
public void testPlatformDependent() throws Exception {
runTest("compiler/testData/codegen/box/annotations/platformDependent.kt");
}
@Test
@TestMetadata("resolveWithLowPriorityAnnotation.kt")
public void testResolveWithLowPriorityAnnotation() throws Exception {
@@ -59,6 +59,12 @@ public class K1WasmCodegenBoxTestGenerated extends AbstractK1WasmCodegenBoxTest
runTest("compiler/testData/codegen/box/annotations/nestedClassesInAnnotations.kt");
}
@Test
@TestMetadata("platformDependent.kt")
public void testPlatformDependent() throws Exception {
runTest("compiler/testData/codegen/box/annotations/platformDependent.kt");
}
@Test
@TestMetadata("resolveWithLowPriorityAnnotation.kt")
public void testResolveWithLowPriorityAnnotation() throws Exception {