Files
kotlin-fork/idea/testData/resolve/additionalLazyResolve/anonymousObjectInClassParameterInitializer.kt
T
Svetlana Isakova 9d366cb896 Prohibit local objects and enum classes
#KT-5402 Fixed
  #KT-4838 Fixed

Resolve type of object inside local object as special, not supertype('Any').
Changed visibility of constructor of anonymous object to 'internal' to be able to resolve the following:
fun box(): String {
    var foo = object {
        val bar = object {
            val baz = "ok"
        }
    }
    return foo.bar.baz
}
The containing declaration of property initializers is constructor, so 'baz' was invisible inside private constructor.
2014-09-01 12:32:52 +04:00

18 lines
545 B
Kotlin

package test
open class A
class MyClass(
a: A = object: A() {
}
)
//package test
//internal open class A defined in test
//public constructor A() defined in test.A
//internal final class MyClass defined in test
//public constructor MyClass(a: test.A = ...) defined in test.MyClass
//value-parameter val a: test.A = ... defined in test.MyClass.<init>
//internal final class <no name provided> : test.A defined in test.MyClass.<init>
//internal constructor <no name provided>() defined in test.MyClass.<init>.<no name provided>