https://kotlinlang.org logo
Title
s

serebit

06/24/2019, 1:40 AM
Are there plans to introduce a compiler intrinsic to get a list of supertypes of a reified type T, similar to the new
typeOf
?
k

kralli

06/24/2019, 6:10 AM
That would only work within a compilation unit, because only then all occurrences of a method call would be known to the compiler. But as soon as someone calls that method from a different module, the derived supertype might not longer apply. If you want to narrow the supertype in a reified method, you can do so by simply narrowing the generic type:
<reified T: Number>
☝️ 1