Fix compilation errors after rebasing.
This commit is contained in:
committed by
max-kammerer
parent
656f6855bb
commit
7276b7e66a
+4
-5
@@ -7,14 +7,13 @@ package org.jetbrains.kotlin.backend.common.lower.loops
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.CommonBackendContext
|
||||
import org.jetbrains.kotlin.backend.common.lower.matchers.IrCallMatcher
|
||||
import org.jetbrains.kotlin.backend.common.utils.isSubtypeOf
|
||||
import org.jetbrains.kotlin.ir.IrElement
|
||||
import org.jetbrains.kotlin.ir.declarations.IrValueDeclaration
|
||||
import org.jetbrains.kotlin.ir.declarations.IrVariable
|
||||
import org.jetbrains.kotlin.ir.expressions.IrCall
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.util.defaultType
|
||||
import org.jetbrains.kotlin.ir.types.isSubtypeOfClass
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitor
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.firstNotNullResult
|
||||
@@ -95,9 +94,9 @@ private class ProgressionHeaderInfoBuilder(val context: CommonBackendContext) :
|
||||
)
|
||||
|
||||
private fun IrType.getProgressionType(): ProgressionType? = when {
|
||||
isSubtypeOf(symbols.charProgression.owner.defaultType) -> ProgressionType.CHAR_PROGRESSION
|
||||
isSubtypeOf(symbols.intProgression.owner.defaultType) -> ProgressionType.INT_PROGRESSION
|
||||
isSubtypeOf(symbols.longProgression.owner.defaultType) -> ProgressionType.LONG_PROGRESSION
|
||||
isSubtypeOfClass(symbols.charProgression) -> ProgressionType.CHAR_PROGRESSION
|
||||
isSubtypeOfClass(symbols.intProgression) -> ProgressionType.INT_PROGRESSION
|
||||
isSubtypeOfClass(symbols.longProgression) -> ProgressionType.LONG_PROGRESSION
|
||||
else -> null
|
||||
}
|
||||
|
||||
|
||||
+3
-13
@@ -9,7 +9,6 @@ import org.jetbrains.kotlin.backend.common.CommonBackendContext
|
||||
import org.jetbrains.kotlin.backend.common.ir.Symbols
|
||||
import org.jetbrains.kotlin.backend.common.lower.DeclarationIrBuilder
|
||||
import org.jetbrains.kotlin.backend.common.lower.createIrBuilder
|
||||
import org.jetbrains.kotlin.backend.common.utils.isSubtypeOf
|
||||
import org.jetbrains.kotlin.ir.IrStatement
|
||||
import org.jetbrains.kotlin.ir.builders.irCall
|
||||
import org.jetbrains.kotlin.ir.builders.irGet
|
||||
@@ -26,7 +25,6 @@ import org.jetbrains.kotlin.ir.expressions.impl.IrWhileLoopImpl
|
||||
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
||||
import org.jetbrains.kotlin.ir.types.*
|
||||
import org.jetbrains.kotlin.ir.types.impl.IrStarProjectionImpl
|
||||
import org.jetbrains.kotlin.ir.util.functions
|
||||
import org.jetbrains.kotlin.ir.util.isNullable
|
||||
import org.jetbrains.kotlin.util.OperatorNameConventions
|
||||
@@ -143,15 +141,7 @@ internal class HeaderProcessor(
|
||||
fun processHeader(variable: IrVariable): ForLoopHeader? {
|
||||
|
||||
assert(variable.origin == IrDeclarationOrigin.FOR_LOOP_ITERATOR)
|
||||
// Create iterator type with star projections.
|
||||
val iteratorType = symbols.iterator.run {
|
||||
createType(
|
||||
hasQuestionMark = false,
|
||||
arguments = descriptor.declaredTypeParameters.map { IrStarProjectionImpl }
|
||||
)
|
||||
}
|
||||
|
||||
if (!variable.type.isSubtypeOf(iteratorType)) {
|
||||
if (!variable.type.isSubtypeOfClass(symbols.iterator)) {
|
||||
return null
|
||||
}
|
||||
val builder = context.createIrBuilder(scopeOwnerSymbol(), variable.startOffset, variable.endOffset)
|
||||
@@ -249,8 +239,8 @@ internal class HeaderProcessor(
|
||||
return if (type.toKotlinType() == progressionType.elementType(context).toKotlinType()) {
|
||||
this
|
||||
} else {
|
||||
val function = symbols.getFunction(progressionType.numberCastFunctionName, type.toKotlinType())
|
||||
IrCallImpl(startOffset, endOffset, function.owner.returnType, function)
|
||||
val function = type.getClass()!!.functions.first { it.name == progressionType.numberCastFunctionName }
|
||||
IrCallImpl(startOffset, endOffset, function.returnType, function.symbol)
|
||||
.apply { dispatchReceiver = this@castIfNecessary }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user