Do not report redeclaration when outer class and default object's members clash
Previously we prohibited classes and properties with the same name (now it's unnecessary) Add test for backends that they support qualified (by default object name) member references inside class body
This commit is contained in:
@@ -47,4 +47,8 @@ public final class ClassObjectTest extends SingleFileTranslationTest {
|
||||
public void testNamedClassObject() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testDefaultObjectSameNamesAsInOuter() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package foo
|
||||
|
||||
class A {
|
||||
private val p: Int
|
||||
get() = 4
|
||||
|
||||
default object B {
|
||||
val p: Int
|
||||
get() = 6
|
||||
}
|
||||
|
||||
fun a() = p + B.p
|
||||
}
|
||||
|
||||
|
||||
fun box(): String {
|
||||
if (A().a() != 10) return "Fail"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user