What’s the proper way to map generic types to actu...
# compiler
n
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
n
Got it! Thanks 🙏