Kelvin Chung
07/21/2025, 4:48 PMobject MyObject {
val size by Int::SIZE_BITS
}
I'm getting a compile error on MyObject.size
saying that the property delegate does not have a getValue(MyObject, KProperty<*>)
method for some reason. Specifically, complicating matters somewhat is if I have this:
import <http://kotlin.Int|kotlin.Int> as KInt
object MyObject {
val size by KInt::SIZE_BITS
}
which should be equivalent, but the compiler error is saying that
public inline operator fun <T, V> KProperty1<Int, Int> getValue(thisRef: Int, property: KProperty<*>)
is unsuitable.
Any insight on what could be happening?Kelvin Chung
07/21/2025, 5:03 PMInt.Companion::SIZE_BITS
, it looks like. My IDE didn't flag that for some reason.ephemient
07/21/2025, 5:14 PMval size
get() = Int.SIZE_BITS
although the value doesn't change so why not
const val size = Int.SIZE_BITS
?Kelvin Chung
07/21/2025, 5:15 PMInt.SIZE_BITS
as an example for demonstration purposes.