JVM_IR Minor: refactor rawType
This commit is contained in:
@@ -387,13 +387,5 @@ private fun JvmBackendContext.makeRawTypeAnnotation() =
|
|||||||
generatorExtensions.rawTypeAnnotationConstructor.symbol
|
generatorExtensions.rawTypeAnnotationConstructor.symbol
|
||||||
)
|
)
|
||||||
|
|
||||||
fun IrClassSymbol.rawDefaultType(context: JvmBackendContext): IrType =
|
fun IrClass.rawType(context: JvmBackendContext): IrType =
|
||||||
this.defaultType.addAnnotations(listOf(context.makeRawTypeAnnotation()))
|
defaultType.addAnnotations(listOf(context.makeRawTypeAnnotation()))
|
||||||
|
|
||||||
fun IrClassSymbol.rawStarProjectedType(context: JvmBackendContext): IrSimpleType =
|
|
||||||
IrSimpleTypeImpl(
|
|
||||||
this,
|
|
||||||
hasQuestionMark = false,
|
|
||||||
arguments = owner.typeParameters.map { IrStarProjectionImpl },
|
|
||||||
annotations = listOf(context.makeRawTypeAnnotation())
|
|
||||||
)
|
|
||||||
|
|||||||
+3
-4
@@ -10,8 +10,7 @@ import org.jetbrains.kotlin.backend.common.lower.SingleAbstractMethodLowering
|
|||||||
import org.jetbrains.kotlin.backend.common.phaser.makeIrFilePhase
|
import org.jetbrains.kotlin.backend.common.phaser.makeIrFilePhase
|
||||||
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
|
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
|
||||||
import org.jetbrains.kotlin.backend.jvm.ir.erasedUpperBound
|
import org.jetbrains.kotlin.backend.jvm.ir.erasedUpperBound
|
||||||
import org.jetbrains.kotlin.backend.jvm.ir.rawDefaultType
|
import org.jetbrains.kotlin.backend.jvm.ir.rawType
|
||||||
import org.jetbrains.kotlin.backend.jvm.ir.rawStarProjectedType
|
|
||||||
import org.jetbrains.kotlin.descriptors.DescriptorVisibilities
|
import org.jetbrains.kotlin.descriptors.DescriptorVisibilities
|
||||||
import org.jetbrains.kotlin.ir.IrElement
|
import org.jetbrains.kotlin.ir.IrElement
|
||||||
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
import org.jetbrains.kotlin.ir.UNDEFINED_OFFSET
|
||||||
@@ -45,10 +44,10 @@ private class JvmSingleAbstractMethodLowering(context: JvmBackendContext) : Sing
|
|||||||
if (inInlineFunctionScope) DescriptorVisibilities.PUBLIC else JavaDescriptorVisibilities.PACKAGE_VISIBILITY
|
if (inInlineFunctionScope) DescriptorVisibilities.PUBLIC else JavaDescriptorVisibilities.PACKAGE_VISIBILITY
|
||||||
|
|
||||||
override fun getSuperTypeForWrapper(typeOperand: IrType): IrType =
|
override fun getSuperTypeForWrapper(typeOperand: IrType): IrType =
|
||||||
typeOperand.erasedUpperBound.symbol.rawDefaultType(context as JvmBackendContext)
|
typeOperand.erasedUpperBound.rawType(context as JvmBackendContext)
|
||||||
|
|
||||||
override fun getWrappedFunctionType(klass: IrClass): IrType =
|
override fun getWrappedFunctionType(klass: IrClass): IrType =
|
||||||
klass.symbol.rawStarProjectedType(context as JvmBackendContext)
|
klass.rawType(context as JvmBackendContext)
|
||||||
|
|
||||||
// The constructor of a SAM wrapper is non-synthetic and should not have line numbers.
|
// The constructor of a SAM wrapper is non-synthetic and should not have line numbers.
|
||||||
// Otherwise the debugger will try to step into it.
|
// Otherwise the debugger will try to step into it.
|
||||||
|
|||||||
Reference in New Issue
Block a user