KT-6201 KT-6203 KT-6326 KT-6777 Add test cases to prove that issues are no longer reproducible
This commit is contained in:
@@ -51,4 +51,12 @@ public final class ClassObjectTest extends SingleFileTranslationTest {
|
||||
public void testDefaultObjectSameNamesAsInOuter() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testEnumCompanionObject() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testObjectInCompanionObject() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,6 +74,10 @@ public class NestedTypesTest extends SingleFileTranslationTest {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
public void testNestedObjectLazyInitialized() throws Exception {
|
||||
checkFooBoxIsOk();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected List<String> additionalJsFiles(@NotNull EcmaVersion ecmaVersion) {
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
// See KT-6326, KT-6777
|
||||
package foo
|
||||
|
||||
enum class Foo {
|
||||
A;
|
||||
|
||||
companion object {
|
||||
val a = A
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
assertEquals("A", Foo.a.name)
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// See KT-6203
|
||||
package foo
|
||||
|
||||
class TestClass {
|
||||
object a {
|
||||
override fun toString() = "a"
|
||||
}
|
||||
|
||||
companion object {
|
||||
object b {
|
||||
override fun toString() = "b"
|
||||
}
|
||||
}
|
||||
|
||||
fun test() = convert(a) + convert(b)
|
||||
}
|
||||
|
||||
fun convert(o: Any) = o.toString()
|
||||
|
||||
fun box(): String {
|
||||
assertEquals("ab", TestClass().test())
|
||||
assertEquals("ab2", convert(TestClass.a) + convert(TestClass.Companion.b) + "2")
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
// See KT-6201
|
||||
package foo
|
||||
|
||||
var log = ""
|
||||
|
||||
class A() {
|
||||
init {
|
||||
log += "A"
|
||||
}
|
||||
|
||||
object B {
|
||||
init {
|
||||
log += "B"
|
||||
}
|
||||
|
||||
fun bar() {
|
||||
log += ".bar"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
A()
|
||||
log += ";"
|
||||
A.B.bar()
|
||||
|
||||
assertEquals("A;B.bar", log)
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user