Skip to content

Commit

Permalink
Apply the IrSymbol.defaultType extension
Browse files Browse the repository at this point in the history
  • Loading branch information
jisungbin committed Nov 22, 2023
1 parent d46625b commit f6fca26
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import org.jetbrains.kotlin.ir.expressions.IrConstructorCall
import org.jetbrains.kotlin.ir.expressions.impl.IrConstructorCallImpl
import org.jetbrains.kotlin.ir.expressions.impl.IrVarargImpl
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
import org.jetbrains.kotlin.ir.types.defaultType
import org.jetbrains.kotlin.ir.types.impl.makeTypeProjection
import org.jetbrains.kotlin.ir.types.typeWithArguments
import org.jetbrains.kotlin.ir.util.constructors
import org.jetbrains.kotlin.ir.util.defaultType
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.types.Variance

Expand All @@ -52,7 +52,7 @@ private fun IrPluginContext.irDeclarationStabilityCertain(stable: IrConst<Boolea
.also { symbol -> declarationStabilityCertainSymbol = symbol })

return IrConstructorCallImpl.fromSymbolOwner(
type = symbol.owner.defaultType,
type = symbol.defaultType,
constructorSymbol = symbol.constructors.single(),
).apply {
putValueArgument(0, stable)
Expand All @@ -65,7 +65,7 @@ private fun IrPluginContext.irDeclarationStabilityRuntime(declarationName: IrCon
.also { symbol -> declarationStabilityRuntimeSymbol = symbol })

return IrConstructorCallImpl.fromSymbolOwner(
type = symbol.owner.defaultType,
type = symbol.defaultType,
constructorSymbol = symbol.constructors.single(),
).apply {
putValueArgument(0, declarationName)
Expand All @@ -78,7 +78,7 @@ private fun IrPluginContext.irDeclarationStabilityUnknown(declarationName: IrCon
.also { symbol -> declarationStabilityUnknownSymbol = symbol })

return IrConstructorCallImpl.fromSymbolOwner(
type = symbol.owner.defaultType,
type = symbol.defaultType,
constructorSymbol = symbol.constructors.single(),
).apply {
putValueArgument(0, declarationName)
Expand All @@ -91,7 +91,7 @@ private fun IrPluginContext.irDeclarationStabilityParameter(parameterName: IrCon
.also { symbol -> declarationStabilityParameterSymbol = symbol })

return IrConstructorCallImpl.fromSymbolOwner(
type = symbol.owner.defaultType,
type = symbol.defaultType,
constructorSymbol = symbol.constructors.single(),
).apply {
putValueArgument(0, parameterName)
Expand All @@ -107,10 +107,10 @@ private fun IrPluginContext.irDeclarationStabilityCombined(elements: List<IrCons
.also { parentSymbol -> declarationStabilitySymbol = parentSymbol })

return IrConstructorCallImpl.fromSymbolOwner(
type = symbol.owner.defaultType,
type = symbol.defaultType,
constructorSymbol = symbol.constructors.single(),
).apply {
val varargElementType = parentSymbol.owner.defaultType
val varargElementType = parentSymbol.defaultType
val genericTypeProjection = makeTypeProjection(type = varargElementType, variance = Variance.OUT_VARIANCE)
val genericType = irBuiltIns.arrayClass.typeWithArguments(listOf(genericTypeProjection))
val vararg = IrVarargImpl(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import org.jetbrains.kotlin.ir.expressions.impl.IrVarargImpl
import org.jetbrains.kotlin.ir.types.defaultType
import org.jetbrains.kotlin.ir.types.impl.makeTypeProjection
import org.jetbrains.kotlin.ir.types.typeWithArguments
import org.jetbrains.kotlin.ir.util.defaultType
import org.jetbrains.kotlin.ir.util.dump
import org.jetbrains.kotlin.ir.util.dumpKotlinLike
import org.jetbrains.kotlin.types.Variance
Expand All @@ -46,7 +45,7 @@ internal class InvalidationTrackableTransformer(
val currentFunctionLocation = function.getSafelyLocation()
val currentInvalidationTrackTable = currentInvalidationTrackTable!!

val paramInfoType = currentInvalidationTrackTable.paramInfoSymbol.owner.defaultType
val paramInfoType = currentInvalidationTrackTable.paramInfoSymbol.defaultType
val paramInfoGenericTypeProjection = makeTypeProjection(type = paramInfoType, variance = Variance.OUT_VARIANCE)
val paramInfoGenericType = irBuiltIns.arrayClass.typeWithArguments(listOf(paramInfoGenericTypeProjection))
val paramInfos = IrVarargImpl(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ import org.jetbrains.kotlin.ir.expressions.impl.IrExpressionBodyImpl
import org.jetbrains.kotlin.ir.expressions.impl.IrGetValueImpl
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol
import org.jetbrains.kotlin.ir.types.defaultType
import org.jetbrains.kotlin.ir.util.SYNTHETIC_OFFSET
import org.jetbrains.kotlin.ir.util.constructors
import org.jetbrains.kotlin.ir.util.defaultType
import org.jetbrains.kotlin.load.kotlin.PackagePartClassUtils
import org.jetbrains.kotlin.name.CallableId
import org.jetbrains.kotlin.name.ClassId
Expand All @@ -56,7 +56,7 @@ public class IrInvalidationTrackTable private constructor(public val prop: IrPro
valueHashCode: IrVariable,
): IrConstructorCall =
IrConstructorCallImpl.fromSymbolOwner(
type = paramInfoSymbol.owner.defaultType,
type = paramInfoSymbol.defaultType,
constructorSymbol = paramInfoSymbol.constructors.single(),
).apply {
fun IrVariable.valueGetter(): IrGetValue =
Expand Down Expand Up @@ -137,7 +137,7 @@ private fun irInvalidationTrackTableProp(
name = propName
isStatic = true
isFinal = true
type = superSymbol.owner.defaultType
type = superSymbol.defaultType
visibility = DescriptorVisibilities.PRIVATE
}.also { field ->
field.parent = currentFile
Expand All @@ -146,13 +146,13 @@ private fun irInvalidationTrackTableProp(
startOffset = SYNTHETIC_OFFSET,
endOffset = SYNTHETIC_OFFSET,
expression = IrConstructorCallImpl.fromSymbolOwner(
type = superSymbol.owner.defaultType,
type = superSymbol.defaultType,
constructorSymbol = superSymbol.constructors.single(),
),
)
}
prop.addGetter {
returnType = superSymbol.owner.defaultType
returnType = superSymbol.defaultType
visibility = DescriptorVisibilities.PRIVATE
origin = IrDeclarationOrigin.DEFAULT_PROPERTY_ACCESSOR
}.also { getter ->
Expand Down

0 comments on commit f6fca26

Please sign in to comment.