default -> companion: replace all mentions of default and default object
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
class A {
|
||||
default object {
|
||||
companion object {
|
||||
var xi = 0
|
||||
var xin : Int? = 0
|
||||
var xinn : Int? = null
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class C() {
|
||||
default object {
|
||||
companion object {
|
||||
fun create() = C()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
fun Any.foo() = 1
|
||||
|
||||
class A {
|
||||
default object
|
||||
companion object
|
||||
}
|
||||
|
||||
fun box() = if (A.foo() == 1) "OK" else "fail"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
var global = 0;
|
||||
|
||||
class C {
|
||||
default object {
|
||||
companion object {
|
||||
{
|
||||
global = 1;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class A() {
|
||||
default object {
|
||||
companion object {
|
||||
val value = 10
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// EA-38323 - Illegal field modifiers in class: classObject field in C must be static and final
|
||||
|
||||
trait C {
|
||||
default object {
|
||||
companion object {
|
||||
public val FOO: String = "OK"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class A {
|
||||
default object {
|
||||
companion object {
|
||||
fun values() = "O"
|
||||
fun valueOf() = "K"
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class SomeClass { default object }
|
||||
class SomeClass { companion object }
|
||||
|
||||
fun box() =
|
||||
if ((SomeClass.toString() as java.lang.String).matches("SomeClass\\\$Default@[0-9a-fA-F]+"))
|
||||
if ((SomeClass.toString() as java.lang.String).matches("SomeClass\\\$Companion@[0-9a-fA-F]+"))
|
||||
"OK"
|
||||
else
|
||||
"Fail: $SomeClass"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class C() {
|
||||
default object {
|
||||
companion object {
|
||||
private fun <T> create() = C()
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
open class Test {
|
||||
default object {
|
||||
companion object {
|
||||
fun testStatic(ic: InnerClass): NotInnerClass = NotInnerClass(ic.value)
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ class A {
|
||||
private val p: Int
|
||||
get() = 4
|
||||
|
||||
default object B {
|
||||
companion object B {
|
||||
val p: Int
|
||||
get() = 6
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class C() {
|
||||
default object Foo
|
||||
companion object Foo
|
||||
}
|
||||
|
||||
fun C.Foo.create() = 3
|
||||
|
||||
@@ -4,7 +4,7 @@ public class StockMarketTableModel() {
|
||||
return COLUMN_TITLES?.size()!!
|
||||
}
|
||||
|
||||
default object {
|
||||
companion object {
|
||||
private val COLUMN_TITLES : Array<Int?> = arrayOfNulls<Int>(10)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class A {
|
||||
default object {
|
||||
companion object {
|
||||
val b = 0
|
||||
val c = b
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package x
|
||||
|
||||
class Outer() {
|
||||
default object {
|
||||
companion object {
|
||||
class Inner() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun box (): String {
|
||||
val inner = Outer.Default.Inner()
|
||||
val inner = Outer.Companion.Inner()
|
||||
return "OK"
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
open class Factory(p: Int)
|
||||
|
||||
class A {
|
||||
default object : Factory(1)
|
||||
companion object : Factory(1)
|
||||
}
|
||||
|
||||
fun box() : String {
|
||||
|
||||
@@ -2,7 +2,7 @@ package mult_constructors_3_bug
|
||||
|
||||
public open class Identifier() {
|
||||
private var myNullable : Boolean = true
|
||||
default object {
|
||||
companion object {
|
||||
open public fun init(isNullable : Boolean) : Identifier {
|
||||
val __ = Identifier()
|
||||
__.myNullable = isNullable
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class C() {
|
||||
default object Foo {
|
||||
companion object Foo {
|
||||
fun create() = 3
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Foo private(val param: String = "OK") {
|
||||
default object {
|
||||
companion object {
|
||||
val s = Foo()
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
class A {
|
||||
default object {
|
||||
companion object {
|
||||
fun Int.foo(a: Int = 1): Int {
|
||||
return a
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
fun foo(a: String = "Default", b: Int = 1, c: Long = 2): String {
|
||||
fun foo(a: String = "Companion", b: Int = 1, c: Long = 2): String {
|
||||
return "$a $b $c"
|
||||
}
|
||||
|
||||
|
||||
@@ -5,14 +5,14 @@ class Delegate<T>(var inner: T) {
|
||||
|
||||
|
||||
class Foo (val f: Int) {
|
||||
default object {
|
||||
companion object {
|
||||
val A: Foo by Delegate(Foo(11))
|
||||
var B: Foo by Delegate(Foo(11))
|
||||
}
|
||||
}
|
||||
|
||||
trait FooTrait {
|
||||
default object {
|
||||
companion object {
|
||||
val A: Foo by Delegate(Foo(11))
|
||||
var B: Foo by Delegate(Foo(11))
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import java.util.IdentityHashMap
|
||||
class A {
|
||||
var foo: Int by IntHandler
|
||||
|
||||
default object {
|
||||
companion object {
|
||||
var bar: Any? by AnyHandler
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
class A {
|
||||
default object {
|
||||
companion object {
|
||||
fun invoke(i: Int) = i
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -8,8 +8,8 @@ internal final class A {
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
internal default object Default {
|
||||
private constructor Default()
|
||||
internal companion object Companion {
|
||||
private constructor Companion()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
internal final fun invoke(/*0*/ i: kotlin.Int): kotlin.Int
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ trait B
|
||||
fun B.invoke(i: Int) = i
|
||||
|
||||
class A {
|
||||
default object: B {
|
||||
companion object: B {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -9,8 +9,8 @@ internal final class A {
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
internal default object Default : B {
|
||||
private constructor Default()
|
||||
internal companion object Companion : B {
|
||||
private constructor Companion()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
class A {
|
||||
class Nested {
|
||||
default object {
|
||||
companion object {
|
||||
fun invoke(i: Int) = i
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -14,8 +14,8 @@ internal final class A {
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
internal default object Default {
|
||||
private constructor Default()
|
||||
internal companion object Companion {
|
||||
private constructor Companion()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
internal final fun invoke(/*0*/ i: kotlin.Int): kotlin.Int
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ import A.Nested
|
||||
|
||||
class A {
|
||||
class Nested {
|
||||
default object {
|
||||
companion object {
|
||||
fun invoke(i: Int) = i
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -14,8 +14,8 @@ internal final class A {
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
internal default object Default {
|
||||
private constructor Default()
|
||||
internal companion object Companion {
|
||||
private constructor Companion()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
internal final fun invoke(/*0*/ i: kotlin.Int): kotlin.Int
|
||||
|
||||
@@ -3,7 +3,7 @@ enum class Game {
|
||||
PAPER
|
||||
SCISSORS
|
||||
|
||||
default object {
|
||||
companion object {
|
||||
fun foo() = ROCK
|
||||
val bar = PAPER
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
fun box() = if(Context.operatingSystemType == Context.Default.OsType.OTHER) "OK" else "fail"
|
||||
fun box() = if(Context.operatingSystemType == Context.Companion.OsType.OTHER) "OK" else "fail"
|
||||
|
||||
public class Context
|
||||
{
|
||||
default object
|
||||
companion object
|
||||
{
|
||||
public enum class OsType {
|
||||
LINUX;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class A {
|
||||
default object {}
|
||||
companion object {}
|
||||
enum class E {
|
||||
OK
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class A {
|
||||
default object
|
||||
companion object
|
||||
}
|
||||
|
||||
val foo: Any.() -> Unit = {}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class Test(val prop: String) {
|
||||
|
||||
default object {
|
||||
companion object {
|
||||
public val prop : String = "CO";
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package someTest
|
||||
|
||||
public class Some private(val v: String) {
|
||||
default object {
|
||||
companion object {
|
||||
public fun init(v: String): Some {
|
||||
return Some(v)
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class Outer {
|
||||
class Nested {
|
||||
default object {
|
||||
companion object {
|
||||
val O = "O"
|
||||
val K = "K"
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package foo
|
||||
|
||||
fun box(): String {
|
||||
try {
|
||||
testDefaultObjectAccess()
|
||||
testCompanionObjectAccess()
|
||||
testInCall()
|
||||
testDoubleConstants()
|
||||
testFloatConstants()
|
||||
@@ -18,7 +18,7 @@ fun box(): String {
|
||||
return "OK"
|
||||
}
|
||||
|
||||
fun testDefaultObjectAccess() {
|
||||
fun testCompanionObjectAccess() {
|
||||
val i = Int
|
||||
val d = Double
|
||||
val f = Float
|
||||
@@ -73,7 +73,7 @@ fun testCallInterface() {
|
||||
}
|
||||
|
||||
fun testLocalFun() {
|
||||
fun Int.Default.LocalFun() : String = "LocalFun"
|
||||
fun Int.Companion.LocalFun() : String = "LocalFun"
|
||||
myAssertEquals("LocalFun", Int.LocalFun())
|
||||
}
|
||||
|
||||
@@ -94,11 +94,11 @@ fun testVarTopField() {
|
||||
fun test(a: Any) {}
|
||||
|
||||
var _field: Int = 0
|
||||
var Int.Default.TopField : Int
|
||||
var Int.Companion.TopField : Int
|
||||
get() = _field
|
||||
set(value) { _field = value };
|
||||
|
||||
fun Int.Default.TopFun() : String = "TopFun"
|
||||
fun Int.Companion.TopFun() : String = "TopFun"
|
||||
|
||||
fun myAssertEquals<T>(a: T, b: T) {
|
||||
if (a != b) throw Exception("$a != $b")
|
||||
|
||||
@@ -3,7 +3,7 @@ public abstract class FList<T>() {
|
||||
public abstract val tail: FList<T>
|
||||
public abstract val empty: Boolean
|
||||
|
||||
default object {
|
||||
companion object {
|
||||
val emptyFList = object: FList<Any>() {
|
||||
public override val head: Any
|
||||
get() = throw UnsupportedOperationException();
|
||||
|
||||
@@ -2,7 +2,7 @@ public open class Test() {
|
||||
open public fun test() : Unit {
|
||||
System.out?.println(hello)
|
||||
}
|
||||
default object {
|
||||
companion object {
|
||||
private val hello : String? = "Hello"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Clazz {
|
||||
default object {
|
||||
companion object {
|
||||
val a = object {
|
||||
fun run(x: String) = x
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ class Identifier<T>(t : T?, myHasDollar : Boolean) {
|
||||
|
||||
public fun getName() : T? { return myT }
|
||||
|
||||
default object {
|
||||
companion object {
|
||||
open public fun init<T>(name : T?) : Identifier<T> {
|
||||
val __ = Identifier<T>(name, false)
|
||||
return __
|
||||
|
||||
@@ -4,7 +4,7 @@ import java.io.*
|
||||
|
||||
open class AllEvenNum() {
|
||||
|
||||
default object {
|
||||
companion object {
|
||||
open public fun main(args : Array<String?>?) : Unit {
|
||||
var i : Int = 1
|
||||
while ((i <= 100)) {
|
||||
|
||||
@@ -14,7 +14,7 @@ public open class Identifier<T>(myName : T?, myHasDollar : Boolean) {
|
||||
return myName
|
||||
}
|
||||
|
||||
default object {
|
||||
companion object {
|
||||
open public fun init<T>(name : T?) : Identifier<T> {
|
||||
val __ = Identifier<T>(name, false)
|
||||
return __
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class Test {
|
||||
|
||||
default object {
|
||||
companion object {
|
||||
|
||||
public val prop1 : Int = 10
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
abstract class ClassValAbstract {
|
||||
abstract var a: Int
|
||||
|
||||
default object {
|
||||
companion object {
|
||||
val methods = (this as java.lang.Object).getClass()?.getClassLoader()?.loadClass("ClassValAbstract")?.getMethods()!!
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ class Identifier() {
|
||||
return myNullable
|
||||
}
|
||||
|
||||
default object {
|
||||
companion object {
|
||||
fun init(isNullable : Boolean) : Identifier {
|
||||
val id = Identifier()
|
||||
id.myNullable = isNullable
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class TestObject()
|
||||
{
|
||||
default object {
|
||||
companion object {
|
||||
var prop: Int = 1
|
||||
get() = $prop++
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ class CallbackBlock {}
|
||||
|
||||
public class Foo
|
||||
{
|
||||
default object {
|
||||
companion object {
|
||||
private var bar = 0
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Foo() {
|
||||
default object {
|
||||
companion object {
|
||||
val bar = "OK";
|
||||
var boo = "FAIL";
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Foo {
|
||||
default object {
|
||||
companion object {
|
||||
val bar: String
|
||||
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
class A {
|
||||
default object {
|
||||
companion object {
|
||||
private var r: Int = 1;
|
||||
|
||||
fun test(): Int {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
open class Bar<T>(val prop: String)
|
||||
class Foo {
|
||||
default object : Bar<Foo>("OK") {
|
||||
companion object : Bar<Foo>("OK") {
|
||||
val p = Foo.prop
|
||||
val p2 = prop
|
||||
val p3 = this.prop
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
class A {
|
||||
default object: funClassObject() {
|
||||
companion object: funClassObject() {
|
||||
fun test(): String {
|
||||
return funClassObject.protectedFun()!!
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ class InlineAll {
|
||||
return s()
|
||||
}
|
||||
|
||||
default object {
|
||||
companion object {
|
||||
inline fun inline(s: () -> String): String {
|
||||
return s()
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ trait InlineTrait {
|
||||
return s()
|
||||
}
|
||||
|
||||
default object {
|
||||
companion object {
|
||||
inline final fun finalInline(s: () -> String): String {
|
||||
return s()
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
public class J {
|
||||
public static int f() {
|
||||
return A.Default.getI1() + A.OBJECT$.getI2() + B.Named.getI1() + B.OBJECT$.getI2();
|
||||
return A.Companion.getI1() + A.OBJECT$.getI2() + B.Named.getI1() + B.OBJECT$.getI2();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
class A {
|
||||
default object {
|
||||
companion object {
|
||||
val i1 = 1
|
||||
val i2 = 2
|
||||
}
|
||||
}
|
||||
|
||||
class B {
|
||||
default object Named {
|
||||
companion object Named {
|
||||
val i1 = 3
|
||||
val i2 = 4
|
||||
}
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ annotation class testAnnotation
|
||||
|
||||
class A {
|
||||
|
||||
default object {
|
||||
companion object {
|
||||
val b: String = "OK"
|
||||
|
||||
platformStatic testAnnotation fun test1() = b
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ import kotlin.platform.platformStatic
|
||||
|
||||
class A {
|
||||
|
||||
default object {
|
||||
companion object {
|
||||
val b: String = "OK"
|
||||
|
||||
platformStatic val c: String = "OK"
|
||||
|
||||
+3
-3
@@ -1,17 +1,17 @@
|
||||
class Klass {
|
||||
default object {
|
||||
companion object {
|
||||
val NAME = "Klass"
|
||||
}
|
||||
}
|
||||
|
||||
trait Trait {
|
||||
default object {
|
||||
companion object {
|
||||
val NAME = "Trait"
|
||||
}
|
||||
}
|
||||
|
||||
enum class Enoom {
|
||||
default object {
|
||||
companion object {
|
||||
val NAME = "Enoom"
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ annotation class Ann(
|
||||
)
|
||||
|
||||
class Foo {
|
||||
default object {
|
||||
companion object {
|
||||
val i: Int = 2
|
||||
val s: Short = 2
|
||||
val f: Float = 2.0.toFloat()
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ annotation class Ann(val i: Int)
|
||||
|
||||
class A {
|
||||
class B {
|
||||
default object {
|
||||
companion object {
|
||||
val i = 1
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
class A {
|
||||
default object B {
|
||||
companion object B {
|
||||
var state: String = "12345"
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import kotlin.reflect.KMemberProperty
|
||||
|
||||
class A {
|
||||
default object {
|
||||
companion object {
|
||||
val ref: KMemberProperty<A, String> = A::foo
|
||||
}
|
||||
|
||||
|
||||
@@ -4,12 +4,12 @@ fun box(): String {
|
||||
assertEquals(java.lang.Integer.MIN_VALUE, Int.MIN_VALUE)
|
||||
assertEquals(java.lang.Byte.MAX_VALUE, Byte.MAX_VALUE)
|
||||
|
||||
assertEquals("MIN_VALUE", (Int.Default::MIN_VALUE).name)
|
||||
assertEquals("MAX_VALUE", (Double.Default::MAX_VALUE).name)
|
||||
assertEquals("MIN_VALUE", (Float.Default::MIN_VALUE).name)
|
||||
assertEquals("MAX_VALUE", (Long.Default::MAX_VALUE).name)
|
||||
assertEquals("MIN_VALUE", (Short.Default::MIN_VALUE).name)
|
||||
assertEquals("MAX_VALUE", (Byte.Default::MAX_VALUE).name)
|
||||
assertEquals("MIN_VALUE", (Int.Companion::MIN_VALUE).name)
|
||||
assertEquals("MAX_VALUE", (Double.Companion::MAX_VALUE).name)
|
||||
assertEquals("MIN_VALUE", (Float.Companion::MIN_VALUE).name)
|
||||
assertEquals("MAX_VALUE", (Long.Companion::MAX_VALUE).name)
|
||||
assertEquals("MIN_VALUE", (Short.Companion::MIN_VALUE).name)
|
||||
assertEquals("MAX_VALUE", (Byte.Companion::MAX_VALUE).name)
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class C {
|
||||
default object {
|
||||
companion object {
|
||||
val defaultGetter: Int = 1
|
||||
[native] get
|
||||
|
||||
@@ -39,8 +39,8 @@ fun box(): String {
|
||||
return check({defaultGetter}, "_DefaultPackage.getDefaultGetter()I")
|
||||
?: check({defaultSetter = 1}, "_DefaultPackage.setDefaultSetter(I)V")
|
||||
|
||||
?: check({C.defaultGetter}, "C\$Default.getDefaultGetter()I")
|
||||
?: check({C.defaultSetter = 1}, "C\$Default.setDefaultSetter(I)V")
|
||||
?: check({C.defaultGetter}, "C\$Companion.getDefaultGetter()I")
|
||||
?: check({C.defaultSetter = 1}, "C\$Companion.setDefaultSetter(I)V")
|
||||
|
||||
?: check({C().defaultGetter}, "C.getDefaultGetter()I")
|
||||
?: check({C().defaultSetter = 1}, "C.setDefaultSetter(I)V")
|
||||
|
||||
@@ -2,7 +2,7 @@ import kotlin.jvm.*
|
||||
import kotlin.platform.*
|
||||
|
||||
class C {
|
||||
default object {
|
||||
companion object {
|
||||
private platformStatic native fun foo()
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import kotlin.jvm.*
|
||||
import kotlin.platform.*
|
||||
|
||||
class WithNative {
|
||||
default object {
|
||||
companion object {
|
||||
platformStatic native fun bar(l: Long, s: String): Double
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import kotlin.platform.*
|
||||
|
||||
class C {
|
||||
default object {
|
||||
companion object {
|
||||
private platformStatic fun foo(): String {
|
||||
return "OK"
|
||||
}
|
||||
|
||||
+2
-2
@@ -8,8 +8,8 @@ fun box(): String {
|
||||
assertEquals("Int", Int::class.simpleName)
|
||||
assertEquals("Long", Long::class.simpleName)
|
||||
|
||||
assertEquals("Default", Int.Default::class.simpleName)
|
||||
assertEquals("Default", Double.Default::class.simpleName)
|
||||
assertEquals("Companion", Int.Companion::class.simpleName)
|
||||
assertEquals("Companion", Double.Companion::class.simpleName)
|
||||
|
||||
assertEquals("IntRange", IntRange::class.simpleName)
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class O {
|
||||
default object {
|
||||
companion object {
|
||||
// Currently we consider <clinit> in class O as the enclosing method of this lambda,
|
||||
// so we write outer class = O and enclosing method = null
|
||||
val f = {}
|
||||
|
||||
@@ -5,13 +5,13 @@ class G<T>(val s: T) {
|
||||
}
|
||||
|
||||
public trait ErrorsJvmTrait {
|
||||
default object {
|
||||
companion object {
|
||||
public val param : G<String> = G("STRING")
|
||||
}
|
||||
}
|
||||
|
||||
public class ErrorsJvmClass {
|
||||
default object {
|
||||
companion object {
|
||||
public val param : G<String> = G("STRING")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ open class B
|
||||
|
||||
class A {
|
||||
|
||||
default object {
|
||||
companion object {
|
||||
[platformStatic]
|
||||
fun <T: B> a(s: T) : T {
|
||||
return s
|
||||
|
||||
+9
-9
@@ -1,7 +1,7 @@
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
class A {
|
||||
default object {
|
||||
companion object {
|
||||
enum class Season {
|
||||
WINTER
|
||||
SPRING
|
||||
@@ -11,19 +11,19 @@ class A {
|
||||
}
|
||||
}
|
||||
|
||||
fun foo(x : A.Default.Season) : String {
|
||||
fun foo(x : A.Companion.Season) : String {
|
||||
return when (x) {
|
||||
A.Default.Season.WINTER -> "winter"
|
||||
A.Default.Season.SPRING -> "spring"
|
||||
A.Default.Season.SUMMER -> "summer"
|
||||
A.Companion.Season.WINTER -> "winter"
|
||||
A.Companion.Season.SPRING -> "spring"
|
||||
A.Companion.Season.SUMMER -> "summer"
|
||||
else -> "other"
|
||||
}
|
||||
}
|
||||
|
||||
fun box() : String {
|
||||
assertEquals("winter", foo(A.Default.Season.WINTER))
|
||||
assertEquals("spring", foo(A.Default.Season.SPRING))
|
||||
assertEquals("summer", foo(A.Default.Season.SUMMER))
|
||||
assertEquals("other", foo(A.Default.Season.AUTUMN))
|
||||
assertEquals("winter", foo(A.Companion.Season.WINTER))
|
||||
assertEquals("spring", foo(A.Companion.Season.SPRING))
|
||||
assertEquals("summer", foo(A.Companion.Season.SUMMER))
|
||||
assertEquals("other", foo(A.Companion.Season.AUTUMN))
|
||||
return "OK"
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class A {
|
||||
default object {
|
||||
companion object {
|
||||
val r: Int = 1;
|
||||
}
|
||||
}
|
||||
// A and default object constructor call
|
||||
// A and companion object constructor call
|
||||
// 2 ALOAD 0
|
||||
@@ -1,8 +1,8 @@
|
||||
class A {
|
||||
default object {
|
||||
companion object {
|
||||
private var r: Int = 1;
|
||||
}
|
||||
}
|
||||
// A and default object constructor call
|
||||
// A and companion object constructor call
|
||||
// 2 ALOAD 0
|
||||
// 1 synthetic access\$getR
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class C() {
|
||||
fun getInstance(): Runnable = C
|
||||
|
||||
default object: Runnable {
|
||||
companion object: Runnable {
|
||||
override fun run(): Unit { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
class A {
|
||||
default object
|
||||
companion object
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
class A {
|
||||
default object {
|
||||
companion object {
|
||||
class Foo(val a: Int = 1) {}
|
||||
}
|
||||
}
|
||||
|
||||
// CLASS: A$Default$Foo
|
||||
// CLASS: A$Companion$Foo
|
||||
// HAS_DEFAULT_CONSTRUCTOR: true
|
||||
|
||||
@@ -3,5 +3,5 @@ class A {
|
||||
inner class C
|
||||
}
|
||||
|
||||
default object
|
||||
companion object
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ class A {
|
||||
|
||||
fun foo(): String = ""
|
||||
|
||||
default object {
|
||||
companion object {
|
||||
val y: Any? = 239
|
||||
|
||||
fun bar(): String = ""
|
||||
|
||||
@@ -4,7 +4,7 @@ import java.lang.Object;
|
||||
|
||||
class Foo {
|
||||
|
||||
class Default { }
|
||||
class Companion { }
|
||||
|
||||
class InnerClass { }
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package foo
|
||||
|
||||
class Foo {
|
||||
|
||||
default object {
|
||||
companion object {
|
||||
fun objectFoo() { }
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ class C {
|
||||
get() = this
|
||||
set(value) {}
|
||||
|
||||
default object {
|
||||
companion object {
|
||||
private val classObjectVal: Long
|
||||
get() = 1L
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user