Tracey Yoshima
10/24/2023, 10:34 PMconvertToIrAndActualizeForJvm function to convert the FIR to the IR , and for code like val a = 1 + 1, the IR contains changes that match the resultant byte code: I.E. val a = 2.
Is it possible to configure the compiler to preserve 1 + 1 in the IR or is that only preserved in the FIR via metadata source?Tracey Yoshima
10/24/2023, 11:49 PMTracey Yoshima
10/24/2023, 11:58 PMFir2IrActualizedResult the Fir2IrComponentStorage$typeConverter contains a class Fir2IrTypeConverter, which I may use to retrieve the IrType. Is that the recommended approach?dmitriy.novozhilov
10/25/2023, 8:28 AMTracey Yoshima
10/25/2023, 12:11 PMdmitriy.novozhilov
10/25/2023, 2:02 PMFir2IrConverter.createIrModuleFragment and access all fir2ir services from Fir2IrResult.components
They knows everything about fir <--> ir mappingdmitriy.novozhilov
10/25/2023, 2:03 PMTracey Yoshima
10/25/2023, 3:35 PMTracey Yoshima
10/26/2023, 2:13 AMcreateIrModuleFragment and components were very helpful! I could associate most of the FIR elements to the IR to acquire type attribution through the caches and typeRef.toIrType(Fir2IrTypeConverter).
I didn’t find a way to link some of the elements:
• FirValueParameter => IrValueParameter
• FirCall => IrCall (FunctionCall or ConstructorCall)
• FirResolvedQualifier => IrElement
I can access the base type through the symbol, but I’d like to preserve the bounded type attribution. I.E. listOf(“foo”) => kotlin.collections.List<kotlin.String> instead of kotlin.collections.List<T>.
Is there a way to use a callableId or a utility to get the IR from a FirCall, FirValueParameter, or FirResolvedQualifier?dmitriy.novozhilov
10/26/2023, 6:16 AMdmitriy.novozhilov
10/26/2023, 6:18 AM