New assertion overload: inline reified `isInstanceOf` / `isNotInstanceOf`
JakeWharton opened this issue · comments
I'm really not one for code golf or anything, but I was surprised at its omission. My justification is that isInstanceOf(KClass<T>)
provides the base functionality, and by the nature of reified
requiring inline
an inline fun <reified T : Any> Assert<Any>.isInstanceOf(): Assert<T>
helper provides language feature support on top.
It also potentially allows inference to be used so as to not require explicitly specifying the type at the function call at all?
(Also happy to contribute this and the others. Doing a big conversion and want to write everything down as I see it lest I forgot something that stands out)
The reason for it's omission was the ide experience really wasn't great in that it would really push you to omit passing anything into the generics which made it's common usage confusing. I do not feel that strongly about it though.
Seems okay? Any more details on what wasn't a good experience?
isinstanceof.mov
It's been a long while since I looked, it's possible they improved/fixed it. I remember it not giving you the braces before.
I'll move forward with the implementation and see if anything else comes about.