Erase non-reified type parameters by-default when inlining.
Substitution of type arguments to non-reified type parameters may lead to accidental reification, which should not be done (see ^KT-60174 for examples). So, we should erase them, except the few cases. ^KT-60174: Fixed ^KT-60175: Fixed
This commit is contained in:
committed by
Space Team
parent
29ecc4d987
commit
f318b5969d
+10
-2
@@ -259,6 +259,14 @@ private val returnableBlocksPhase = makeIrFilePhase(
|
||||
prerequisite = setOf(arrayConstructorPhase, assertionPhase, directInvokeLowering)
|
||||
)
|
||||
|
||||
private val singletonReferencesPhase = makeIrFilePhase(
|
||||
::SingletonReferencesLowering,
|
||||
name = "SingletonReferences",
|
||||
description = "Handle singleton references",
|
||||
// ReturnableBlock lowering may produce references to the `Unit` object
|
||||
prerequisite = setOf(returnableBlocksPhase)
|
||||
)
|
||||
|
||||
private val syntheticAccessorPhase = makeIrFilePhase(
|
||||
::SyntheticAccessorLowering,
|
||||
name = "SyntheticAccessor",
|
||||
@@ -287,7 +295,7 @@ internal val functionInliningPhase = makeIrModulePhase(
|
||||
innerClassesSupport = context.innerClassesSupport,
|
||||
alwaysCreateTemporaryVariablesForArguments = true,
|
||||
regenerateInlinedAnonymousObjects = true,
|
||||
inlineArgumentsWithTheirOriginalTypeAndOffset = true
|
||||
inlineArgumentsWithOriginalOffset = true
|
||||
)
|
||||
},
|
||||
name = "FunctionInliningPhase",
|
||||
@@ -367,10 +375,10 @@ private val jvmFilePhases = listOf(
|
||||
// makePatchParentsPhase(),
|
||||
|
||||
enumWhenPhase,
|
||||
singletonReferencesPhase,
|
||||
|
||||
assertionPhase,
|
||||
returnableBlocksPhase,
|
||||
singletonReferencesPhase,
|
||||
sharedVariablesPhase,
|
||||
localDeclarationsPhase,
|
||||
// makePatchParentsPhase(),
|
||||
|
||||
+1
-8
@@ -7,7 +7,6 @@ package org.jetbrains.kotlin.backend.jvm.lower
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.FileLoweringPass
|
||||
import org.jetbrains.kotlin.backend.common.IrElementTransformerVoidWithContext
|
||||
import org.jetbrains.kotlin.backend.common.phaser.makeIrFilePhase
|
||||
import org.jetbrains.kotlin.backend.common.pop
|
||||
import org.jetbrains.kotlin.backend.common.push
|
||||
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
|
||||
@@ -23,13 +22,7 @@ import org.jetbrains.kotlin.ir.types.classOrNull
|
||||
import org.jetbrains.kotlin.ir.util.isAnonymousObject
|
||||
import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid
|
||||
|
||||
internal val singletonReferencesPhase = makeIrFilePhase(
|
||||
::SingletonReferencesLowering,
|
||||
name = "SingletonReferences",
|
||||
description = "Handle singleton references"
|
||||
)
|
||||
|
||||
private class SingletonReferencesLowering(val context: JvmBackendContext) : FileLoweringPass, IrElementTransformerVoidWithContext() {
|
||||
internal class SingletonReferencesLowering(val context: JvmBackendContext) : FileLoweringPass, IrElementTransformerVoidWithContext() {
|
||||
private val constructingEnums = arrayListOf<IrDeclarationParent>()
|
||||
|
||||
override fun lower(irFile: IrFile) {
|
||||
|
||||
Reference in New Issue
Block a user