@udalov commented on
@jdiaz’s file
https://kotlinlang.slack.com/files/U22BBEZQU/F65V0PSAW/-.kt: (TL;DR: reference to nullable class doesn't make sense, but we can't report a similar error for type parameters.)
Semantics of the class literal expression is a bit different in cases when there's a class and when there's a type parameter on the left-hand side. If there's a class, we don't allow to specify nullability and type arguments to make it clear that they wouldn't have any effect on the result. If there's a type parameter however, we effectively strip the type (passed as the generic argument to the method) of its nullability and its own arguments and use that class semantically, because we have no other options: we can't just prohibit calling
boo
with non-trivial types because that information should've been specified in the function signature but there's no syntactic way to do that. So you can call for example
boo<List<Map<A?, B>?>?>()
, but only the class of that type argument (
List
) will be used to construct the class literal.