Iaroslav Postovalov
11/16/2020, 3:35 PMpublic operator fun T.minus(b: T): T = add(this, -b)
diesieben07
11/16/2020, 3:44 PMT
should be beforehand:
public operator fun <T> T.minus(b: T): T = add(this, -b)
val ref = String?::minus
val ref2 = Any?::minus
val ref3 = SomeClass::minus
These all work and all point to the same function, with T
being String?
, Any?
and SomeClass
respectively.Rob Elliot
11/16/2020, 4:22 PMT
in the original was a concrete type, not a generic one - otherwise unaryMinus
wouldn’t resolve.