https://kotlinlang.org logo
#compiler
Title
# compiler
n

natario1

01/23/2023, 4:04 PM
What’s the proper way to map generic types to actual types in this scenario? I am declaring
Function0<Unit>
in source code. I can get the type
Unit
from
IrType.arguments
easily, so far all good. Then I’d like to process the
invoke(): Unit
function which is seen as
invoke(): R
. So
function.returnType
returns a type parameter which should be inherited from the parent scope
Function0<Unit>
. I think I have two questions • is there any utility that maps all parameters of a function (
invoke()
in this case) to the concrete types known from the parent
IrType
? So that I know the actual types and can do stuff accordingly. • if not, what’s the proper way to do it ? Function0 is kind of easy, but in case of multiple generics, it’s already not clear to me how one should link them. By comparing names?
d

dmitriy.novozhilov

01/23/2023, 4:06 PM
n

natario1

01/23/2023, 4:23 PM
Got it! Thanks 🙏
7 Views