mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-11 08:31:30 +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.
15 lines
374 B
Kotlin
15 lines
374 B
Kotlin
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
|
|
|
fun foo() {
|
|
<!LOCAL_OBJECT_NOT_ALLOWED!>object a<!> {}
|
|
val b = object {
|
|
<!LOCAL_OBJECT_NOT_ALLOWED!>object c<!> {}
|
|
}
|
|
b.<!NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>c<!>
|
|
class A {
|
|
<!LOCAL_OBJECT_NOT_ALLOWED!>object d<!> {}
|
|
}
|
|
val f = {
|
|
<!LOCAL_OBJECT_NOT_ALLOWED!>object e<!> {}
|
|
}
|
|
} |