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. * 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.symbols.impl.IrSimpleFunctionSymbolImpl
import org.jetbrains.kotlin.ir.types.IrType import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.ir.types.classifierOrFail 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.impl.IrSimpleTypeImpl
import org.jetbrains.kotlin.ir.types.typeWith import org.jetbrains.kotlin.ir.types.typeWith
import org.jetbrains.kotlin.ir.util.* import org.jetbrains.kotlin.ir.util.*
@@ -319,7 +320,7 @@ abstract class AbstractSuspendFunctionsLowering<C : CommonBackendContext>(val co
private val coroutineConstructors = mutableListOf<IrConstructor>() private val coroutineConstructors = mutableListOf<IrConstructor>()
fun build(): BuiltCoroutine { fun build(): BuiltCoroutine {
val superTypes = mutableListOf(coroutineBaseClass.owner.defaultType) val superTypes = mutableListOf(coroutineBaseClass.defaultType)
var suspendFunctionClass: IrClass? = null var suspendFunctionClass: IrClass? = null
var functionClass: IrClass? = null var functionClass: IrClass? = null
val suspendFunctionClassTypeArguments: List<IrType>? 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. * 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) newFunction.addValueParameter("mask$i".synthesizedString, context.irBuiltIns.intType)
} }
if (this is IrConstructor) { 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) newFunction.addValueParameter("marker".synthesizedString, markerType)
} else if (context.ir.shouldGenerateHandlerParameterForDefaultBodyFun()) { } else if (context.ir.shouldGenerateHandlerParameterForDefaultBodyFun()) {
newFunction.addValueParameter("handler".synthesizedString, context.irBuiltIns.anyNType) newFunction.addValueParameter("handler".synthesizedString, context.irBuiltIns.anyNType)
@@ -228,7 +228,7 @@ internal class StepHandler(
private val symbols = context.ir.symbols private val symbols = context.ir.symbols
override val matcher = SimpleCalleeMatcher { 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() } parameter(0) { it.type.isInt() || it.type.isLong() }
} }
@@ -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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -15,7 +15,6 @@ import org.jetbrains.kotlin.ir.expressions.IrClassReference
import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrExpression
import org.jetbrains.kotlin.ir.expressions.IrGetClass import org.jetbrains.kotlin.ir.expressions.IrGetClass
import org.jetbrains.kotlin.ir.types.* import org.jetbrains.kotlin.ir.types.*
import org.jetbrains.kotlin.ir.util.defaultType
import org.jetbrains.kotlin.ir.util.isFunction import org.jetbrains.kotlin.ir.util.isFunction
import org.jetbrains.kotlin.ir.util.isThrowable import org.jetbrains.kotlin.ir.util.isThrowable
import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid
@@ -79,7 +78,7 @@ class ClassReferenceLowering(val context: JsIrBackendContext) : FileLoweringPass
private fun getPrimitiveClass(target: IrSimpleFunction, returnType: IrType) = private fun getPrimitiveClass(target: IrSimpleFunction, returnType: IrType) =
JsIrBuilder.buildCall(target.symbol, returnType).apply { JsIrBuilder.buildCall(target.symbol, returnType).apply {
dispatchReceiver = JsIrBuilder.buildGetObjectValue(primitiveClassesObject.owner.defaultType, primitiveClassesObject) dispatchReceiver = JsIrBuilder.buildGetObjectValue(primitiveClassesObject.defaultType, primitiveClassesObject)
} }
private fun getFinalPrimitiveKClass(returnType: IrType, typeArgument: IrType): IrCall? { private fun getFinalPrimitiveKClass(returnType: IrType, typeArgument: IrType): IrCall? {
@@ -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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -8,7 +8,6 @@ package org.jetbrains.kotlin.ir.backend.js.lower
import org.jetbrains.kotlin.backend.common.FileLoweringPass import org.jetbrains.kotlin.backend.common.FileLoweringPass
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
import org.jetbrains.kotlin.ir.backend.js.JsIrBackendContext import org.jetbrains.kotlin.ir.backend.js.JsIrBackendContext
import org.jetbrains.kotlin.ir.backend.js.ir.JsIrBuilder
import org.jetbrains.kotlin.ir.declarations.IrFile import org.jetbrains.kotlin.ir.declarations.IrFile
import org.jetbrains.kotlin.ir.expressions.IrConst import org.jetbrains.kotlin.ir.expressions.IrConst
import org.jetbrains.kotlin.ir.expressions.IrConstKind import org.jetbrains.kotlin.ir.expressions.IrConstKind
@@ -18,8 +17,8 @@ import org.jetbrains.kotlin.ir.expressions.impl.IrConstructorCallImpl
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
import org.jetbrains.kotlin.ir.types.IrType import org.jetbrains.kotlin.ir.types.IrType
import org.jetbrains.kotlin.ir.types.classifierOrNull import org.jetbrains.kotlin.ir.types.classifierOrNull
import org.jetbrains.kotlin.ir.types.defaultType
import org.jetbrains.kotlin.ir.util.constructors import org.jetbrains.kotlin.ir.util.constructors
import org.jetbrains.kotlin.ir.util.defaultType
import org.jetbrains.kotlin.ir.util.isUnsigned import org.jetbrains.kotlin.ir.util.isUnsigned
import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid
import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid
@@ -33,7 +32,7 @@ class ConstTransformer(private val context: JsIrBackendContext) : IrElementTrans
): IrExpression { ): IrExpression {
val constructor = irClass.constructors.single() val constructor = irClass.constructors.single()
val argType = constructor.owner.valueParameters.first().type val argType = constructor.owner.valueParameters.first().type
return IrConstructorCallImpl.fromSymbolOwner(irClass.owner.defaultType, constructor).apply { return IrConstructorCallImpl.fromSymbolOwner(irClass.defaultType, constructor).apply {
for (i in args.indices) { for (i in args.indices) {
putValueArgument(i, carrierFactory(UNDEFINED_OFFSET, UNDEFINED_OFFSET, argType, args[i])) putValueArgument(i, carrierFactory(UNDEFINED_OFFSET, UNDEFINED_OFFSET, argType, args[i]))
} }
@@ -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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -16,9 +16,9 @@ import org.jetbrains.kotlin.ir.builders.declarations.buildClass
import org.jetbrains.kotlin.ir.declarations.IrClass import org.jetbrains.kotlin.ir.declarations.IrClass
import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin
import org.jetbrains.kotlin.ir.declarations.IrModuleFragment import org.jetbrains.kotlin.ir.declarations.IrModuleFragment
import org.jetbrains.kotlin.ir.types.defaultType
import org.jetbrains.kotlin.ir.util.ExternalDependenciesGenerator import org.jetbrains.kotlin.ir.util.ExternalDependenciesGenerator
import org.jetbrains.kotlin.ir.util.SymbolTable import org.jetbrains.kotlin.ir.util.SymbolTable
import org.jetbrains.kotlin.ir.util.defaultType
import org.jetbrains.kotlin.ir.util.render import org.jetbrains.kotlin.ir.util.render
import org.jetbrains.kotlin.load.kotlin.JvmPackagePartSource import org.jetbrains.kotlin.load.kotlin.JvmPackagePartSource
import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.psi.KtFile
@@ -60,7 +60,7 @@ object JvmBackendFacade {
context.methodSignatureMapper.mapAsmMethod(context.referenceFunction(descriptor).owner) context.methodSignatureMapper.mapAsmMethod(context.referenceFunction(descriptor).owner)
} }
state.mapInlineClass = { descriptor -> state.mapInlineClass = { descriptor ->
context.typeMapper.mapType(context.referenceClass(descriptor).owner.defaultType) context.typeMapper.mapType(context.referenceClass(descriptor).defaultType)
} }
//TODO //TODO
ExternalDependenciesGenerator( ExternalDependenciesGenerator(
@@ -235,7 +235,7 @@ class JvmSymbols(
} }
val suspendLambdaClass: IrClassSymbol = createClass(FqName("kotlin.coroutines.jvm.internal.SuspendLambda")) { klass -> val suspendLambdaClass: IrClassSymbol = createClass(FqName("kotlin.coroutines.jvm.internal.SuspendLambda")) { klass ->
klass.superTypes += suspendFunctionInterface.owner.defaultType klass.superTypes += suspendFunctionInterface.defaultType
klass.addConstructor().apply { klass.addConstructor().apply {
addValueParameter("arity", irBuiltIns.intType) addValueParameter("arity", irBuiltIns.intType)
addValueParameter("completion", continuationClass.typeWith(irBuiltIns.anyNType).makeNullable()) addValueParameter("completion", continuationClass.typeWith(irBuiltIns.anyNType).makeNullable())
@@ -255,7 +255,7 @@ class JvmSymbols(
private fun generateCallableReferenceMethods(klass: IrClass) { private fun generateCallableReferenceMethods(klass: IrClass) {
klass.addFunction("getSignature", irBuiltIns.stringType, Modality.OPEN) klass.addFunction("getSignature", irBuiltIns.stringType, Modality.OPEN)
klass.addFunction("getName", irBuiltIns.stringType, Modality.OPEN) klass.addFunction("getName", irBuiltIns.stringType, Modality.OPEN)
klass.addFunction("getOwner", irBuiltIns.kDeclarationContainerClass.owner.defaultType, Modality.OPEN) klass.addFunction("getOwner", irBuiltIns.kDeclarationContainerClass.defaultType, Modality.OPEN)
} }
val functionReference: IrClassSymbol = createClass(FqName("kotlin.jvm.internal.FunctionReference")) { klass -> val functionReference: IrClassSymbol = createClass(FqName("kotlin.jvm.internal.FunctionReference")) { klass ->
@@ -346,11 +346,11 @@ class JvmSymbols(
) { klass -> ) { klass ->
if (impl) { if (impl) {
klass.addConstructor().apply { klass.addConstructor().apply {
addValueParameter("owner", irBuiltIns.kDeclarationContainerClass.owner.defaultType) addValueParameter("owner", irBuiltIns.kDeclarationContainerClass.defaultType)
addValueParameter("name", irBuiltIns.stringType) addValueParameter("name", irBuiltIns.stringType)
addValueParameter("string", irBuiltIns.stringType) addValueParameter("string", irBuiltIns.stringType)
} }
klass.superTypes += getPropertyReferenceClass(mutable, parameterCount, false).owner.defaultType klass.superTypes += getPropertyReferenceClass(mutable, parameterCount, false).defaultType
} else { } else {
klass.addConstructor() klass.addConstructor()
@@ -405,7 +405,7 @@ class JvmSymbols(
val javaLangClassType = javaLangClass.starProjectedType val javaLangClassType = javaLangClass.starProjectedType
val kClassType = irBuiltIns.kClassClass.starProjectedType val kClassType = irBuiltIns.kClassClass.starProjectedType
klass.addFunction("getOrCreateKotlinPackage", irBuiltIns.kDeclarationContainerClass.owner.defaultType, isStatic = true).apply { klass.addFunction("getOrCreateKotlinPackage", irBuiltIns.kDeclarationContainerClass.defaultType, isStatic = true).apply {
addValueParameter("javaClass", javaLangClassType) addValueParameter("javaClass", javaLangClassType)
addValueParameter("moduleName", irBuiltIns.stringType) addValueParameter("moduleName", irBuiltIns.stringType)
} }
@@ -422,7 +422,7 @@ class JvmSymbols(
for (n in 0..2) { for (n in 0..2) {
val functionName = (if (mutable) "mutableProperty" else "property") + n val functionName = (if (mutable) "mutableProperty" else "property") + n
klass.addFunction(functionName, irBuiltIns.getKPropertyClass(mutable, n).starProjectedType, isStatic = true).apply { klass.addFunction(functionName, irBuiltIns.getKPropertyClass(mutable, n).starProjectedType, isStatic = true).apply {
addValueParameter("p", getPropertyReferenceClass(mutable, n, impl = false).owner.defaultType) addValueParameter("p", getPropertyReferenceClass(mutable, n, impl = false).defaultType)
} }
} }
} }
@@ -530,7 +530,7 @@ class JvmSymbols(
addValueParameter("element", irType) addValueParameter("element", irType)
} }
klass.addFunction("toArray", irBuiltIns.primitiveArrayForType.getValue(irType).owner.defaultType) klass.addFunction("toArray", irBuiltIns.primitiveArrayForType.getValue(irType).defaultType)
} }
} }
@@ -44,7 +44,7 @@ class IrTypeMapper(private val context: JvmBackendContext) : KotlinTypeMapperBas
is ClassDescriptor -> is ClassDescriptor ->
mapClass(context.referenceClass(classifier).owner) mapClass(context.referenceClass(classifier).owner)
is TypeParameterDescriptor -> is TypeParameterDescriptor ->
mapType(context.referenceTypeParameter(classifier).owner.defaultType) mapType(context.referenceTypeParameter(classifier).defaultType)
else -> else ->
error("Unknown descriptor: $classifier") error("Unknown descriptor: $classifier")
} }
@@ -128,7 +128,7 @@ internal class CallableReferenceLowering(private val context: JvmBackendContext)
private val superMethod = private val superMethod =
functionSuperClass.functions.single { it.owner.modality == Modality.ABSTRACT } functionSuperClass.functions.single { it.owner.modality == Modality.ABSTRACT }
private val superType = private val superType =
samSuperType ?: (if (isLambda) context.ir.symbols.lambdaClass else context.ir.symbols.functionReference).owner.defaultType samSuperType ?: (if (isLambda) context.ir.symbols.lambdaClass else context.ir.symbols.functionReference).defaultType
private val functionReferenceClass = buildClass { private val functionReferenceClass = buildClass {
setSourceRange(irFunctionReference) setSourceRange(irFunctionReference)
@@ -142,7 +142,7 @@ internal class CallableReferenceLowering(private val context: JvmBackendContext)
superTypes += superType superTypes += superType
if (samSuperType == null) if (samSuperType == null)
superTypes += functionSuperClass.typeWith(parameterTypes) superTypes += functionSuperClass.typeWith(parameterTypes)
if (irFunctionReference.isSuspend) superTypes += context.ir.symbols.suspendFunctionInterface.owner.defaultType if (irFunctionReference.isSuspend) superTypes += context.ir.symbols.suspendFunctionInterface.defaultType
createImplicitParameterDeclarationWithWrappedDescriptor() createImplicitParameterDeclarationWithWrappedDescriptor()
copyAttributes(irFunctionReference) copyAttributes(irFunctionReference)
} }
@@ -21,6 +21,7 @@ import org.jetbrains.kotlin.ir.declarations.IrEnumEntry
import org.jetbrains.kotlin.ir.declarations.IrField import org.jetbrains.kotlin.ir.declarations.IrField
import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrExpression
import org.jetbrains.kotlin.ir.expressions.impl.IrGetEnumValueImpl import org.jetbrains.kotlin.ir.expressions.impl.IrGetEnumValueImpl
import org.jetbrains.kotlin.ir.types.defaultType
import org.jetbrains.kotlin.ir.types.getClass import org.jetbrains.kotlin.ir.types.getClass
import org.jetbrains.kotlin.ir.util.* import org.jetbrains.kotlin.ir.util.*
import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.name.Name
@@ -83,7 +84,7 @@ private class MappedEnumWhenLowering(context: CommonBackendContext) : EnumWhenLo
mappings.getOrPut(enumClass) { mappings.getOrPut(enumClass) {
mutableMapOf<IrEnumEntry, Int>() to mappingsClass.addField { mutableMapOf<IrEnumEntry, Int>() to mappingsClass.addField {
name = Name.identifier("\$EnumSwitchMapping\$${mappings.size}") name = Name.identifier("\$EnumSwitchMapping\$${mappings.size}")
type = intArray.owner.defaultType type = intArray.defaultType
origin = JvmLoweredDeclarationOrigin.ENUM_MAPPINGS_FOR_WHEN origin = JvmLoweredDeclarationOrigin.ENUM_MAPPINGS_FOR_WHEN
isFinal = true isFinal = true
isStatic = true isStatic = true
@@ -31,10 +31,7 @@ import org.jetbrains.kotlin.ir.declarations.impl.IrConstructorImpl
import org.jetbrains.kotlin.ir.expressions.* import org.jetbrains.kotlin.ir.expressions.*
import org.jetbrains.kotlin.ir.expressions.impl.* import org.jetbrains.kotlin.ir.expressions.impl.*
import org.jetbrains.kotlin.ir.symbols.* import org.jetbrains.kotlin.ir.symbols.*
import org.jetbrains.kotlin.ir.types.classOrNull import org.jetbrains.kotlin.ir.types.*
import org.jetbrains.kotlin.ir.types.classifierOrNull
import org.jetbrains.kotlin.ir.types.isSubtypeOfClass
import org.jetbrains.kotlin.ir.types.makeNullable
import org.jetbrains.kotlin.ir.util.* import org.jetbrains.kotlin.ir.util.*
import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid
import org.jetbrains.kotlin.load.java.JavaVisibilities import org.jetbrains.kotlin.load.java.JavaVisibilities
@@ -169,7 +166,7 @@ internal class SyntheticAccessorLowering(val context: JvmBackendContext) : IrEle
accessor.returnType = source.returnType.remapTypeParameters(source, accessor) accessor.returnType = source.returnType.remapTypeParameters(source, accessor)
accessor.addValueParameter( accessor.addValueParameter(
"marker", context.ir.symbols.defaultConstructorMarker.owner.defaultType, JvmLoweredDeclarationOrigin.SYNTHETIC_ACCESSOR "marker", context.ir.symbols.defaultConstructorMarker.defaultType, JvmLoweredDeclarationOrigin.SYNTHETIC_ACCESSOR
) )
accessor.body = IrExpressionBodyImpl( accessor.body = IrExpressionBodyImpl(
@@ -370,7 +367,7 @@ internal class SyntheticAccessorLowering(val context: JvmBackendContext) : IrEle
IrConstImpl.constNull( IrConstImpl.constNull(
UNDEFINED_OFFSET, UNDEFINED_OFFSET,
UNDEFINED_OFFSET, UNDEFINED_OFFSET,
context.ir.symbols.defaultConstructorMarker.owner.defaultType.makeNullable() context.ir.symbols.defaultConstructorMarker.defaultType.makeNullable()
) )
) )
} }
@@ -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. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@@ -10,7 +10,9 @@ import org.jetbrains.kotlin.ir.declarations.IrClass
import org.jetbrains.kotlin.ir.declarations.IrTypeParameter import org.jetbrains.kotlin.ir.declarations.IrTypeParameter
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol
import org.jetbrains.kotlin.ir.symbols.IrTypeParameterSymbol
import org.jetbrains.kotlin.ir.types.impl.* import org.jetbrains.kotlin.ir.types.impl.*
import org.jetbrains.kotlin.ir.util.defaultType
import org.jetbrains.kotlin.types.* import org.jetbrains.kotlin.types.*
import org.jetbrains.kotlin.types.typeUtil.makeNotNullable import org.jetbrains.kotlin.types.typeUtil.makeNotNullable
import org.jetbrains.kotlin.types.typeUtil.makeNullable import org.jetbrains.kotlin.types.typeUtil.makeNullable
@@ -96,6 +98,13 @@ private fun makeKotlinType(
return classifier.descriptor.defaultType.replace(newArguments = kotlinTypeArguments).makeNullableAsSpecified(hasQuestionMark) return classifier.descriptor.defaultType.replace(newArguments = kotlinTypeArguments).makeNullableAsSpecified(hasQuestionMark)
} }
val IrClassifierSymbol.defaultType: IrType
get() = when (this) {
is IrClassSymbol -> owner.defaultType
is IrTypeParameterSymbol -> owner.defaultType
else -> error("Unexpected classifier symbol type $this")
}
val IrTypeParameter.defaultType: IrType val IrTypeParameter.defaultType: IrType
get() = IrSimpleTypeImpl( get() = IrSimpleTypeImpl(
symbol, symbol,