I have this code within a companion object:
val x = Foo(::x.name)
There is a compilation error which can be easily fixed: (Type checking has run into a recursive problem.)
val x: Foo = Foo(::x.name)
My question is why does the compiler check for the type of x
to get the name? Is it because it resolves ::x
first before getting the name?
This solved issue about property name access says that it should be simply replaced with a string: https://youtrack.jetbrains.com/issue/KT-11531