krzysztof
04/11/2024, 10:50 PMtypealias Fn0<R> = () -> R
and changing it className (via ::class.toClassName
), results in actual usage of kotlin.Function0
damian
04/11/2024, 11:32 PMkotlin.Function0
and friends to LambdaTypeName
in, for example, toTypeName
, but that would probably be unexpected for someone who did literally want Function0
.
I say it would have to happen in toTypeName
rather than toClassName
since when you use ::class
, you are getting the KClass
, which is the kotlin.Function0
class. If you use toClassName
, you are going to get a ClassName
and not a LambdaTypeName
.
You could probably write your own function to do this (by using typeOf
) but it's a lossy transformation anyway, since receiver types are not represented in kotlin.Function*
(they are just regular parameters). So you might as well use LambdaTypeName
jw
04/12/2024, 12:01 AMkrzysztof
04/12/2024, 9:38 AM