FIR2IR: calculate IR parent for Java field ahead
so as to cache type parameters from the parent if the field's return type is one of type parameters. #KT-44032 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
89577543a2
commit
73576c80e4
+6
-2
@@ -1168,8 +1168,12 @@ class Fir2IrDeclarationStorage(
|
||||
|
||||
fun getIrFieldSymbol(firFieldSymbol: FirFieldSymbol): IrSymbol {
|
||||
val fir = firFieldSymbol.fir
|
||||
val irProperty = fieldCache[fir] ?: createIrField(fir).apply {
|
||||
setAndModifyParent(findIrParent(fir))
|
||||
val irProperty = fieldCache[fir] ?: run {
|
||||
// In case of type parameters from the parent as the field's return type, find the parent ahead to cache type parameters.
|
||||
val irParent = findIrParent(fir)
|
||||
createIrField(fir).apply {
|
||||
setAndModifyParent(irParent)
|
||||
}
|
||||
}
|
||||
return irProperty.symbol
|
||||
}
|
||||
|
||||
+5
@@ -1873,6 +1873,11 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest {
|
||||
runTest("compiler/testData/ir/irText/firProblems/throwableStackTrace.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeParameterFromJavaClass.kt")
|
||||
public void testTypeParameterFromJavaClass() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/firProblems/typeParameterFromJavaClass.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeVariableAfterBuildMap.kt")
|
||||
public void testTypeVariableAfterBuildMap() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/firProblems/typeVariableAfterBuildMap.kt");
|
||||
|
||||
Reference in New Issue
Block a user