min
09/14/2026, 2:49 PMfun main() {
Foo<Int>::class
}
class Foo<T>(val foo: T)
This results in a compiler error. How can I uniquely represent a generic type and a specific combination of type arguments? It’s okay for the workaround solution to be verbose; I want to make a compiler plugin.CLOVIS
09/14/2026, 2:53 PMtypeOf<Foo<Int>>() , which gives a KType , which has all the information you wantmin
09/14/2026, 2:53 PMCLOVIS
09/14/2026, 2:54 PMtypeOf is inline reified , it doesn't have the problem of erased type parameters. It's what KotlinX.Serialization uses to know what you want to deserialize, for examplemin
09/14/2026, 2:54 PM