Postpone companion object field visibility
Have to reconsider this issue because of interface companion objects.
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: +ProperVisibilityForCompanionObjectInstanceField
|
||||
// IGNORE_BACKEND: JS, JS_IR, JVM_IR
|
||||
|
||||
inline fun on(body: () -> Any) = body().toString()
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
// LANGUAGE_VERSION: 1.2
|
||||
|
||||
inline fun on(body: () -> Any) = body().toString()
|
||||
|
||||
class A {
|
||||
fun test() = foo()
|
||||
|
||||
private companion object {
|
||||
private fun foo() = on { this }
|
||||
|
||||
override fun toString() = "OK"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun box() = A().test()
|
||||
@@ -0,0 +1,16 @@
|
||||
// LANGUAGE_VERSION: 1.3
|
||||
|
||||
inline fun on(body: () -> Any) = body().toString()
|
||||
|
||||
class A {
|
||||
fun test() = foo()
|
||||
|
||||
private companion object {
|
||||
private fun foo() = on { this }
|
||||
|
||||
override fun toString() = "OK"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun box() = A().test()
|
||||
@@ -1,5 +1,4 @@
|
||||
// !LANGUAGE: +ProperVisibilityForCompanionObjectInstanceField
|
||||
// IGNORE_BACKEND: JS, JS_IR, JVM_IR
|
||||
|
||||
interface A {
|
||||
fun test() = ok()
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
// LANGUAGE_VERSION: 1.2
|
||||
|
||||
interface A {
|
||||
fun test() = ok()
|
||||
|
||||
private companion object {
|
||||
fun ok() = "OK"
|
||||
}
|
||||
}
|
||||
|
||||
class C : A
|
||||
|
||||
fun box() = C().test()
|
||||
@@ -0,0 +1,13 @@
|
||||
// LANGUAGE_VERSION: 1.3
|
||||
|
||||
interface A {
|
||||
fun test() = ok()
|
||||
|
||||
private companion object {
|
||||
fun ok() = "OK"
|
||||
}
|
||||
}
|
||||
|
||||
class C : A
|
||||
|
||||
fun box() = C().test()
|
||||
@@ -0,0 +1,17 @@
|
||||
// LANGUAGE_VERSION: 1.3
|
||||
|
||||
open class TestProtectedCompanionInClass {
|
||||
protected companion object
|
||||
}
|
||||
|
||||
class TestInternalCompanionInClass {
|
||||
internal companion object
|
||||
}
|
||||
|
||||
class TestPrivateCompanionInClass {
|
||||
private companion object
|
||||
}
|
||||
|
||||
interface TestPrivateCompanionInInterface {
|
||||
private companion object
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
@kotlin.Metadata
|
||||
public final class TestInternalCompanionInClass$Companion {
|
||||
inner class TestInternalCompanionInClass$Companion
|
||||
private method <init>(): void
|
||||
public synthetic method <init>(p0: kotlin.jvm.internal.DefaultConstructorMarker): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class TestInternalCompanionInClass {
|
||||
public final static field Companion: TestInternalCompanionInClass$Companion
|
||||
inner class TestInternalCompanionInClass$Companion
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
final class TestPrivateCompanionInClass$Companion {
|
||||
inner class TestPrivateCompanionInClass$Companion
|
||||
private method <init>(): void
|
||||
public synthetic method <init>(p0: kotlin.jvm.internal.DefaultConstructorMarker): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class TestPrivateCompanionInClass {
|
||||
public deprecated final static @java.lang.Deprecated field Companion: TestPrivateCompanionInClass$Companion
|
||||
inner class TestPrivateCompanionInClass$Companion
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
final class TestPrivateCompanionInInterface$Companion {
|
||||
synthetic final static field $$INSTANCE: TestPrivateCompanionInInterface$Companion
|
||||
inner class TestPrivateCompanionInInterface$Companion
|
||||
static method <clinit>(): void
|
||||
private method <init>(): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public interface TestPrivateCompanionInInterface {
|
||||
public deprecated final static @java.lang.Deprecated field Companion: TestPrivateCompanionInInterface$Companion
|
||||
inner class TestPrivateCompanionInInterface$Companion
|
||||
static method <clinit>(): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class TestProtectedCompanionInClass$Companion {
|
||||
inner class TestProtectedCompanionInClass$Companion
|
||||
private method <init>(): void
|
||||
public synthetic method <init>(p0: kotlin.jvm.internal.DefaultConstructorMarker): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public class TestProtectedCompanionInClass {
|
||||
public deprecated final static @java.lang.Deprecated field Companion: TestProtectedCompanionInClass$Companion
|
||||
inner class TestProtectedCompanionInClass$Companion
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
}
|
||||
Reference in New Issue
Block a user