From 99856afc31ae5610306beaa07132390b4855ca38 Mon Sep 17 00:00:00 2001 From: Mark Punzalan Date: Mon, 11 May 2020 15:10:20 -0700 Subject: [PATCH] ForLoopsLowering: Use `@file:OptIn(ExperimentalUnsignedTypes::class)` instead of annotating declarations. --- .../kotlin/backend/common/lower/loops/HeaderInfo.kt | 4 ++-- .../kotlin/backend/common/lower/loops/HeaderProcessor.kt | 2 -- .../kotlin/backend/common/lower/loops/ProgressionHandlers.kt | 3 --- .../kotlin/backend/common/lower/loops/ProgressionType.kt | 5 ++--- 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/loops/HeaderInfo.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/loops/HeaderInfo.kt index 7aa9570bf84..f0923fa888d 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/loops/HeaderInfo.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/loops/HeaderInfo.kt @@ -3,6 +3,8 @@ * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ +@file:OptIn(ExperimentalUnsignedTypes::class) + package org.jetbrains.kotlin.backend.common.lower.loops import org.jetbrains.kotlin.backend.common.CommonBackendContext @@ -71,7 +73,6 @@ internal class ProgressionHeaderInfo( additionalNotEmptyCondition = additionalNotEmptyCondition ) { - @ExperimentalUnsignedTypes val canOverflow: Boolean by lazy { if (canOverflow != null) return@lazy canOverflow @@ -268,7 +269,6 @@ internal abstract class HeaderInfoBuilder(context: CommonBackendContext, private override fun visitElement(element: IrElement, data: IrCall?): HeaderInfo? = null /** Builds a [HeaderInfo] for iterable expressions that are calls (e.g., `.reversed()`, `.indices`. */ - @ExperimentalUnsignedTypes override fun visitCall(iterable: IrCall, iteratorCall: IrCall?): HeaderInfo? { // Return the HeaderInfo from the first successful match. // First, try to match a `reversed()` or `withIndex()` call. diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/loops/HeaderProcessor.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/loops/HeaderProcessor.kt index 66bfb7cc81e..1b81723cc70 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/loops/HeaderProcessor.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/loops/HeaderProcessor.kt @@ -270,7 +270,6 @@ internal class ProgressionLoopHeader( private var loopVariable: IrVariable? = null - @ExperimentalUnsignedTypes override fun initializeIteration( loopVariable: IrVariable?, loopVariableComponents: Map, @@ -301,7 +300,6 @@ internal class ProgressionLoopHeader( listOfNotNull(loopVariable, incrementInductionVariable(this)) } - @ExperimentalUnsignedTypes override fun buildLoop(builder: DeclarationIrBuilder, oldLoop: IrLoop, newBody: IrExpression?) = with(builder) { val newLoop = if (headerInfo.canOverflow) { diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/loops/ProgressionHandlers.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/loops/ProgressionHandlers.kt index 13b97171e84..9d24cb7351f 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/loops/ProgressionHandlers.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/loops/ProgressionHandlers.kt @@ -85,7 +85,6 @@ internal class UntilHandler(private val context: CommonBackendContext, private v parameter(0) { it.type in progressionElementTypes } } - @ExperimentalUnsignedTypes override fun build(expression: IrCall, data: ProgressionType, scopeOwner: IrSymbol): HeaderInfo? = with(context.createIrBuilder(scopeOwner, expression.startOffset, expression.endOffset)) { with(data) { @@ -583,10 +582,8 @@ internal class DefaultProgressionHandler(private val context: CommonBackendConte private val symbols = context.ir.symbols - @ExperimentalUnsignedTypes override fun matchIterable(expression: IrExpression) = ProgressionType.fromIrType(expression.type, symbols) != null - @ExperimentalUnsignedTypes override fun build(expression: IrExpression, scopeOwner: IrSymbol): HeaderInfo? = with(context.createIrBuilder(scopeOwner, expression.startOffset, expression.endOffset)) { // Directly use the `first/last/step` properties of the progression. diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/loops/ProgressionType.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/loops/ProgressionType.kt index 631a4650e83..4bb68854563 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/loops/ProgressionType.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/loops/ProgressionType.kt @@ -3,6 +3,8 @@ * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ +@file:OptIn(ExperimentalUnsignedTypes::class) + package org.jetbrains.kotlin.backend.common.lower.loops import org.jetbrains.kotlin.backend.common.CommonBackendContext @@ -51,7 +53,6 @@ internal sealed class ProgressionType( } companion object { - @ExperimentalUnsignedTypes fun fromIrType(irType: IrType, symbols: Symbols): ProgressionType? = when { irType.isSubtypeOfClass(symbols.charProgression) -> CharProgressionType(symbols) irType.isSubtypeOfClass(symbols.intProgression) -> IntProgressionType(symbols) @@ -168,7 +169,6 @@ internal abstract class UnsignedProgressionType( } } -@ExperimentalUnsignedTypes internal class UIntProgressionType(symbols: Symbols) : UnsignedProgressionType( symbols, @@ -186,7 +186,6 @@ internal class UIntProgressionType(symbols: Symbols) : override fun DeclarationIrBuilder.zeroStepExpression() = irInt(0) } -@ExperimentalUnsignedTypes internal class ULongProgressionType(symbols: Symbols) : UnsignedProgressionType( symbols,