Question: I have something like this: ```object My...
# getting-started
k
Question: I have something like this:
Copy code
object 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:
Copy code
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
Copy code
public inline operator fun <T, V> KProperty1<Int, Int> getValue(thisRef: Int, property: KProperty<*>)
is unsuitable. Any insight on what could be happening?
Ah. It's a case of needing to specify
Int.Companion::SIZE_BITS
, it looks like. My IDE didn't flag that for some reason.
e
that's equivalent to
Copy code
val size
    get() = Int.SIZE_BITS
although the value doesn't change so why not
Copy code
const val size = Int.SIZE_BITS
?
k
Just using
Int.SIZE_BITS
as an example for demonstration purposes.