From 9fad55d55161fc43bfc2216cf12a06a7509bb52a Mon Sep 17 00:00:00 2001 From: Andrey Zinovyev Date: Thu, 17 Jun 2021 12:26:31 +0300 Subject: [PATCH] [FIR] Use @DeprecatedSinceKotlin in the resolution --- .../analysis/checkers/FirAnnotationHelpers.kt | 26 +---------- .../checkers/FirSinceKotlinHelpers.kt | 4 +- .../FirOptInAnnotationClassChecker.kt | 1 + .../FirAnnotationArgumentChecker.kt | 2 +- .../FirOptInAnnotationCallChecker.kt | 2 +- .../expression/FirOptInUsageBaseChecker.kt | 4 +- .../FirBlackBoxCodegenTestGenerated.java | 16 +++++++ .../fir/declarations/FirAnnotationUtils.kt | 23 ++++++++++ .../fir/declarations/deprecatedSinceUtils.kt | 46 +++++++++++++++++++ .../kotlin/fir/resolve/calls/CallKind.kt | 6 ++- .../fir/resolve/calls/ResolutionStages.kt | 13 +++++- .../box/deprecated/deprecatedSinceKotlin.kt | 29 ++++++++++++ ...inceKotlinHiddenOnReferenceArgument.fir.kt | 26 ----------- ...tedSinceKotlinHiddenOnReferenceArgument.kt | 1 + .../deprecatedSinceKotlin/hidden.fir.kt | 2 +- .../codegen/BlackBoxCodegenTestGenerated.java | 16 +++++++ .../IrBlackBoxCodegenTestGenerated.java | 16 +++++++ .../LightAnalysisModeTestGenerated.java | 18 ++++++++ .../IrJsCodegenBoxES6TestGenerated.java | 13 ++++++ .../IrJsCodegenBoxTestGenerated.java | 13 ++++++ .../semantics/JsCodegenBoxTestGenerated.java | 13 ++++++ .../IrCodegenBoxWasmTestGenerated.java | 13 ++++++ 22 files changed, 241 insertions(+), 62 deletions(-) create mode 100644 compiler/fir/resolve/src/org/jetbrains/kotlin/fir/declarations/deprecatedSinceUtils.kt create mode 100644 compiler/testData/codegen/box/deprecated/deprecatedSinceKotlin.kt delete mode 100644 compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/deprecatedSinceKotlinHiddenOnReferenceArgument.fir.kt diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirAnnotationHelpers.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirAnnotationHelpers.kt index 108128ef4e7..00488ca8771 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirAnnotationHelpers.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirAnnotationHelpers.kt @@ -7,10 +7,11 @@ package org.jetbrains.kotlin.fir.analysis.checkers import org.jetbrains.kotlin.builtins.StandardNames import org.jetbrains.kotlin.descriptors.annotations.KotlinTarget -import org.jetbrains.kotlin.fir.FirAnnotationContainer import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.fir.declarations.FirAnnotatedDeclaration import org.jetbrains.kotlin.fir.declarations.FirRegularClass +import org.jetbrains.kotlin.fir.declarations.findArgumentByName +import org.jetbrains.kotlin.fir.declarations.getAnnotationByFqName import org.jetbrains.kotlin.fir.expressions.* import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference import org.jetbrains.kotlin.fir.resolve.fullyExpandedType @@ -19,7 +20,6 @@ import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol import org.jetbrains.kotlin.fir.types.ConeClassLikeType import org.jetbrains.kotlin.fir.types.FirErrorTypeRef import org.jetbrains.kotlin.fir.types.coneType -import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name private val RETENTION_PARAMETER_NAME = Name.identifier("value") @@ -68,28 +68,6 @@ fun FirAnnotatedDeclaration.getTargetAnnotation(): FirAnnotationCall? { return getAnnotationByFqName(StandardNames.FqNames.target) } -fun FirAnnotationContainer.getAnnotationByFqName(fqName: FqName): FirAnnotationCall? { - return annotations.find { - (it.annotationTypeRef.coneType as? ConeClassLikeType)?.lookupTag?.classId?.asSingleFqName() == fqName - } -} - -fun FirAnnotationCall.findArgumentByName(name: Name): FirExpression? { - val argumentMapping = argumentMapping - if (argumentMapping != null) { - return argumentMapping.keys.find { argumentMapping[it]?.name == name }?.unwrapArgument() - } - // NB: we have to consider both cases, because deserializer does not create argument mapping - for (argument in arguments) { - if (argument is FirNamedArgumentExpression && argument.name == name) { - return argument.expression - } - } - // I'm lucky today! - // TODO: this line is still needed. However it should be replaced with 'return null' - return arguments.singleOrNull() -} - fun FirExpression.extractClassesFromArgument(): List { return unfoldArrayOrVararg().mapNotNull { if (it !is FirGetClassCall) return@mapNotNull null diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirSinceKotlinHelpers.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirSinceKotlinHelpers.kt index 1c441dd275a..a06db5544a5 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirSinceKotlinHelpers.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/FirSinceKotlinHelpers.kt @@ -8,9 +8,7 @@ package org.jetbrains.kotlin.fir.analysis.checkers import org.jetbrains.kotlin.config.ApiVersion import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext -import org.jetbrains.kotlin.fir.declarations.FirAnnotatedDeclaration -import org.jetbrains.kotlin.fir.declarations.FirConstructor -import org.jetbrains.kotlin.fir.declarations.FirTypeAlias +import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.expressions.FirConstExpression import org.jetbrains.kotlin.fir.expressions.arguments import org.jetbrains.kotlin.fir.languageVersionSettings diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirOptInAnnotationClassChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirOptInAnnotationClassChecker.kt index e9c839f56ac..b7fb4b3a4f9 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirOptInAnnotationClassChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirOptInAnnotationClassChecker.kt @@ -13,6 +13,7 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors import org.jetbrains.kotlin.fir.analysis.diagnostics.reportOn import org.jetbrains.kotlin.fir.declarations.FirRegularClass +import org.jetbrains.kotlin.fir.declarations.getAnnotationByFqName import org.jetbrains.kotlin.resolve.checkers.Experimentality import org.jetbrains.kotlin.resolve.checkers.OptInNames diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirAnnotationArgumentChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirAnnotationArgumentChecker.kt index 6a7d7f0dab0..d61abef122a 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirAnnotationArgumentChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirAnnotationArgumentChecker.kt @@ -11,12 +11,12 @@ import org.jetbrains.kotlin.fir.FirSourceElement import org.jetbrains.kotlin.fir.analysis.checkers.ConstantArgumentKind import org.jetbrains.kotlin.fir.analysis.checkers.checkConstantArguments import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext -import org.jetbrains.kotlin.fir.analysis.checkers.findArgumentByName import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.fir.analysis.diagnostics.FirDiagnosticFactory0 import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors import org.jetbrains.kotlin.fir.analysis.diagnostics.reportOn import org.jetbrains.kotlin.fir.declarations.FirValueParameter +import org.jetbrains.kotlin.fir.declarations.findArgumentByName import org.jetbrains.kotlin.fir.expressions.* import org.jetbrains.kotlin.fir.languageVersionSettings import org.jetbrains.kotlin.fir.resolve.fqName diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirOptInAnnotationCallChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirOptInAnnotationCallChecker.kt index 52837a49f52..7a86860492f 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirOptInAnnotationCallChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirOptInAnnotationCallChecker.kt @@ -9,10 +9,10 @@ import org.jetbrains.kotlin.config.AnalysisFlags import org.jetbrains.kotlin.fir.FirSourceElement import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext import org.jetbrains.kotlin.fir.analysis.checkers.extractClassesFromArgument -import org.jetbrains.kotlin.fir.analysis.checkers.findArgumentByName import org.jetbrains.kotlin.fir.analysis.diagnostics.DiagnosticReporter import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors import org.jetbrains.kotlin.fir.analysis.diagnostics.reportOn +import org.jetbrains.kotlin.fir.declarations.findArgumentByName import org.jetbrains.kotlin.fir.expressions.* import org.jetbrains.kotlin.fir.languageVersionSettings import org.jetbrains.kotlin.fir.types.ConeClassLikeType diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirOptInUsageBaseChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirOptInUsageBaseChecker.kt index 5bb31db5b29..04873bd9b26 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirOptInUsageBaseChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/expression/FirOptInUsageBaseChecker.kt @@ -5,9 +5,9 @@ package org.jetbrains.kotlin.fir.analysis.checkers.expression -import org.jetbrains.kotlin.fir.analysis.checkers.findArgumentByName -import org.jetbrains.kotlin.fir.analysis.checkers.getAnnotationByFqName import org.jetbrains.kotlin.fir.declarations.FirRegularClass +import org.jetbrains.kotlin.fir.declarations.findArgumentByName +import org.jetbrains.kotlin.fir.declarations.getAnnotationByFqName import org.jetbrains.kotlin.fir.expressions.FirConstExpression import org.jetbrains.kotlin.fir.expressions.FirQualifiedAccessExpression import org.jetbrains.kotlin.fir.references.FirResolvedNamedReference diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java index 91914b4405f..7bd939685e5 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java @@ -13893,6 +13893,22 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT } } + @Nested + @TestMetadata("compiler/testData/codegen/box/deprecated") + @TestDataPath("$PROJECT_ROOT") + public class Deprecated { + @Test + public void testAllFilesPresentInDeprecated() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/deprecated"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("deprecatedSinceKotlin.kt") + public void testDeprecatedSinceKotlin() throws Exception { + runTest("compiler/testData/codegen/box/deprecated/deprecatedSinceKotlin.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/destructuringDeclInLambdaParam") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/declarations/FirAnnotationUtils.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/declarations/FirAnnotationUtils.kt index 2701eedf413..f59c93bcade 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/declarations/FirAnnotationUtils.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/declarations/FirAnnotationUtils.kt @@ -16,6 +16,7 @@ import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol import org.jetbrains.kotlin.fir.types.ConeClassLikeType import org.jetbrains.kotlin.fir.types.coneType import org.jetbrains.kotlin.name.ClassId +import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name private val RETENTION_CLASS_ID = ClassId.fromString("kotlin/annotation/Retention") @@ -88,3 +89,25 @@ private val DEFAULT_USE_SITE_TARGETS: Set = fun FirAnnotatedDeclaration.hasAnnotation(classId: ClassId): Boolean { return annotations.any { it.toAnnotationClassId() == classId } } + +fun FirAnnotationContainer.getAnnotationByFqName(fqName: FqName): FirAnnotationCall? { + return annotations.find { + (it.annotationTypeRef.coneType as? ConeClassLikeType)?.lookupTag?.classId?.asSingleFqName() == fqName + } +} + +fun FirAnnotationCall.findArgumentByName(name: Name): FirExpression? { + val argumentMapping = argumentMapping + if (argumentMapping != null) { + return argumentMapping.keys.find { argumentMapping[it]?.name == name }?.unwrapArgument() + } + // NB: we have to consider both cases, because deserializer does not create argument mapping + for (argument in arguments) { + if (argument is FirNamedArgumentExpression && argument.name == name) { + return argument.expression + } + } + // I'm lucky today! + // TODO: this line is still needed. However it should be replaced with 'return null' + return arguments.singleOrNull() +} diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/declarations/deprecatedSinceUtils.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/declarations/deprecatedSinceUtils.kt new file mode 100644 index 00000000000..ffc9202a8be --- /dev/null +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/declarations/deprecatedSinceUtils.kt @@ -0,0 +1,46 @@ +/* + * Copyright 2010-2021 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.declarations + +import org.jetbrains.kotlin.builtins.StandardNames +import org.jetbrains.kotlin.config.ApiVersion +import org.jetbrains.kotlin.fir.FirAnnotationContainer +import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall +import org.jetbrains.kotlin.fir.expressions.FirConstExpression +import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.utils.addToStdlib.safeAs + +private val HIDDEN_SINCE_NAME = Name.identifier("hiddenSince") + +private object FirDeprecatedSinceVersionKey : FirDeclarationDataKey() + +private var FirCallableDeclaration<*>.deprecatedSinceKotlinCachedValue: DeprecatedSinceValue? by FirDeclarationDataRegistry.data( + FirDeprecatedSinceVersionKey +) + +private fun FirAnnotationContainer.getHiddenSinceKotlin(): ApiVersion? = + getAnnotationByFqName(StandardNames.FqNames.deprecatedSinceKotlin)?.getVersionFromArgument(HIDDEN_SINCE_NAME) + +fun T.getHiddenSinceKotlinCached(): ApiVersion? where T : FirCallableDeclaration<*>, T : FirAnnotationContainer { + val cached = deprecatedSinceKotlinCachedValue + if (cached != null) return cached.hiddenSince + val calculated = getHiddenSinceKotlin() + deprecatedSinceKotlinCachedValue = DeprecatedSinceValue(calculated) + return calculated +} + + +private fun FirAnnotationCall.getVersionFromArgument(name: Name): ApiVersion? = + findArgumentByName(name)?.let { expression -> + expression.safeAs>()?.value.safeAs()?.let { ApiVersion.parse(it) } + } + +private class DeprecatedSinceValue(val hiddenSince: ApiVersion?) + + + + + diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/CallKind.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/CallKind.kt index 0be5e383e08..c5162fe33ea 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/CallKind.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/CallKind.kt @@ -42,7 +42,8 @@ sealed class CallKind(vararg resolutionSequence: ResolutionStage) { CheckCallModifiers, EagerResolveOfCallableReferences, CheckLowPriorityInOverloadResolution, - PostponedVariablesInitializerResolutionStage + PostponedVariablesInitializerResolutionStage, + CheckDeprecatedSinceKotlin ) object DelegatingConstructorCall : CallKind( @@ -67,7 +68,8 @@ sealed class CallKind(vararg resolutionSequence: ResolutionStage) { CheckDispatchReceiver, CheckExtensionReceiver, CheckCallableReferenceExpectedType, - CheckLowPriorityInOverloadResolution + CheckLowPriorityInOverloadResolution, + CheckDeprecatedSinceKotlin ) object SyntheticIdForCallableReferencesResolution : CallKind( diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionStages.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionStages.kt index 71114a58d8d..5bdce370c3a 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionStages.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolutionStages.kt @@ -6,6 +6,7 @@ package org.jetbrains.kotlin.fir.resolve.calls import org.jetbrains.kotlin.descriptors.Modality +import org.jetbrains.kotlin.fir.* import org.jetbrains.kotlin.fir.FirVisibilityChecker import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.declarations.utils.isInfix @@ -21,9 +22,7 @@ import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirFunctionSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol -import org.jetbrains.kotlin.fir.typeContext import org.jetbrains.kotlin.fir.types.* -import org.jetbrains.kotlin.fir.visibilityChecker import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name @@ -295,3 +294,13 @@ internal object CheckCallModifiers : CheckerStage() { } } } + +internal object CheckDeprecatedSinceKotlin : ResolutionStage() { + override suspend fun check(candidate: Candidate, callInfo: CallInfo, sink: CheckerSink, context: ResolutionContext) { + val fir = (candidate.symbol as? FirFunctionSymbol<*>)?.fir ?: return + val deprecatedSince = fir.getHiddenSinceKotlinCached() ?: return + if (context.session.languageVersionSettings.apiVersion >= deprecatedSince) { + sink.yieldDiagnostic(HiddenCandidate) + } + } +} diff --git a/compiler/testData/codegen/box/deprecated/deprecatedSinceKotlin.kt b/compiler/testData/codegen/box/deprecated/deprecatedSinceKotlin.kt new file mode 100644 index 00000000000..9957f092427 --- /dev/null +++ b/compiler/testData/codegen/box/deprecated/deprecatedSinceKotlin.kt @@ -0,0 +1,29 @@ +// TARGET_BACKEND: JVM +// WITH_STDLIB + +// MODULE: lib +// FILE: A.kt + +package kotlin.test + +@JvmName("contentEqualsNullable") +public inline infix fun Array?.contentEqualsMy(other: Array?): Boolean { + return java.util.Arrays.equals(this, other) +} + +@Deprecated("Use Kotlin compiler 1.4 to avoid deprecation warning.") +@DeprecatedSinceKotlin(hiddenSince = "1.4") +public inline infix fun Array.contentEqualsMy(other: Array): Boolean { + return this.contentEqualsMy(other) +} + + +// MODULE: main(lib) +// FILE: B.kt + +import kotlin.test.* + +fun box(): String { + val arr = arrayOf(1, 2, 3) + return if (arr contentEqualsMy arr) "OK" else "fail" +} diff --git a/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/deprecatedSinceKotlinHiddenOnReferenceArgument.fir.kt b/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/deprecatedSinceKotlinHiddenOnReferenceArgument.fir.kt deleted file mode 100644 index ddadd6b1256..00000000000 --- a/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/deprecatedSinceKotlinHiddenOnReferenceArgument.fir.kt +++ /dev/null @@ -1,26 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION - -package kotlin - -object Scope { - fun foo(): Int = 0 - - object Nested { - @Deprecated("err") - @DeprecatedSinceKotlin(hiddenSince = "1.0") - fun foo(): String = "" - - fun take(f: () -> T): T = f() - - fun test() { - val r1 = take(::foo) - r1 - - val r2 = ::foo - ")!>r2 - - val r3 = foo() - r3 - } - } -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/deprecatedSinceKotlinHiddenOnReferenceArgument.kt b/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/deprecatedSinceKotlinHiddenOnReferenceArgument.kt index 4dd1e3f80fb..b9ae05a9c54 100644 --- a/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/deprecatedSinceKotlinHiddenOnReferenceArgument.kt +++ b/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/deprecatedSinceKotlinHiddenOnReferenceArgument.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION package kotlin diff --git a/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/hidden.fir.kt b/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/hidden.fir.kt index d240d8e439b..120153c3ed7 100644 --- a/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/hidden.fir.kt +++ b/compiler/testData/diagnostics/tests/deprecated/deprecatedSinceKotlin/hidden.fir.kt @@ -28,7 +28,7 @@ val valNext = Unit fun usage() { ClassCur() - funCur() + funCur() valCur ClassNext() diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java index 4d0a655ad18..a00e8c930f0 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java @@ -13893,6 +13893,22 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } } + @Nested + @TestMetadata("compiler/testData/codegen/box/deprecated") + @TestDataPath("$PROJECT_ROOT") + public class Deprecated { + @Test + public void testAllFilesPresentInDeprecated() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/deprecated"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @Test + @TestMetadata("deprecatedSinceKotlin.kt") + public void testDeprecatedSinceKotlin() throws Exception { + runTest("compiler/testData/codegen/box/deprecated/deprecatedSinceKotlin.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/destructuringDeclInLambdaParam") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index 31325fa5c8e..7d8c560c00a 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -13893,6 +13893,22 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } } + @Nested + @TestMetadata("compiler/testData/codegen/box/deprecated") + @TestDataPath("$PROJECT_ROOT") + public class Deprecated { + @Test + public void testAllFilesPresentInDeprecated() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/deprecated"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); + } + + @Test + @TestMetadata("deprecatedSinceKotlin.kt") + public void testDeprecatedSinceKotlin() throws Exception { + runTest("compiler/testData/codegen/box/deprecated/deprecatedSinceKotlin.kt"); + } + } + @Nested @TestMetadata("compiler/testData/codegen/box/destructuringDeclInLambdaParam") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 1222496897b..f244acaa4d6 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -11310,6 +11310,24 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } } + @TestMetadata("compiler/testData/codegen/box/deprecated") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Deprecated extends AbstractLightAnalysisModeTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); + } + + public void testAllFilesPresentInDeprecated() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/deprecated"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); + } + + @TestMetadata("deprecatedSinceKotlin.kt") + public void testDeprecatedSinceKotlin() throws Exception { + runTest("compiler/testData/codegen/box/deprecated/deprecatedSinceKotlin.kt"); + } + } + @TestMetadata("compiler/testData/codegen/box/destructuringDeclInLambdaParam") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index b8df718af5b..a294496a4aa 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -10044,6 +10044,19 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes } } + @TestMetadata("compiler/testData/codegen/box/deprecated") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Deprecated extends AbstractIrJsCodegenBoxES6Test { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR_ES6, testDataFilePath); + } + + public void testAllFilesPresentInDeprecated() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/deprecated"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); + } + } + @TestMetadata("compiler/testData/codegen/box/destructuringDeclInLambdaParam") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 9f97cf9a361..bf8f7e698f6 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -9450,6 +9450,19 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { } } + @TestMetadata("compiler/testData/codegen/box/deprecated") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Deprecated extends AbstractIrJsCodegenBoxTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); + } + + public void testAllFilesPresentInDeprecated() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/deprecated"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); + } + } + @TestMetadata("compiler/testData/codegen/box/destructuringDeclInLambdaParam") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index fec602f9445..6412ac34780 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -9450,6 +9450,19 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } } + @TestMetadata("compiler/testData/codegen/box/deprecated") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Deprecated extends AbstractJsCodegenBoxTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); + } + + public void testAllFilesPresentInDeprecated() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/deprecated"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); + } + } + @TestMetadata("compiler/testData/codegen/box/destructuringDeclInLambdaParam") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java index 825edb1f390..8a88682b4f3 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java @@ -4458,6 +4458,19 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest } } + @TestMetadata("compiler/testData/codegen/box/deprecated") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Deprecated extends AbstractIrCodegenBoxWasmTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath); + } + + public void testAllFilesPresentInDeprecated() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/deprecated"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); + } + } + @TestMetadata("compiler/testData/codegen/box/destructuringDeclInLambdaParam") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class)