Skip to content

Commit 6aff1f6

Browse files
mcpiromanSpace Team
authored andcommitted
[JVM] Use attributeOwnerId indirection for localClassType
IrAttributes no longer use this indirection, but in this case it is still temporarily needed. KT-74331
1 parent 81dd7cf commit 6aff1f6

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/JvmMultiFieldValueClassLowering.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,6 @@ internal class JvmMultiFieldValueClassLowering(context: JvmBackendContext) : Jvm
863863
putValueArgument(index, arg?.transform(this@JvmMultiFieldValueClassLowering, null))
864864
}
865865
copyAttributes(expression)
866-
localClassType = expression.localClassType
867866
}
868867
return context.createJvmIrBuilder(getCurrentScopeSymbol(), expression).irBlock(origin = IrStatementOrigin.LAMBDA) {
869868
+wrapper

compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/JvmIrAttributes.kt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,17 @@ import org.jetbrains.kotlin.ir.symbols.IrSymbol
1515
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
1616
import org.jetbrains.org.objectweb.asm.Type
1717

18-
var IrElement.localClassType: Type? by irAttribute(copyByDefault = true)
18+
private var IrElement._localClassType: Type? by irAttribute(copyByDefault = true)
19+
// This sort of a hack for IR inliner case, where IrFunctionExpression stores and "shares" localClassType
20+
// between IrFunctionReferences that are lowered from this IrFunctionExpression, but linked to it via attributeOwnerId.
21+
// It can be changed to simply store the attribute on the function reference itself when either:
22+
// - IR inliner (-Xserialize-ir) is dropped, or
23+
// - IrFunctionExpression is dropped (KT-74383).
24+
var IrElement.localClassType: Type?
25+
get() = attributeOwnerId._localClassType
26+
set(value) {
27+
attributeOwnerId._localClassType = value
28+
}
1929

2030
var IrFunction.enclosingMethodOverride: IrFunction? by irAttribute(copyByDefault = false)
2131

0 commit comments

Comments
 (0)