Anyone seeing a problem with this extension functi...
# announcements
s
Anyone seeing a problem with this extension function?
Copy code
package toto.toto2

@ExperimentalUnsignedTypes
fun UByteArray.toUnsignedInt(): UInt {
    return ...
}
When I try to call it from inside an
object
, like this:
myUInt = myUByteArray.toUnsignedInt()
, I have an Unresolved reference. Thanks in advance!
a
Failed to reproduce with
Copy code
package toto.toto2
@ExperimentalUnsignedTypes
fun UByteArray.toUnsignedInt(): UInt {
    TODO()
}

object O {
    val myUByteArray: UByteArray = ubyteArrayOf(0u)
    val myUInt = myUByteArray.toUnsignedInt()
}
Can you please share a self-contained example to reproduce?
s
I found my problem! For the 1st time, I was adding a file instead of class or object, because I wanted my extension method to be at module/package level instead of class/object level. But the file extension .kt wasn't added to my file name by default. When I renamed my file (from toto to toto.kt), it worked fine.
🆒 1