Drop redundant Suppress("RemoveExplicitTypeArguments")

This commit is contained in:
Mikhail Glukhikh
2022-01-25 10:57:53 +03:00
committed by Space
parent 02d74fbd87
commit ad0d0ca47f
13 changed files with 18 additions and 35 deletions
@@ -507,8 +507,7 @@ internal class KtSymbolByFirBuilder private constructor(
val containingClass = getContainingClass(rootSession) ?: return null
val originalDeclaration = originalForSubstitutionOverride ?: return null
@Suppress("RemoveExplicitTypeArguments")
val allowedTypeParameters = buildSet<ConeTypeParameterLookupTag> {
val allowedTypeParameters = buildSet {
// declaration's own parameters
originalDeclaration.typeParameters.mapTo(this) { it.symbol.toLookupTag() }
@@ -31,7 +31,7 @@ abstract class AbstractCollectDiagnosticsTest : AbstractHLApiSingleFileTest() {
analyseForTest(ktFile) {
val diagnosticsInFile =
ktFile.collectDiagnosticsForFile(KtDiagnosticCheckerFilter.EXTENDED_AND_COMMON_CHECKERS).map { it.getKey() }.sorted()
@Suppress("RemoveExplicitTypeArguments") val diagnosticsFromElements = buildList<Pair<KtElement, DiagnosticKey>> {
val diagnosticsFromElements = buildList {
ktFile.accept(object : KtTreeVisitorVoid() {
override fun visitKtElement(element: KtElement) {
for (diagnostic in element.getDiagnostics(KtDiagnosticCheckerFilter.EXTENDED_AND_COMMON_CHECKERS)) {
@@ -58,8 +58,7 @@ object AbstractTypeMapper {
val argumentsCount = type.argumentsCount()
val argumentsList = type.asArgumentList()
@Suppress("RemoveExplicitTypeArguments") // Workaround for KT-42175
val arguments = buildList<KotlinTypeMarker> {
val arguments = buildList {
for (i in 0 until (argumentsCount - 1)) {
this += argumentsList[i].adjustedType()
}
@@ -203,12 +203,11 @@ internal class MethodNodeExaminer(
for (index in insns.indices.reversed()) {
if (insns[index].opcode == Opcodes.ARETURN) continue
@Suppress("RemoveExplicitTypeArguments")
val newResult =
controlFlowGraph
.getSuccessorsIndices(index).plus(index)
.map(reachableReturnsIndices::get)
.fold<Set<Int>?, Set<Int>?>(mutableSetOf<Int>()) { acc, successorsResult ->
.fold<Set<Int>?, Set<Int>?>(mutableSetOf()) { acc, successorsResult ->
if (acc != null && successorsResult != null) acc + successorsResult else null
}
@@ -125,7 +125,6 @@ class FirStatusResolver(
return emptyList()
}
@Suppress("RemoveExplicitTypeArguments") // Workaround for KT-42175
return buildList<FirCallableDeclaration> {
val scope = containingClass.unsubstitutedScope(session, scopeSession, withForcedTypeCalculator = false)
val symbol = function.symbol
@@ -36,16 +36,15 @@ fun <F : FirClassLikeDeclaration> F.runTypeResolvePhaseForLocalClass(
useSiteFile: FirFile,
containingDeclarations: List<FirDeclaration>,
): F {
@Suppress("RemoveExplicitTypeArguments")
val transformer = FirTypeResolveTransformer(
session,
scopeSession,
currentScopeList,
initialCurrentFile = useSiteFile,
classDeclarationsStack = containingDeclarations.filterIsInstanceTo<FirClass, ArrayDeque<FirClass>>(ArrayDeque())
classDeclarationsStack = containingDeclarations.filterIsInstanceTo(ArrayDeque())
)
return this.transform<F, Nothing?>(transformer, null)
return this.transform(transformer, null)
}
open class FirTypeResolveTransformer(
@@ -24,7 +24,6 @@ import org.jetbrains.kotlin.ir.util.parentAsClass
import org.jetbrains.kotlin.ir.util.resolveFakeOverride
import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid
@Suppress("RemoveExplicitTypeArguments")
internal val resolveInlineCallsPhase = makeIrModulePhase(
::ResolveInlineCalls,
name = "ResolveInlineCalls",
@@ -11,7 +11,6 @@ import org.jetbrains.kotlin.config.ExplicitApiMode
import org.jetbrains.kotlin.config.JvmDefaultMode
import org.jetbrains.kotlin.test.directives.model.SimpleDirectivesContainer
@Suppress("RemoveExplicitTypeArguments")
object LanguageSettingsDirectives : SimpleDirectivesContainer() {
val LANGUAGE by stringDirective(
description = """
@@ -20,7 +19,6 @@ object LanguageSettingsDirectives : SimpleDirectivesContainer() {
""".trimIndent()
)
@Suppress("RemoveExplicitTypeArguments")
val API_VERSION by valueDirective<ApiVersion>(
description = "Version of Kotlin API",
parser = this::parseApiVersion
@@ -43,7 +41,7 @@ object LanguageSettingsDirectives : SimpleDirectivesContainer() {
description = "Allow using Result in return type position"
)
val EXPLICIT_API_MODE by enumDirective<ExplicitApiMode>(
val EXPLICIT_API_MODE by enumDirective(
"Configures explicit API mode (AnalysisFlags.explicitApiMode)",
additionalParser = ExplicitApiMode.Companion::fromString
)
@@ -54,7 +52,7 @@ object LanguageSettingsDirectives : SimpleDirectivesContainer() {
// --------------------- Jvm Analysis Flags ---------------------
val JVM_DEFAULT_MODE by enumDirective<JvmDefaultMode>(
val JVM_DEFAULT_MODE by enumDirective(
description = "Configures corresponding analysis flag (JvmAnalysisFlags.jvmDefaultMode)",
additionalParser = JvmDefaultMode.Companion::fromStringOrNull
)
@@ -11,14 +11,13 @@ import org.jetbrains.kotlin.test.services.configuration.JavaForeignAnnotationTyp
import org.jetbrains.kotlin.load.java.ReportLevel
import org.jetbrains.kotlin.name.FqName
@Suppress("RemoveExplicitTypeArguments")
object ForeignAnnotationsDirectives : SimpleDirectivesContainer() {
val JSR305_GLOBAL_REPORT by enumDirective<ReportLevel>(
val JSR305_GLOBAL_REPORT by enumDirective(
description = "Global report level",
additionalParser = ReportLevel.Companion::findByDescription
)
val JSR305_MIGRATION_REPORT by enumDirective<ReportLevel>(
val JSR305_MIGRATION_REPORT by enumDirective(
description = "Migration report level",
additionalParser = ReportLevel.Companion::findByDescription
)
@@ -27,7 +26,7 @@ object ForeignAnnotationsDirectives : SimpleDirectivesContainer() {
description = "Report level for specific annotations"
)
val JSPECIFY_STATE by enumDirective<ReportLevel>(
val JSPECIFY_STATE by enumDirective(
description = "Report level for jSpecify annotations",
additionalParser = ReportLevel.Companion::findByDescription
)
@@ -12,8 +12,7 @@ import org.jetbrains.kotlin.test.directives.model.DirectiveApplicability
import org.jetbrains.kotlin.test.directives.model.SimpleDirectivesContainer
object JvmEnvironmentConfigurationDirectives : SimpleDirectivesContainer() {
@Suppress("RemoveExplicitTypeArguments")
val JVM_TARGET by enumDirective<JvmTarget>(
val JVM_TARGET by enumDirective(
description = "Target bytecode version",
additionalParser = JvmTarget.Companion::fromString
)
@@ -50,14 +49,12 @@ object JvmEnvironmentConfigurationDirectives : SimpleDirectivesContainer() {
applicability = DirectiveApplicability.Global
)
@Suppress("RemoveExplicitTypeArguments")
val STRING_CONCAT by enumDirective<JvmStringConcat>(
val STRING_CONCAT by enumDirective(
description = "Configure mode of string concatenation",
additionalParser = JvmStringConcat.Companion::fromString
)
@Suppress("RemoveExplicitTypeArguments")
val ASSERTIONS_MODE by enumDirective<JVMAssertionsMode>(
val ASSERTIONS_MODE by enumDirective(
description = "Configure jvm assertions mode",
additionalParser = JVMAssertionsMode.Companion::fromString
)
@@ -21,8 +21,7 @@ class ServiceLoaderLiteTestWithClassLoader : AbstractServiceLoaderLiteTest() {
inner class InnerComponent : Intf
fun testClassloader1() {
@Suppress("RemoveExplicitTypeArguments")
val entries = arrayOf(impls<Intf>(Component1::class, Component2::class), clazz<Component1>(), clazz<Component2>())
val entries = arrayOf(impls(Component1::class, Component2::class), clazz<Component1>(), clazz<Component2>())
classLoaderTest("test", *entries) { classLoader ->
val impls = ServiceLoaderLite.loadImplementations<Intf>(classLoader)
@@ -62,8 +61,7 @@ class ServiceLoaderLiteTestWithClassLoader : AbstractServiceLoaderLiteTest() {
}
fun testInterface() {
@Suppress("RemoveExplicitTypeArguments")
classLoaderTest("test", impls<Intf>(Intf::class), clazz<Intf>()) { classLoader ->
classLoaderTest("test", impls(Intf::class), clazz<Intf>()) { classLoader ->
assertThrows<InstantiationException> {
ServiceLoaderLite.loadImplementations<Intf>(classLoader)
}
@@ -29,9 +29,8 @@ val ScriptCompilationConfigurationKeys.ide
val IdeScriptCompilationConfigurationKeys.dependenciesSources by PropertiesCollection.key<List<ScriptDependency>>()
@Suppress("RemoveExplicitTypeArguments")
val IdeScriptCompilationConfigurationKeys.acceptedLocations
by PropertiesCollection.key<List<ScriptAcceptedLocation>>(
by PropertiesCollection.key(
listOf(
ScriptAcceptedLocation.Sources,
ScriptAcceptedLocation.Tests
@@ -13,9 +13,7 @@ internal data class NameAndSafeValue(val name: String, val safeValue: String)
internal object SafeEnvVars : Iterable<NameAndSafeValue> {
private val environment: List<NameAndSafeValue> by lazy {
// See KT-49925
@Suppress("RemoveExplicitTypeArguments")
buildList<NameAndSafeValue> {
buildList {
System.getenv().forEach { (name, value) ->
val safeValue = if (isSafeEnvVar(name)) doEscape(value) else HIDDEN_VALUE
this += NameAndSafeValue(name, safeValue)