I have the following code:
private inline fun <reified T : Number> T.test(): T {
if (T::class.java == Double::class.java) {
return 0.0
}
return this
}
I expected that that would work (as long as I checked the type of T), but the IDE points this out:
The floating-point literal does not conform to the expected type
T
Is there any way to make it work?

You have to cast it to T since the compiler isn't sophisticated enough to figure it out.