From 4d2ba3e8909aaf620005ae2bb1c8034e0a727766 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Thu, 25 Jun 2015 12:38:21 +0300 Subject: [PATCH] Sealed constructors are made private in front-end, tests changed accordingly --- compiler/testData/diagnostics/tests/sealed/DoubleInner.txt | 2 +- compiler/testData/diagnostics/tests/sealed/ExhaustiveWhen.txt | 2 +- .../diagnostics/tests/sealed/ExhaustiveWhenDoubleInner.txt | 2 +- .../diagnostics/tests/sealed/ExhaustiveWhenMultipleInner.txt | 2 +- .../diagnostics/tests/sealed/ExhaustiveWhenNegated.txt | 2 +- .../diagnostics/tests/sealed/ExhaustiveWhenNegatedTwice.txt | 2 +- .../diagnostics/tests/sealed/ExhaustiveWhenOnNestedSealed.txt | 4 ++-- .../diagnostics/tests/sealed/ExhaustiveWhenOnNullable.txt | 2 +- .../tests/sealed/ExhaustiveWhenWithAdditionalMember.txt | 2 +- .../diagnostics/tests/sealed/ExhaustiveWhenWithElse.txt | 2 +- compiler/testData/diagnostics/tests/sealed/Local.txt | 2 +- .../testData/diagnostics/tests/sealed/NeverConstructed.txt | 2 +- compiler/testData/diagnostics/tests/sealed/NeverDerived.kt | 2 +- compiler/testData/diagnostics/tests/sealed/NeverDerived.txt | 2 +- compiler/testData/diagnostics/tests/sealed/NeverFinal.txt | 2 +- compiler/testData/diagnostics/tests/sealed/NeverOpen.txt | 2 +- .../testData/diagnostics/tests/sealed/NonExhaustiveWhen.txt | 2 +- .../diagnostics/tests/sealed/NonExhaustiveWhenNegated.txt | 2 +- .../tests/sealed/NonExhaustiveWhenWithAdditionalCase.txt | 2 +- .../diagnostics/tests/sealed/NonExhaustiveWhenWithAnyCase.txt | 2 +- compiler/testData/diagnostics/tests/sealed/OperationWhen.txt | 2 +- .../testData/diagnostics/tests/sealed/RedundantAbstract.txt | 2 +- compiler/testData/diagnostics/tests/sealed/TreeWhen.txt | 2 +- .../testData/diagnostics/tests/sealed/TreeWhenFunctional.txt | 2 +- .../diagnostics/tests/sealed/TreeWhenFunctionalNoIs.txt | 2 +- .../testData/diagnostics/tests/sealed/WhenOnEmptySealed.txt | 2 +- .../src/org/jetbrains/kotlin/resolve/DescriptorUtils.java | 2 +- 27 files changed, 28 insertions(+), 28 deletions(-) diff --git a/compiler/testData/diagnostics/tests/sealed/DoubleInner.txt b/compiler/testData/diagnostics/tests/sealed/DoubleInner.txt index 6140d4eeba9..d063398b597 100644 --- a/compiler/testData/diagnostics/tests/sealed/DoubleInner.txt +++ b/compiler/testData/diagnostics/tests/sealed/DoubleInner.txt @@ -1,7 +1,7 @@ package internal sealed class Sealed { - public constructor Sealed(/*0*/ x: kotlin.Int) + private constructor Sealed(/*0*/ x: kotlin.Int) internal final val x: kotlin.Int public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhen.txt b/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhen.txt index 82857529aa1..a1ab8b4f89a 100644 --- a/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhen.txt +++ b/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhen.txt @@ -3,7 +3,7 @@ package internal fun foo(/*0*/ s: Sealed): kotlin.Int internal sealed class Sealed { - public constructor Sealed(/*0*/ x: kotlin.Int) + private constructor Sealed(/*0*/ x: kotlin.Int) internal final val x: kotlin.Int public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenDoubleInner.txt b/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenDoubleInner.txt index c9e8163d7a4..e49e861f5f7 100644 --- a/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenDoubleInner.txt +++ b/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenDoubleInner.txt @@ -3,7 +3,7 @@ package internal fun foo(/*0*/ s: Sealed): kotlin.Int internal sealed class Sealed { - public constructor Sealed() + private constructor Sealed() 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 diff --git a/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenMultipleInner.txt b/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenMultipleInner.txt index cc43123d220..60927ae163e 100644 --- a/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenMultipleInner.txt +++ b/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenMultipleInner.txt @@ -6,7 +6,7 @@ internal fun fooWithElse(/*0*/ s: Sealed): kotlin.Int internal fun fooWithoutElse(/*0*/ s: Sealed): kotlin.Int internal sealed class Sealed { - public constructor Sealed() + private constructor Sealed() 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 diff --git a/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenNegated.txt b/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenNegated.txt index 82857529aa1..a1ab8b4f89a 100644 --- a/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenNegated.txt +++ b/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenNegated.txt @@ -3,7 +3,7 @@ package internal fun foo(/*0*/ s: Sealed): kotlin.Int internal sealed class Sealed { - public constructor Sealed(/*0*/ x: kotlin.Int) + private constructor Sealed(/*0*/ x: kotlin.Int) internal final val x: kotlin.Int public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenNegatedTwice.txt b/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenNegatedTwice.txt index 4a5b648c715..bbc0e3f3035 100644 --- a/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenNegatedTwice.txt +++ b/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenNegatedTwice.txt @@ -3,7 +3,7 @@ package internal fun foo(/*0*/ s: Sealed): kotlin.Int internal sealed class Sealed { - public constructor Sealed(/*0*/ x: kotlin.Int) + private constructor Sealed(/*0*/ x: kotlin.Int) internal final val x: kotlin.Int public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenOnNestedSealed.txt b/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenOnNestedSealed.txt index 4f4f54103b5..d47fdf40234 100644 --- a/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenOnNestedSealed.txt +++ b/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenOnNestedSealed.txt @@ -3,7 +3,7 @@ package internal fun foo(/*0*/ s: Sealed, /*1*/ nf: Sealed.NonFirst): kotlin.Int internal sealed class Sealed { - public constructor Sealed() + private constructor Sealed() 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 @@ -16,7 +16,7 @@ internal sealed class Sealed { } internal sealed class NonFirst { - public constructor NonFirst() + private constructor NonFirst() 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 diff --git a/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenOnNullable.txt b/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenOnNullable.txt index 256f59a31a1..4bde0312520 100644 --- a/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenOnNullable.txt +++ b/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenOnNullable.txt @@ -3,7 +3,7 @@ package internal fun foo(/*0*/ s: Sealed?): kotlin.Int internal sealed class Sealed { - public constructor Sealed(/*0*/ x: kotlin.Int) + private constructor Sealed(/*0*/ x: kotlin.Int) internal final val x: kotlin.Int public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenWithAdditionalMember.txt b/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenWithAdditionalMember.txt index 7f0e2dbff4d..0ec87c74868 100644 --- a/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenWithAdditionalMember.txt +++ b/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenWithAdditionalMember.txt @@ -3,7 +3,7 @@ package internal fun foo(/*0*/ s: Sealed): kotlin.Int internal sealed class Sealed { - public constructor Sealed(/*0*/ x: kotlin.Int) + private constructor Sealed(/*0*/ x: kotlin.Int) internal final val x: kotlin.Int public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenWithElse.txt b/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenWithElse.txt index 82857529aa1..a1ab8b4f89a 100644 --- a/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenWithElse.txt +++ b/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenWithElse.txt @@ -3,7 +3,7 @@ package internal fun foo(/*0*/ s: Sealed): kotlin.Int internal sealed class Sealed { - public constructor Sealed(/*0*/ x: kotlin.Int) + private constructor Sealed(/*0*/ x: kotlin.Int) internal final val x: kotlin.Int public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/tests/sealed/Local.txt b/compiler/testData/diagnostics/tests/sealed/Local.txt index 2951c987fe6..b404e3cf6a3 100644 --- a/compiler/testData/diagnostics/tests/sealed/Local.txt +++ b/compiler/testData/diagnostics/tests/sealed/Local.txt @@ -1,7 +1,7 @@ package internal sealed class Sealed { - public constructor Sealed() + private constructor Sealed() internal final val p: Sealed public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/tests/sealed/NeverConstructed.txt b/compiler/testData/diagnostics/tests/sealed/NeverConstructed.txt index bbe109ea8e2..ef49296f5c1 100644 --- a/compiler/testData/diagnostics/tests/sealed/NeverConstructed.txt +++ b/compiler/testData/diagnostics/tests/sealed/NeverConstructed.txt @@ -1,7 +1,7 @@ package internal sealed class Base { - public constructor Base() + private constructor Base() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean internal final fun foo(): Base public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/tests/sealed/NeverDerived.kt b/compiler/testData/diagnostics/tests/sealed/NeverDerived.kt index 2a4224d3593..fcb38bcfa18 100644 --- a/compiler/testData/diagnostics/tests/sealed/NeverDerived.kt +++ b/compiler/testData/diagnostics/tests/sealed/NeverDerived.kt @@ -2,6 +2,6 @@ sealed class Base { } -class Derived: Base() { +class Derived: Base() { } diff --git a/compiler/testData/diagnostics/tests/sealed/NeverDerived.txt b/compiler/testData/diagnostics/tests/sealed/NeverDerived.txt index efda7b37829..d55b2f1341a 100644 --- a/compiler/testData/diagnostics/tests/sealed/NeverDerived.txt +++ b/compiler/testData/diagnostics/tests/sealed/NeverDerived.txt @@ -1,7 +1,7 @@ package internal sealed class Base { - public constructor Base() + private constructor Base() 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 diff --git a/compiler/testData/diagnostics/tests/sealed/NeverFinal.txt b/compiler/testData/diagnostics/tests/sealed/NeverFinal.txt index a91a691fa48..536eadc49b5 100644 --- a/compiler/testData/diagnostics/tests/sealed/NeverFinal.txt +++ b/compiler/testData/diagnostics/tests/sealed/NeverFinal.txt @@ -1,7 +1,7 @@ package internal sealed class Base { - public constructor Base() + private constructor Base() 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 diff --git a/compiler/testData/diagnostics/tests/sealed/NeverOpen.txt b/compiler/testData/diagnostics/tests/sealed/NeverOpen.txt index a91a691fa48..536eadc49b5 100644 --- a/compiler/testData/diagnostics/tests/sealed/NeverOpen.txt +++ b/compiler/testData/diagnostics/tests/sealed/NeverOpen.txt @@ -1,7 +1,7 @@ package internal sealed class Base { - public constructor Base() + private constructor Base() 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 diff --git a/compiler/testData/diagnostics/tests/sealed/NonExhaustiveWhen.txt b/compiler/testData/diagnostics/tests/sealed/NonExhaustiveWhen.txt index 82857529aa1..a1ab8b4f89a 100644 --- a/compiler/testData/diagnostics/tests/sealed/NonExhaustiveWhen.txt +++ b/compiler/testData/diagnostics/tests/sealed/NonExhaustiveWhen.txt @@ -3,7 +3,7 @@ package internal fun foo(/*0*/ s: Sealed): kotlin.Int internal sealed class Sealed { - public constructor Sealed(/*0*/ x: kotlin.Int) + private constructor Sealed(/*0*/ x: kotlin.Int) internal final val x: kotlin.Int public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/tests/sealed/NonExhaustiveWhenNegated.txt b/compiler/testData/diagnostics/tests/sealed/NonExhaustiveWhenNegated.txt index 82857529aa1..a1ab8b4f89a 100644 --- a/compiler/testData/diagnostics/tests/sealed/NonExhaustiveWhenNegated.txt +++ b/compiler/testData/diagnostics/tests/sealed/NonExhaustiveWhenNegated.txt @@ -3,7 +3,7 @@ package internal fun foo(/*0*/ s: Sealed): kotlin.Int internal sealed class Sealed { - public constructor Sealed(/*0*/ x: kotlin.Int) + private constructor Sealed(/*0*/ x: kotlin.Int) internal final val x: kotlin.Int public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/tests/sealed/NonExhaustiveWhenWithAdditionalCase.txt b/compiler/testData/diagnostics/tests/sealed/NonExhaustiveWhenWithAdditionalCase.txt index 9795e30d009..d27411ddec8 100644 --- a/compiler/testData/diagnostics/tests/sealed/NonExhaustiveWhenWithAdditionalCase.txt +++ b/compiler/testData/diagnostics/tests/sealed/NonExhaustiveWhenWithAdditionalCase.txt @@ -3,7 +3,7 @@ package internal fun foo(/*0*/ s: Sealed): kotlin.Int internal sealed class Sealed { - public constructor Sealed(/*0*/ x: kotlin.Int) + private constructor Sealed(/*0*/ x: kotlin.Int) internal final val x: kotlin.Int public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/tests/sealed/NonExhaustiveWhenWithAnyCase.txt b/compiler/testData/diagnostics/tests/sealed/NonExhaustiveWhenWithAnyCase.txt index 2289d175d38..164a5087635 100644 --- a/compiler/testData/diagnostics/tests/sealed/NonExhaustiveWhenWithAnyCase.txt +++ b/compiler/testData/diagnostics/tests/sealed/NonExhaustiveWhenWithAnyCase.txt @@ -3,7 +3,7 @@ package internal fun foo(/*0*/ s: Sealed): kotlin.Int internal sealed class Sealed { - public constructor Sealed() + private constructor Sealed() 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 diff --git a/compiler/testData/diagnostics/tests/sealed/OperationWhen.txt b/compiler/testData/diagnostics/tests/sealed/OperationWhen.txt index a6fefd2f7c6..4363a4515e9 100644 --- a/compiler/testData/diagnostics/tests/sealed/OperationWhen.txt +++ b/compiler/testData/diagnostics/tests/sealed/OperationWhen.txt @@ -3,7 +3,7 @@ package internal fun priority(/*0*/ op: Operation): kotlin.Int internal sealed class Operation { - public constructor Operation(/*0*/ left: kotlin.Int, /*1*/ right: kotlin.Int) + private constructor Operation(/*0*/ left: kotlin.Int, /*1*/ right: kotlin.Int) internal final val left: kotlin.Int internal final val right: kotlin.Int public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean diff --git a/compiler/testData/diagnostics/tests/sealed/RedundantAbstract.txt b/compiler/testData/diagnostics/tests/sealed/RedundantAbstract.txt index a91a691fa48..536eadc49b5 100644 --- a/compiler/testData/diagnostics/tests/sealed/RedundantAbstract.txt +++ b/compiler/testData/diagnostics/tests/sealed/RedundantAbstract.txt @@ -1,7 +1,7 @@ package internal sealed class Base { - public constructor Base() + private constructor Base() 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 diff --git a/compiler/testData/diagnostics/tests/sealed/TreeWhen.txt b/compiler/testData/diagnostics/tests/sealed/TreeWhen.txt index 02f60cae367..9362b27a356 100644 --- a/compiler/testData/diagnostics/tests/sealed/TreeWhen.txt +++ b/compiler/testData/diagnostics/tests/sealed/TreeWhen.txt @@ -1,7 +1,7 @@ package internal sealed class Tree { - public constructor Tree() + private constructor Tree() 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 max(): kotlin.Int diff --git a/compiler/testData/diagnostics/tests/sealed/TreeWhenFunctional.txt b/compiler/testData/diagnostics/tests/sealed/TreeWhenFunctional.txt index 02f60cae367..9362b27a356 100644 --- a/compiler/testData/diagnostics/tests/sealed/TreeWhenFunctional.txt +++ b/compiler/testData/diagnostics/tests/sealed/TreeWhenFunctional.txt @@ -1,7 +1,7 @@ package internal sealed class Tree { - public constructor Tree() + private constructor Tree() 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 max(): kotlin.Int diff --git a/compiler/testData/diagnostics/tests/sealed/TreeWhenFunctionalNoIs.txt b/compiler/testData/diagnostics/tests/sealed/TreeWhenFunctionalNoIs.txt index 87e5e4f7c79..108ada660ee 100644 --- a/compiler/testData/diagnostics/tests/sealed/TreeWhenFunctionalNoIs.txt +++ b/compiler/testData/diagnostics/tests/sealed/TreeWhenFunctionalNoIs.txt @@ -1,7 +1,7 @@ package internal sealed class Tree { - public constructor Tree() + private constructor Tree() 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 max(): kotlin.Int diff --git a/compiler/testData/diagnostics/tests/sealed/WhenOnEmptySealed.txt b/compiler/testData/diagnostics/tests/sealed/WhenOnEmptySealed.txt index 112b361bd17..0bdc2f01f33 100644 --- a/compiler/testData/diagnostics/tests/sealed/WhenOnEmptySealed.txt +++ b/compiler/testData/diagnostics/tests/sealed/WhenOnEmptySealed.txt @@ -3,7 +3,7 @@ package internal fun foo(/*0*/ s: Sealed): kotlin.Int internal sealed class Sealed { - public constructor Sealed() + private constructor Sealed() 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 diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.java b/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.java index da0784646de..f9e9dd0462b 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.java +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.java @@ -375,7 +375,7 @@ public class DescriptorUtils { @NotNull public static Visibility getDefaultConstructorVisibility(@NotNull ClassDescriptor classDescriptor) { ClassKind classKind = classDescriptor.getKind(); - if (classKind == ClassKind.ENUM_CLASS || classKind.isSingleton()) { + if (classKind == ClassKind.ENUM_CLASS || classKind.isSingleton() || classDescriptor.getModality() == Modality.SEALED) { return Visibilities.PRIVATE; } if (isAnonymousObject(classDescriptor)) {