Why is `returnTypeProvider: (List<FirTypeParame...
# compiler
m
Why is
returnTypeProvider: (List<FirTypeParameter>) -> ConeKotlinType
, when
ValueParameterData#typeProvider: (List<FirTypeParameterRef>) -> ConeKotlinType
? Why does
returnTypeProvider
get to see
FirTypeParameter
impls, when
typeProvider
is only shown
FirTypeParameterRef
views?
d
FirTypeParameterRef
are created for inner classes, which capture type parameter from the outer class:
Copy code
class Outer<A> {
    inner class Inner<B>
}
// Inner.typeParameters = [FirTypeParameterRef(A), FirTypeParameter(B)]
So when you declare a constructor of such an inner class, you could observe both
FirTypeParameter
and
FirTypeParameterRef
(as constructors refer to type parameters of the class). Also the DSL and logic for value parameters creation is shared between simple functions and constructors, so here we have
FirTypeParameterRef
for both of them. In reality functions will receive `FirTypeParameter`s there all the time.
As for
returnTypeProvider
, this thing exists only for simple functions (as constructor return type is always know and created automatically). So it was declared with more specific
FirTypeParameter
in signature.