https://kotlinlang.org logo
Title
o

olegstepanov

03/10/2019, 1:53 PM
Hi Can anyone explain why this won't compile:
val String.prop
    get() = object : Supplier<Int> {
        override fun get(): Int = this@prop.toInt()
    }
even though completion actually suggests this@prop?
s

Shawn

03/10/2019, 1:57 PM
This may be a plugin error, if you can replicate it then it may be worth filing a :youtrack:
in any case, do you strictly need the
object
?
just
Supplier { toInt() }
might work for you
o

olegstepanov

03/10/2019, 2:02 PM
@Shawn I actually have a more complex interface in the real code, just wanted to figure out if that's a bug or not
s

Shawn

03/10/2019, 2:03 PM
👍 gotcha, just checking
o

olegstepanov

03/10/2019, 2:08 PM
@Shawn thanks for the reply, looks like a bug indeed
👍 1