mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 15:53:37 +00:00
#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.
23 lines
341 B
Kotlin
23 lines
341 B
Kotlin
package localObjects
|
|
|
|
object A {
|
|
val x : Int = 0
|
|
}
|
|
|
|
open class Foo {
|
|
fun foo() : Int = 1
|
|
}
|
|
|
|
fun test() {
|
|
A.x
|
|
val b = object : Foo() {
|
|
}
|
|
b.foo()
|
|
|
|
<!LOCAL_OBJECT_NOT_ALLOWED!>object B<!> {
|
|
fun foo() {}
|
|
}
|
|
B.foo()
|
|
}
|
|
|
|
val bb = <!UNRESOLVED_REFERENCE!>B<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>foo<!>() |