diff --git a/compiler/testData/codegen/box/objects/companionObjectAccess/kt27117.kt b/compiler/testData/codegen/box/objects/companionObjectAccess/kt27117.kt index 9e91d0ae2af..eb3f1278041 100644 --- a/compiler/testData/codegen/box/objects/companionObjectAccess/kt27117.kt +++ b/compiler/testData/codegen/box/objects/companionObjectAccess/kt27117.kt @@ -1,5 +1,4 @@ // !LANGUAGE: +ProperVisibilityForCompanionObjectInstanceField -// IGNORE_BACKEND: JS, JS_IR, JVM_IR inline fun on(body: () -> Any) = body().toString() diff --git a/compiler/testData/codegen/box/objects/companionObjectAccess/kt27117_lv12.kt b/compiler/testData/codegen/box/objects/companionObjectAccess/kt27117_lv12.kt new file mode 100644 index 00000000000..c1afb9f74ba --- /dev/null +++ b/compiler/testData/codegen/box/objects/companionObjectAccess/kt27117_lv12.kt @@ -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() \ No newline at end of file diff --git a/compiler/testData/codegen/box/objects/companionObjectAccess/kt27117_lv13.kt b/compiler/testData/codegen/box/objects/companionObjectAccess/kt27117_lv13.kt new file mode 100644 index 00000000000..eb6e7749b54 --- /dev/null +++ b/compiler/testData/codegen/box/objects/companionObjectAccess/kt27117_lv13.kt @@ -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() \ No newline at end of file diff --git a/compiler/testData/codegen/box/objects/companionObjectAccess/kt27121.kt b/compiler/testData/codegen/box/objects/companionObjectAccess/kt27121.kt index 5023ab02a25..88ffe4fdfd6 100644 --- a/compiler/testData/codegen/box/objects/companionObjectAccess/kt27121.kt +++ b/compiler/testData/codegen/box/objects/companionObjectAccess/kt27121.kt @@ -1,5 +1,4 @@ // !LANGUAGE: +ProperVisibilityForCompanionObjectInstanceField -// IGNORE_BACKEND: JS, JS_IR, JVM_IR interface A { fun test() = ok() diff --git a/compiler/testData/codegen/box/objects/companionObjectAccess/kt27121_lv12.kt b/compiler/testData/codegen/box/objects/companionObjectAccess/kt27121_lv12.kt new file mode 100644 index 00000000000..cf7a7c90756 --- /dev/null +++ b/compiler/testData/codegen/box/objects/companionObjectAccess/kt27121_lv12.kt @@ -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() diff --git a/compiler/testData/codegen/box/objects/companionObjectAccess/kt27121_lv13.kt b/compiler/testData/codegen/box/objects/companionObjectAccess/kt27121_lv13.kt new file mode 100644 index 00000000000..d0099a3cbf1 --- /dev/null +++ b/compiler/testData/codegen/box/objects/companionObjectAccess/kt27121_lv13.kt @@ -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() diff --git a/compiler/testData/codegen/bytecodeListing/companionObjectVisibility_lv13.kt b/compiler/testData/codegen/bytecodeListing/companionObjectVisibility_lv13.kt new file mode 100644 index 00000000000..53c103c3f9d --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/companionObjectVisibility_lv13.kt @@ -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 +} \ No newline at end of file diff --git a/compiler/testData/codegen/bytecodeListing/companionObjectVisibility_lv13.txt b/compiler/testData/codegen/bytecodeListing/companionObjectVisibility_lv13.txt new file mode 100644 index 00000000000..f5e9dbd9a1c --- /dev/null +++ b/compiler/testData/codegen/bytecodeListing/companionObjectVisibility_lv13.txt @@ -0,0 +1,59 @@ +@kotlin.Metadata +public final class TestInternalCompanionInClass$Companion { + inner class TestInternalCompanionInClass$Companion + private method (): void + public synthetic method (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 (): void + public method (): void +} + +@kotlin.Metadata +final class TestPrivateCompanionInClass$Companion { + inner class TestPrivateCompanionInClass$Companion + private method (): void + public synthetic method (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 (): void + public method (): void +} + +@kotlin.Metadata +final class TestPrivateCompanionInInterface$Companion { + synthetic final static field $$INSTANCE: TestPrivateCompanionInInterface$Companion + inner class TestPrivateCompanionInInterface$Companion + static method (): void + private method (): void +} + +@kotlin.Metadata +public interface TestPrivateCompanionInInterface { + public deprecated final static @java.lang.Deprecated field Companion: TestPrivateCompanionInInterface$Companion + inner class TestPrivateCompanionInInterface$Companion + static method (): void +} + +@kotlin.Metadata +public final class TestProtectedCompanionInClass$Companion { + inner class TestProtectedCompanionInClass$Companion + private method (): void + public synthetic method (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 (): void + public method (): void +} diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 8ce91b75542..332cb0f958a 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -15123,11 +15123,31 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/objects/companionObjectAccess/kt27117.kt"); } + @TestMetadata("kt27117_lv12.kt") + public void testKt27117_lv12() throws Exception { + runTest("compiler/testData/codegen/box/objects/companionObjectAccess/kt27117_lv12.kt"); + } + + @TestMetadata("kt27117_lv13.kt") + public void testKt27117_lv13() throws Exception { + runTest("compiler/testData/codegen/box/objects/companionObjectAccess/kt27117_lv13.kt"); + } + @TestMetadata("kt27121.kt") public void testKt27121() throws Exception { runTest("compiler/testData/codegen/box/objects/companionObjectAccess/kt27121.kt"); } + @TestMetadata("kt27121_lv12.kt") + public void testKt27121_lv12() throws Exception { + runTest("compiler/testData/codegen/box/objects/companionObjectAccess/kt27121_lv12.kt"); + } + + @TestMetadata("kt27121_lv13.kt") + public void testKt27121_lv13() throws Exception { + runTest("compiler/testData/codegen/box/objects/companionObjectAccess/kt27121_lv13.kt"); + } + @TestMetadata("privateCompanionObjectAccessedFromAnonymousObjectInNestedClass.kt") public void testPrivateCompanionObjectAccessedFromAnonymousObjectInNestedClass() throws Exception { runTest("compiler/testData/codegen/box/objects/companionObjectAccess/privateCompanionObjectAccessedFromAnonymousObjectInNestedClass.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java index 31ceba6509f..b7ee51a36ce 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BytecodeListingTestGenerated.java @@ -48,6 +48,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest { runTest("compiler/testData/codegen/bytecodeListing/companionObjectVisibility_before.kt"); } + @TestMetadata("companionObjectVisibility_lv13.kt") + public void testCompanionObjectVisibility_lv13() throws Exception { + runTest("compiler/testData/codegen/bytecodeListing/companionObjectVisibility_lv13.kt"); + } + @TestMetadata("coroutineContextIntrinsic.kt") public void testCoroutineContextIntrinsic_1_2() throws Exception { runTestWithPackageReplacement("compiler/testData/codegen/bytecodeListing/coroutineContextIntrinsic.kt", "kotlin.coroutines.experimental"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 872f3318688..d32730955e6 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -15123,11 +15123,31 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/objects/companionObjectAccess/kt27117.kt"); } + @TestMetadata("kt27117_lv12.kt") + public void testKt27117_lv12() throws Exception { + runTest("compiler/testData/codegen/box/objects/companionObjectAccess/kt27117_lv12.kt"); + } + + @TestMetadata("kt27117_lv13.kt") + public void testKt27117_lv13() throws Exception { + runTest("compiler/testData/codegen/box/objects/companionObjectAccess/kt27117_lv13.kt"); + } + @TestMetadata("kt27121.kt") public void testKt27121() throws Exception { runTest("compiler/testData/codegen/box/objects/companionObjectAccess/kt27121.kt"); } + @TestMetadata("kt27121_lv12.kt") + public void testKt27121_lv12() throws Exception { + runTest("compiler/testData/codegen/box/objects/companionObjectAccess/kt27121_lv12.kt"); + } + + @TestMetadata("kt27121_lv13.kt") + public void testKt27121_lv13() throws Exception { + runTest("compiler/testData/codegen/box/objects/companionObjectAccess/kt27121_lv13.kt"); + } + @TestMetadata("privateCompanionObjectAccessedFromAnonymousObjectInNestedClass.kt") public void testPrivateCompanionObjectAccessedFromAnonymousObjectInNestedClass() throws Exception { runTest("compiler/testData/codegen/box/objects/companionObjectAccess/privateCompanionObjectAccessedFromAnonymousObjectInNestedClass.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index e98f2d61d68..0a8526b108b 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -15128,11 +15128,31 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/objects/companionObjectAccess/kt27117.kt"); } + @TestMetadata("kt27117_lv12.kt") + public void testKt27117_lv12() throws Exception { + runTest("compiler/testData/codegen/box/objects/companionObjectAccess/kt27117_lv12.kt"); + } + + @TestMetadata("kt27117_lv13.kt") + public void testKt27117_lv13() throws Exception { + runTest("compiler/testData/codegen/box/objects/companionObjectAccess/kt27117_lv13.kt"); + } + @TestMetadata("kt27121.kt") public void testKt27121() throws Exception { runTest("compiler/testData/codegen/box/objects/companionObjectAccess/kt27121.kt"); } + @TestMetadata("kt27121_lv12.kt") + public void testKt27121_lv12() throws Exception { + runTest("compiler/testData/codegen/box/objects/companionObjectAccess/kt27121_lv12.kt"); + } + + @TestMetadata("kt27121_lv13.kt") + public void testKt27121_lv13() throws Exception { + runTest("compiler/testData/codegen/box/objects/companionObjectAccess/kt27121_lv13.kt"); + } + @TestMetadata("privateCompanionObjectAccessedFromAnonymousObjectInNestedClass.kt") public void testPrivateCompanionObjectAccessedFromAnonymousObjectInNestedClass() throws Exception { runTest("compiler/testData/codegen/box/objects/companionObjectAccess/privateCompanionObjectAccessedFromAnonymousObjectInNestedClass.kt"); diff --git a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt index d6ee2022b95..69eae3b4ad8 100644 --- a/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt +++ b/compiler/util/src/org/jetbrains/kotlin/config/LanguageVersionSettings.kt @@ -62,7 +62,6 @@ enum class LanguageFeature( ProhibitDataClassesOverridingCopy(KOTLIN_1_3, kind = BUG_FIX), RestrictionOfWrongAnnotationsWithUseSiteTargetsOnTypes(KOTLIN_1_3, kind = BUG_FIX), ProhibitInnerClassesOfGenericClassExtendingThrowable(KOTLIN_1_3, kind = BUG_FIX), - ProperVisibilityForCompanionObjectInstanceField(KOTLIN_1_3, kind = BUG_FIX), ProperForInArrayLoopRangeVariableAssignmentSemantic(KOTLIN_1_3, kind = BUG_FIX), NestedClassesInAnnotations(KOTLIN_1_3), JvmStaticInInterface(KOTLIN_1_3, kind = UNSTABLE_FEATURE), @@ -94,6 +93,8 @@ enum class LanguageFeature( RestrictReturnStatementTarget(KOTLIN_1_4, kind = BUG_FIX), NoConstantValueAttributeForNonConstVals(KOTLIN_1_4, kind = BUG_FIX), + ProperVisibilityForCompanionObjectInstanceField(sinceVersion = null, kind = BUG_FIX), + ProperIeee754Comparisons(sinceVersion = null, defaultState = State.DISABLED, kind = BUG_FIX), // Experimental features diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/IrJsCodegenBoxTestGenerated.java index 542c9cc0677..64c751bd736 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/IrJsCodegenBoxTestGenerated.java @@ -13308,11 +13308,31 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/objects/companionObjectAccess/kt27117.kt"); } + @TestMetadata("kt27117_lv12.kt") + public void testKt27117_lv12() throws Exception { + runTest("compiler/testData/codegen/box/objects/companionObjectAccess/kt27117_lv12.kt"); + } + + @TestMetadata("kt27117_lv13.kt") + public void testKt27117_lv13() throws Exception { + runTest("compiler/testData/codegen/box/objects/companionObjectAccess/kt27117_lv13.kt"); + } + @TestMetadata("kt27121.kt") public void testKt27121() throws Exception { runTest("compiler/testData/codegen/box/objects/companionObjectAccess/kt27121.kt"); } + @TestMetadata("kt27121_lv12.kt") + public void testKt27121_lv12() throws Exception { + runTest("compiler/testData/codegen/box/objects/companionObjectAccess/kt27121_lv12.kt"); + } + + @TestMetadata("kt27121_lv13.kt") + public void testKt27121_lv13() throws Exception { + runTest("compiler/testData/codegen/box/objects/companionObjectAccess/kt27121_lv13.kt"); + } + @TestMetadata("privateCompanionObjectAccessedFromAnonymousObjectInNestedClass.kt") public void testPrivateCompanionObjectAccessedFromAnonymousObjectInNestedClass() throws Exception { runTest("compiler/testData/codegen/box/objects/companionObjectAccess/privateCompanionObjectAccessedFromAnonymousObjectInNestedClass.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index 5882b491f3e..eb7af434dd3 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -14353,11 +14353,31 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/objects/companionObjectAccess/kt27117.kt"); } + @TestMetadata("kt27117_lv12.kt") + public void testKt27117_lv12() throws Exception { + runTest("compiler/testData/codegen/box/objects/companionObjectAccess/kt27117_lv12.kt"); + } + + @TestMetadata("kt27117_lv13.kt") + public void testKt27117_lv13() throws Exception { + runTest("compiler/testData/codegen/box/objects/companionObjectAccess/kt27117_lv13.kt"); + } + @TestMetadata("kt27121.kt") public void testKt27121() throws Exception { runTest("compiler/testData/codegen/box/objects/companionObjectAccess/kt27121.kt"); } + @TestMetadata("kt27121_lv12.kt") + public void testKt27121_lv12() throws Exception { + runTest("compiler/testData/codegen/box/objects/companionObjectAccess/kt27121_lv12.kt"); + } + + @TestMetadata("kt27121_lv13.kt") + public void testKt27121_lv13() throws Exception { + runTest("compiler/testData/codegen/box/objects/companionObjectAccess/kt27121_lv13.kt"); + } + @TestMetadata("privateCompanionObjectAccessedFromAnonymousObjectInNestedClass.kt") public void testPrivateCompanionObjectAccessedFromAnonymousObjectInNestedClass() throws Exception { runTest("compiler/testData/codegen/box/objects/companionObjectAccess/privateCompanionObjectAccessedFromAnonymousObjectInNestedClass.kt");