Marc Knaup
08/26/2020, 10:56 AMpublic inline fun <C, R> C.ifEmpty(defaultValue: () -> R): R where C : CharSequence, C : R =
if (isEmpty()) defaultValue() else this
But when copy&pasting that code it doesn’t even compile!
Type parameter cannot have any other bounds if it’s bounded by another type parameterIs it safe to silence that error? 😮
Marc Knaup
08/26/2020, 11:04 AMudalov
ifEmpty
specifically, it seems OK to suppress it because the function is inline
+ @InlineOnly
, so inaccessible from Java. In your case it might also be fine if you don’t have Java clients. If you do, you can prevent them from calling it by making it InlineOnly as well, however that leads to more error deprecations…Marc Knaup
08/26/2020, 1:45 PM@Suppress
even more (internal access)?udalov
InlineOnly
is still internal to kotlin-stdlib