IR: Introduce IrClassifierSymbol.defaultType

This commit is contained in:
Steven Schäfer
2019-11-15 18:14:05 +01:00
committed by Alexander Udalov
parent 3d7d1022e4
commit 85b36dcd88
12 changed files with 39 additions and 33 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2019 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.
*/
@@ -31,6 +31,7 @@ import org.jetbrains.kotlin.ir.symbols.impl.IrFieldSymbolImpl
import org.jetbrains.kotlin.ir.symbols.impl.IrSimpleFunctionSymbolImpl
import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.ir.types.classifierOrFail
import org.jetbrains.kotlin.ir.types.defaultType
import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl
import org.jetbrains.kotlin.ir.types.typeWith
import org.jetbrains.kotlin.ir.util.*
@@ -319,7 +320,7 @@ abstract class AbstractSuspendFunctionsLowering<C : CommonBackendContext>(val co
private val coroutineConstructors = mutableListOf<IrConstructor>()
fun build(): BuiltCoroutine {
val superTypes = mutableListOf(coroutineBaseClass.owner.defaultType)
val superTypes = mutableListOf(coroutineBaseClass.defaultType)
var suspendFunctionClass: IrClass? = null
var functionClass: IrClass? = null
val suspendFunctionClassTypeArguments: List<IrType>?
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2019 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.
*/
@@ -382,7 +382,7 @@ private fun IrFunction.generateDefaultsFunctionImpl(context: CommonBackendContex
newFunction.addValueParameter("mask$i".synthesizedString, context.irBuiltIns.intType)
}
if (this is IrConstructor) {
val markerType = context.ir.symbols.defaultConstructorMarker.owner.defaultType.makeNullable()
val markerType = context.ir.symbols.defaultConstructorMarker.defaultType.makeNullable()
newFunction.addValueParameter("marker".synthesizedString, markerType)
} else if (context.ir.shouldGenerateHandlerParameterForDefaultBodyFun()) {
newFunction.addValueParameter("handler".synthesizedString, context.irBuiltIns.anyNType)
@@ -228,7 +228,7 @@ internal class StepHandler(
private val symbols = context.ir.symbols
override val matcher = SimpleCalleeMatcher {
singleArgumentExtension(FqName("kotlin.ranges.step"), symbols.progressionClasses.map { it.owner.defaultType })
singleArgumentExtension(FqName("kotlin.ranges.step"), symbols.progressionClasses.map { it.defaultType })
parameter(0) { it.type.isInt() || it.type.isLong() }
}