diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java index 56b9c23c588..7bda4473beb 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java @@ -24397,6 +24397,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti runTest("compiler/testData/diagnostics/tests/sealed/kt44316.kt"); } + @Test + @TestMetadata("kt44861.kt") + public void testKt44861() throws Exception { + runTest("compiler/testData/diagnostics/tests/sealed/kt44861.kt"); + } + @Test @TestMetadata("Local.kt") public void testLocal() throws Exception { diff --git a/compiler/testData/compileKotlinAgainstCustomBinaries/sealedInheritorInDifferentModule/output.txt b/compiler/testData/compileKotlinAgainstCustomBinaries/sealedInheritorInDifferentModule/output.txt index b22e0dc8b0d..242942dc732 100644 --- a/compiler/testData/compileKotlinAgainstCustomBinaries/sealedInheritorInDifferentModule/output.txt +++ b/compiler/testData/compileKotlinAgainstCustomBinaries/sealedInheritorInDifferentModule/output.txt @@ -8,9 +8,6 @@ This mode is not recommended for production use, as no stability/compatibility guarantees are given on compiler or generated code. Use it at your own risk! -compiler/testData/compileKotlinAgainstCustomBinaries/sealedInheritorInDifferentModule/main.kt:5:11: error: cannot access '': it is internal in 'Base' -class B : Base(), IBase - ^ compiler/testData/compileKotlinAgainstCustomBinaries/sealedInheritorInDifferentModule/main.kt:5:11: error: inheritance of sealed classes or interfaces from different module is prohibited class B : Base(), IBase ^ diff --git a/compiler/testData/diagnostics/tests/dataClasses/sealedDataClass.txt b/compiler/testData/diagnostics/tests/dataClasses/sealedDataClass.txt index 843867f4337..77537adb9c0 100644 --- a/compiler/testData/diagnostics/tests/dataClasses/sealedDataClass.txt +++ b/compiler/testData/diagnostics/tests/dataClasses/sealedDataClass.txt @@ -1,7 +1,7 @@ package public sealed data class My { - internal constructor My(/*0*/ x: kotlin.Int) + protected constructor My(/*0*/ x: kotlin.Int) public final val x: kotlin.Int public final operator /*synthesized*/ fun component1(): kotlin.Int public final /*synthesized*/ fun copy(/*0*/ x: kotlin.Int = ...): My diff --git a/compiler/testData/diagnostics/tests/generics/starProjections/foldRecursiveTypesToStarProjection.txt b/compiler/testData/diagnostics/tests/generics/starProjections/foldRecursiveTypesToStarProjection.txt index 9e03553cdbf..53a8c5c4272 100644 --- a/compiler/testData/diagnostics/tests/generics/starProjections/foldRecursiveTypesToStarProjection.txt +++ b/compiler/testData/diagnostics/tests/generics/starProjections/foldRecursiveTypesToStarProjection.txt @@ -77,27 +77,27 @@ public object KT32183 { } public sealed class ProjectJob { - internal constructor ProjectJob() + protected constructor ProjectJob() 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 public sealed class Process, /*1*/ R : KT32183.ProjectJob.ProcessResources> : KT32183.ProjectJob { - internal constructor Process, /*1*/ R : KT32183.ProjectJob.ProcessResources>() + protected constructor Process, /*1*/ R : KT32183.ProjectJob.ProcessResources>() 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 } public sealed class ProcessExecutable> { - internal constructor ProcessExecutable>() + protected constructor ProcessExecutable>() 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 } public sealed class ProcessResources> { - internal constructor ProcessResources>() + protected constructor ProcessResources>() 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/inference/nothingType/kt32388.txt b/compiler/testData/diagnostics/tests/inference/nothingType/kt32388.txt index 77f67644feb..0f07201d266 100644 --- a/compiler/testData/diagnostics/tests/inference/nothingType/kt32388.txt +++ b/compiler/testData/diagnostics/tests/inference/nothingType/kt32388.txt @@ -4,7 +4,7 @@ public fun Either.recover(/*0*/ f: (A) -> B): Either A.right(): Either public sealed class Either { - internal constructor Either() + protected constructor Either() 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/inlineClasses/inlineClassDeclarationCheck.txt b/compiler/testData/diagnostics/tests/inlineClasses/inlineClassDeclarationCheck.txt index d5932702482..48484d908dd 100644 --- a/compiler/testData/diagnostics/tests/inlineClasses/inlineClassDeclarationCheck.txt +++ b/compiler/testData/diagnostics/tests/inlineClasses/inlineClassDeclarationCheck.txt @@ -174,7 +174,7 @@ public abstract inline class D2 { } public sealed inline class D3 { - internal constructor D3(/*0*/ x: kotlin.Int) + protected constructor D3(/*0*/ x: kotlin.Int) public final val x: kotlin.Int public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/tests/javac/inners/Nested.txt b/compiler/testData/diagnostics/tests/javac/inners/Nested.txt index 9b8503cf487..df678815f7a 100644 --- a/compiler/testData/diagnostics/tests/javac/inners/Nested.txt +++ b/compiler/testData/diagnostics/tests/javac/inners/Nested.txt @@ -21,13 +21,13 @@ package p { public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String public sealed class Sealed1 { - internal constructor Sealed1() + protected constructor Sealed1() 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 public sealed class Sealed2 { - internal constructor Sealed2() + protected constructor Sealed2() 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/modifiers/IllegalModifiers.txt b/compiler/testData/diagnostics/tests/modifiers/IllegalModifiers.txt index 18f8bd789ee..3ecc2db5c1c 100644 --- a/compiler/testData/diagnostics/tests/modifiers/IllegalModifiers.txt +++ b/compiler/testData/diagnostics/tests/modifiers/IllegalModifiers.txt @@ -155,7 +155,7 @@ package illegal_modifiers { public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String public sealed inner class Inner { - internal constructor Inner() + protected constructor Inner() 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/multimodule/redundantElseInWhen.txt b/compiler/testData/diagnostics/tests/multimodule/redundantElseInWhen.txt index 4fab4c6ad6e..83b0ccc371f 100644 --- a/compiler/testData/diagnostics/tests/multimodule/redundantElseInWhen.txt +++ b/compiler/testData/diagnostics/tests/multimodule/redundantElseInWhen.txt @@ -30,7 +30,7 @@ package test { } public sealed class S { - internal constructor S() + protected constructor S() 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/multiplatform/headerClass/extendExpectedClassWithAbstractMember.txt b/compiler/testData/diagnostics/tests/multiplatform/headerClass/extendExpectedClassWithAbstractMember.txt index 8e6a3c4f8e7..390994b22a2 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/headerClass/extendExpectedClassWithAbstractMember.txt +++ b/compiler/testData/diagnostics/tests/multiplatform/headerClass/extendExpectedClassWithAbstractMember.txt @@ -70,7 +70,7 @@ public expect interface BaseE { } public sealed class BaseEImpl : BaseE { - internal constructor BaseEImpl() + protected constructor BaseEImpl() public final fun bar(): kotlin.Unit public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public abstract expect override /*1*/ /*fake_override*/ fun foo(): kotlin.Unit diff --git a/compiler/testData/diagnostics/tests/multiplatform/sealedTypeAlias.txt b/compiler/testData/diagnostics/tests/multiplatform/sealedTypeAlias.txt index 36e27006142..b0c1b8c7737 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/sealedTypeAlias.txt +++ b/compiler/testData/diagnostics/tests/multiplatform/sealedTypeAlias.txt @@ -23,7 +23,7 @@ public sealed expect class Presence { package public sealed class P { - internal constructor P() + protected constructor P() 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/multiplatform/sealedTypeAliasTopLevel.txt b/compiler/testData/diagnostics/tests/multiplatform/sealedTypeAliasTopLevel.txt index 16eaf0abd1a..e2f8b900b62 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/sealedTypeAliasTopLevel.txt +++ b/compiler/testData/diagnostics/tests/multiplatform/sealedTypeAliasTopLevel.txt @@ -37,7 +37,7 @@ public actual object Online : P { } public sealed class P { - internal constructor P() + protected constructor P() 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/DerivedTopLevel.txt b/compiler/testData/diagnostics/tests/sealed/DerivedTopLevel.txt index 7f1ab161a05..c8943bdb8d6 100644 --- a/compiler/testData/diagnostics/tests/sealed/DerivedTopLevel.txt +++ b/compiler/testData/diagnostics/tests/sealed/DerivedTopLevel.txt @@ -3,7 +3,7 @@ package public fun test(): kotlin.Unit public sealed class Base { - internal constructor Base() + protected 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/DoubleInner.txt b/compiler/testData/diagnostics/tests/sealed/DoubleInner.txt index 050d26bc834..5a52ffe2028 100644 --- a/compiler/testData/diagnostics/tests/sealed/DoubleInner.txt +++ b/compiler/testData/diagnostics/tests/sealed/DoubleInner.txt @@ -1,7 +1,7 @@ package public sealed class Sealed { - internal constructor Sealed(/*0*/ x: kotlin.Int) + protected constructor Sealed(/*0*/ x: kotlin.Int) public 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/ExhaustiveOnRoot.txt b/compiler/testData/diagnostics/tests/sealed/ExhaustiveOnRoot.txt index 425b7c75ed6..f15a8692714 100644 --- a/compiler/testData/diagnostics/tests/sealed/ExhaustiveOnRoot.txt +++ b/compiler/testData/diagnostics/tests/sealed/ExhaustiveOnRoot.txt @@ -5,7 +5,7 @@ public fun test2(/*0*/ x: Stmt): kotlin.String public fun test3(/*0*/ x: Expr): kotlin.String public sealed class Expr : Stmt { - internal constructor Expr() + protected constructor Expr() 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 @@ -26,7 +26,7 @@ public final class ForStmt : Stmt { } public sealed class Stmt { - internal constructor Stmt() + protected constructor Stmt() 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/ExhaustiveOnTree.txt b/compiler/testData/diagnostics/tests/sealed/ExhaustiveOnTree.txt index 2559c794d81..550617693cd 100644 --- a/compiler/testData/diagnostics/tests/sealed/ExhaustiveOnTree.txt +++ b/compiler/testData/diagnostics/tests/sealed/ExhaustiveOnTree.txt @@ -1,7 +1,7 @@ package public sealed class Base { - internal constructor Base() + protected constructor Base() public final fun bar(): kotlin.Int public final fun baz(): kotlin.Int public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean @@ -11,7 +11,7 @@ public sealed class Base { public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String public sealed class A : Base { - internal constructor A() + protected constructor A() public final override /*1*/ /*fake_override*/ fun bar(): kotlin.Int public final override /*1*/ /*fake_override*/ fun baz(): kotlin.Int public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean @@ -32,7 +32,7 @@ public sealed class Base { } public sealed class A2 : Base.A { - internal constructor A2() + protected constructor A2() public final override /*1*/ /*fake_override*/ fun bar(): kotlin.Int public final override /*1*/ /*fake_override*/ fun baz(): kotlin.Int public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean @@ -44,7 +44,7 @@ public sealed class Base { } public sealed class B : Base { - internal constructor B() + protected constructor B() public final override /*1*/ /*fake_override*/ fun bar(): kotlin.Int public final override /*1*/ /*fake_override*/ fun baz(): kotlin.Int public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean @@ -54,7 +54,7 @@ public sealed class Base { public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String public sealed class B1 : Base.B { - internal constructor B1() + protected constructor B1() public final override /*1*/ /*fake_override*/ fun bar(): kotlin.Int public final override /*1*/ /*fake_override*/ fun baz(): kotlin.Int public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean diff --git a/compiler/testData/diagnostics/tests/sealed/ExhaustiveOnTriangleStar.txt b/compiler/testData/diagnostics/tests/sealed/ExhaustiveOnTriangleStar.txt index ed10fcf8de7..f5740263809 100644 --- a/compiler/testData/diagnostics/tests/sealed/ExhaustiveOnTriangleStar.txt +++ b/compiler/testData/diagnostics/tests/sealed/ExhaustiveOnTriangleStar.txt @@ -5,14 +5,14 @@ public fun test2(/*0*/ a: A): kotlin.Any public fun test3(/*0*/ a: A): kotlin.Any public sealed class A { - internal constructor A() + protected constructor A() 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 } public sealed class B : A { - internal constructor B() + protected constructor B() 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/ExhaustiveWhen.txt b/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhen.txt index 6052d5fbd87..65d4e9fdc00 100644 --- a/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhen.txt +++ b/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhen.txt @@ -3,7 +3,7 @@ package public fun foo(/*0*/ s: Sealed): kotlin.Int public sealed class Sealed { - internal constructor Sealed(/*0*/ x: kotlin.Int) + protected constructor Sealed(/*0*/ x: kotlin.Int) public 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 cd86b738170..646192acfe2 100644 --- a/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenDoubleInner.txt +++ b/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenDoubleInner.txt @@ -3,7 +3,7 @@ package public fun foo(/*0*/ s: Sealed): kotlin.Int public sealed class Sealed { - internal constructor Sealed() + protected 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 353be8f9350..ec253e484a0 100644 --- a/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenMultipleInner.txt +++ b/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenMultipleInner.txt @@ -6,7 +6,7 @@ public fun fooWithElse(/*0*/ s: Sealed): kotlin.Int public fun fooWithoutElse(/*0*/ s: Sealed): kotlin.Int public sealed class Sealed { - internal constructor Sealed() + protected 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 6052d5fbd87..65d4e9fdc00 100644 --- a/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenNegated.txt +++ b/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenNegated.txt @@ -3,7 +3,7 @@ package public fun foo(/*0*/ s: Sealed): kotlin.Int public sealed class Sealed { - internal constructor Sealed(/*0*/ x: kotlin.Int) + protected constructor Sealed(/*0*/ x: kotlin.Int) public 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 9822f3cd0f9..29c0361b454 100644 --- a/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenNegatedTwice.txt +++ b/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenNegatedTwice.txt @@ -3,7 +3,7 @@ package public fun foo(/*0*/ s: Sealed): kotlin.Int public sealed class Sealed { - internal constructor Sealed(/*0*/ x: kotlin.Int) + protected constructor Sealed(/*0*/ x: kotlin.Int) public 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 b352827f224..49814aa3f94 100644 --- a/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenOnNestedSealed.txt +++ b/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenOnNestedSealed.txt @@ -3,7 +3,7 @@ package public fun foo(/*0*/ s: Sealed, /*1*/ nf: Sealed.NonFirst): kotlin.Int public sealed class Sealed { - internal constructor Sealed() + protected 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 @@ public sealed class Sealed { } public sealed class NonFirst { - internal constructor NonFirst() + protected 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 3e989e300bb..493d5324277 100644 --- a/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenOnNullable.txt +++ b/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenOnNullable.txt @@ -3,7 +3,7 @@ package public fun foo(/*0*/ s: Sealed?): kotlin.Int public sealed class Sealed { - internal constructor Sealed(/*0*/ x: kotlin.Int) + protected constructor Sealed(/*0*/ x: kotlin.Int) public 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 5abe4e1702c..d7207cf4026 100644 --- a/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenWithAdditionalMember.txt +++ b/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenWithAdditionalMember.txt @@ -3,7 +3,7 @@ package public fun foo(/*0*/ s: Sealed): kotlin.Int public sealed class Sealed { - internal constructor Sealed(/*0*/ x: kotlin.Int) + protected constructor Sealed(/*0*/ x: kotlin.Int) public 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 6052d5fbd87..65d4e9fdc00 100644 --- a/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenWithElse.txt +++ b/compiler/testData/diagnostics/tests/sealed/ExhaustiveWhenWithElse.txt @@ -3,7 +3,7 @@ package public fun foo(/*0*/ s: Sealed): kotlin.Int public sealed class Sealed { - internal constructor Sealed(/*0*/ x: kotlin.Int) + protected constructor Sealed(/*0*/ x: kotlin.Int) public 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/ExhaustiveWithFreedom.txt b/compiler/testData/diagnostics/tests/sealed/ExhaustiveWithFreedom.txt index ca2a9591379..98acc061369 100644 --- a/compiler/testData/diagnostics/tests/sealed/ExhaustiveWithFreedom.txt +++ b/compiler/testData/diagnostics/tests/sealed/ExhaustiveWithFreedom.txt @@ -14,7 +14,7 @@ public final class B : Base { } public sealed class Base { - internal constructor Base() + protected 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/Local.txt b/compiler/testData/diagnostics/tests/sealed/Local.txt index bbb25c8a302..cf186acae6f 100644 --- a/compiler/testData/diagnostics/tests/sealed/Local.txt +++ b/compiler/testData/diagnostics/tests/sealed/Local.txt @@ -1,7 +1,7 @@ package public sealed class Sealed { - internal constructor Sealed() + protected constructor Sealed() public 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/MultipleFiles_enabled.txt b/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.txt index dcfabb459ad..08d57bd8c1f 100644 --- a/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.txt +++ b/compiler/testData/diagnostics/tests/sealed/MultipleFiles_enabled.txt @@ -20,7 +20,7 @@ package foo { } public sealed class Base { - internal constructor Base() + protected 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/NestedSealed.txt b/compiler/testData/diagnostics/tests/sealed/NestedSealed.txt index 10a7db9e368..86fda2408b0 100644 --- a/compiler/testData/diagnostics/tests/sealed/NestedSealed.txt +++ b/compiler/testData/diagnostics/tests/sealed/NestedSealed.txt @@ -5,13 +5,13 @@ public fun foo(/*0*/ b: Base): kotlin.Int public fun gav(/*0*/ b: Base?): kotlin.Int public sealed class Base { - internal constructor Base() + protected 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 public sealed class A : Base { - internal constructor A() + protected constructor A() 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 @@ -32,7 +32,7 @@ public sealed class Base { } public sealed class B : Base { - internal constructor B() + protected constructor B() 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/NestedSealedWithoutRestrictions.txt b/compiler/testData/diagnostics/tests/sealed/NestedSealedWithoutRestrictions.txt index 319749dd71b..c7af0a0265a 100644 --- a/compiler/testData/diagnostics/tests/sealed/NestedSealedWithoutRestrictions.txt +++ b/compiler/testData/diagnostics/tests/sealed/NestedSealedWithoutRestrictions.txt @@ -38,7 +38,7 @@ package foo { public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String public sealed class Base { - internal constructor Base() + protected 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/NeverConstructed.txt b/compiler/testData/diagnostics/tests/sealed/NeverConstructed.txt index f210e874257..4da34c6bf43 100644 --- a/compiler/testData/diagnostics/tests/sealed/NeverConstructed.txt +++ b/compiler/testData/diagnostics/tests/sealed/NeverConstructed.txt @@ -1,7 +1,7 @@ package public sealed class Base { - internal constructor Base() + protected constructor Base() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public final fun foo(): Base public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/tests/sealed/NeverDerivedFromNested.txt b/compiler/testData/diagnostics/tests/sealed/NeverDerivedFromNested.txt index faaa729b10a..7d5b241b972 100644 --- a/compiler/testData/diagnostics/tests/sealed/NeverDerivedFromNested.txt +++ b/compiler/testData/diagnostics/tests/sealed/NeverDerivedFromNested.txt @@ -9,7 +9,7 @@ public final class A { public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String public sealed class Base { - internal constructor Base() + protected 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 4f963ec4c07..46eb741a0f0 100644 --- a/compiler/testData/diagnostics/tests/sealed/NeverFinal.txt +++ b/compiler/testData/diagnostics/tests/sealed/NeverFinal.txt @@ -1,7 +1,7 @@ package public sealed class Base { - internal constructor Base() + protected 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 4f963ec4c07..46eb741a0f0 100644 --- a/compiler/testData/diagnostics/tests/sealed/NeverOpen.txt +++ b/compiler/testData/diagnostics/tests/sealed/NeverOpen.txt @@ -1,7 +1,7 @@ package public sealed class Base { - internal constructor Base() + protected 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 6052d5fbd87..65d4e9fdc00 100644 --- a/compiler/testData/diagnostics/tests/sealed/NonExhaustiveWhen.txt +++ b/compiler/testData/diagnostics/tests/sealed/NonExhaustiveWhen.txt @@ -3,7 +3,7 @@ package public fun foo(/*0*/ s: Sealed): kotlin.Int public sealed class Sealed { - internal constructor Sealed(/*0*/ x: kotlin.Int) + protected constructor Sealed(/*0*/ x: kotlin.Int) public 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 6052d5fbd87..65d4e9fdc00 100644 --- a/compiler/testData/diagnostics/tests/sealed/NonExhaustiveWhenNegated.txt +++ b/compiler/testData/diagnostics/tests/sealed/NonExhaustiveWhenNegated.txt @@ -3,7 +3,7 @@ package public fun foo(/*0*/ s: Sealed): kotlin.Int public sealed class Sealed { - internal constructor Sealed(/*0*/ x: kotlin.Int) + protected constructor Sealed(/*0*/ x: kotlin.Int) public 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 33444b8be1b..062a84e7cb4 100644 --- a/compiler/testData/diagnostics/tests/sealed/NonExhaustiveWhenWithAdditionalCase.txt +++ b/compiler/testData/diagnostics/tests/sealed/NonExhaustiveWhenWithAdditionalCase.txt @@ -3,7 +3,7 @@ package public fun foo(/*0*/ s: Sealed): kotlin.Int public sealed class Sealed { - internal constructor Sealed(/*0*/ x: kotlin.Int) + protected constructor Sealed(/*0*/ x: kotlin.Int) public 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 fa27bc4811d..f5f1ba57a6d 100644 --- a/compiler/testData/diagnostics/tests/sealed/NonExhaustiveWhenWithAnyCase.txt +++ b/compiler/testData/diagnostics/tests/sealed/NonExhaustiveWhenWithAnyCase.txt @@ -3,7 +3,7 @@ package public fun foo(/*0*/ s: Sealed): kotlin.Int public sealed class Sealed { - internal constructor Sealed() + protected 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/NonPrivateConstructor.txt b/compiler/testData/diagnostics/tests/sealed/NonPrivateConstructor.txt index 18a46c7808f..1d5b1a0cff8 100644 --- a/compiler/testData/diagnostics/tests/sealed/NonPrivateConstructor.txt +++ b/compiler/testData/diagnostics/tests/sealed/NonPrivateConstructor.txt @@ -3,7 +3,7 @@ package public sealed class Sealed { public constructor Sealed() protected constructor Sealed(/*0*/ x: kotlin.Int) - internal constructor Sealed(/*0*/ y: kotlin.Int, /*1*/ z: kotlin.Int) + protected constructor Sealed(/*0*/ y: kotlin.Int, /*1*/ z: kotlin.Int) public 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/NotFinal.txt b/compiler/testData/diagnostics/tests/sealed/NotFinal.txt index 23ce8ce7f29..5fb316f0061 100644 --- a/compiler/testData/diagnostics/tests/sealed/NotFinal.txt +++ b/compiler/testData/diagnostics/tests/sealed/NotFinal.txt @@ -3,7 +3,7 @@ package public fun doit(/*0*/ arg: T): T public sealed class Foo { - internal constructor Foo() + protected constructor Foo() 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 cebdb6ea323..b33e17253b1 100644 --- a/compiler/testData/diagnostics/tests/sealed/OperationWhen.txt +++ b/compiler/testData/diagnostics/tests/sealed/OperationWhen.txt @@ -3,7 +3,7 @@ package public fun priority(/*0*/ op: Operation): kotlin.Int public sealed class Operation { - internal constructor Operation(/*0*/ left: kotlin.Int, /*1*/ right: kotlin.Int) + protected constructor Operation(/*0*/ left: kotlin.Int, /*1*/ right: kotlin.Int) public final val left: kotlin.Int public 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 4f963ec4c07..46eb741a0f0 100644 --- a/compiler/testData/diagnostics/tests/sealed/RedundantAbstract.txt +++ b/compiler/testData/diagnostics/tests/sealed/RedundantAbstract.txt @@ -1,7 +1,7 @@ package public sealed class Base { - internal constructor Base() + protected 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 0b16ddc38f4..02411f9ef20 100644 --- a/compiler/testData/diagnostics/tests/sealed/TreeWhen.txt +++ b/compiler/testData/diagnostics/tests/sealed/TreeWhen.txt @@ -1,7 +1,7 @@ package public sealed class Tree { - internal constructor Tree() + protected 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 public final fun max(): kotlin.Int diff --git a/compiler/testData/diagnostics/tests/sealed/TreeWhenFunctional.txt b/compiler/testData/diagnostics/tests/sealed/TreeWhenFunctional.txt index 0b16ddc38f4..02411f9ef20 100644 --- a/compiler/testData/diagnostics/tests/sealed/TreeWhenFunctional.txt +++ b/compiler/testData/diagnostics/tests/sealed/TreeWhenFunctional.txt @@ -1,7 +1,7 @@ package public sealed class Tree { - internal constructor Tree() + protected 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 public final fun max(): kotlin.Int diff --git a/compiler/testData/diagnostics/tests/sealed/TreeWhenFunctionalNoIs.txt b/compiler/testData/diagnostics/tests/sealed/TreeWhenFunctionalNoIs.txt index 64955fd0483..44fa55952bc 100644 --- a/compiler/testData/diagnostics/tests/sealed/TreeWhenFunctionalNoIs.txt +++ b/compiler/testData/diagnostics/tests/sealed/TreeWhenFunctionalNoIs.txt @@ -1,7 +1,7 @@ package public sealed class Tree { - internal constructor Tree() + protected 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 public final fun max(): kotlin.Int diff --git a/compiler/testData/diagnostics/tests/sealed/WhenOnEmptySealed.txt b/compiler/testData/diagnostics/tests/sealed/WhenOnEmptySealed.txt index 50319d715ed..db360066c7f 100644 --- a/compiler/testData/diagnostics/tests/sealed/WhenOnEmptySealed.txt +++ b/compiler/testData/diagnostics/tests/sealed/WhenOnEmptySealed.txt @@ -3,7 +3,7 @@ package public fun foo(/*0*/ s: Sealed): kotlin.Int public sealed class Sealed { - internal constructor Sealed() + protected 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/WithInterface.txt b/compiler/testData/diagnostics/tests/sealed/WithInterface.txt index 62bb5d50b1f..8b8ea324fdf 100644 --- a/compiler/testData/diagnostics/tests/sealed/WithInterface.txt +++ b/compiler/testData/diagnostics/tests/sealed/WithInterface.txt @@ -9,7 +9,7 @@ public interface Child : Parent { } public sealed class Page : Parent { - internal constructor Page() + protected constructor Page() 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/inheritorInDifferentModule.kt b/compiler/testData/diagnostics/tests/sealed/inheritorInDifferentModule.kt index b1204703749..0942b62225f 100644 --- a/compiler/testData/diagnostics/tests/sealed/inheritorInDifferentModule.kt +++ b/compiler/testData/diagnostics/tests/sealed/inheritorInDifferentModule.kt @@ -14,4 +14,4 @@ class A : Base() package a -class B : Base() +class B : Base() diff --git a/compiler/testData/diagnostics/tests/sealed/inheritorInDifferentModule.txt b/compiler/testData/diagnostics/tests/sealed/inheritorInDifferentModule.txt index 334e5f75c20..f3a8eb1d81a 100644 --- a/compiler/testData/diagnostics/tests/sealed/inheritorInDifferentModule.txt +++ b/compiler/testData/diagnostics/tests/sealed/inheritorInDifferentModule.txt @@ -11,7 +11,7 @@ package a { } public sealed class Base { - internal constructor Base() + protected 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/interfaces/simpleSealedInterface.txt b/compiler/testData/diagnostics/tests/sealed/interfaces/simpleSealedInterface.txt index 1cc0a6b869a..dc7af7b2bc0 100644 --- a/compiler/testData/diagnostics/tests/sealed/interfaces/simpleSealedInterface.txt +++ b/compiler/testData/diagnostics/tests/sealed/interfaces/simpleSealedInterface.txt @@ -10,7 +10,7 @@ public interface A : Base { } public sealed class B : Base { - internal constructor B() + protected constructor B() 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/kt44316.txt b/compiler/testData/diagnostics/tests/sealed/kt44316.txt index 6e077339484..a668f2115fb 100644 --- a/compiler/testData/diagnostics/tests/sealed/kt44316.txt +++ b/compiler/testData/diagnostics/tests/sealed/kt44316.txt @@ -1,7 +1,7 @@ package public sealed class Base { - internal constructor Base() + protected 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/kt44861.fir.kt b/compiler/testData/diagnostics/tests/sealed/kt44861.fir.kt new file mode 100644 index 00000000000..9e13166b1ce --- /dev/null +++ b/compiler/testData/diagnostics/tests/sealed/kt44861.fir.kt @@ -0,0 +1,17 @@ +// ISSUE: KT-44861 +// DIAGNOSTICS: -UNUSED_VARIABLE + +sealed class Foo() { + class A : Foo() + class B : Foo() +} + +fun Foo(kind: String = "A"): Foo = when (kind) { + "A" -> Foo.A() + "B" -> Foo.B() + else -> throw Exception() +} + +fun main() { + val foo = Foo() +} diff --git a/compiler/testData/diagnostics/tests/sealed/kt44861.kt b/compiler/testData/diagnostics/tests/sealed/kt44861.kt new file mode 100644 index 00000000000..72198eaf079 --- /dev/null +++ b/compiler/testData/diagnostics/tests/sealed/kt44861.kt @@ -0,0 +1,17 @@ +// ISSUE: KT-44861 +// DIAGNOSTICS: -UNUSED_VARIABLE + +sealed class Foo() { + class A : Foo() + class B : Foo() +} + +fun Foo(kind: String = "A"): Foo = when (kind) { + "A" -> Foo.A() + "B" -> Foo.B() + else -> throw Exception() +} + +fun main() { + val foo = Foo() +} diff --git a/compiler/testData/diagnostics/tests/sealed/kt44861.txt b/compiler/testData/diagnostics/tests/sealed/kt44861.txt new file mode 100644 index 00000000000..01283f193ca --- /dev/null +++ b/compiler/testData/diagnostics/tests/sealed/kt44861.txt @@ -0,0 +1,26 @@ +package + +public fun Foo(/*0*/ kind: kotlin.String = ...): Foo +public fun main(): kotlin.Unit + +public sealed class Foo { + protected constructor Foo() + 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 + + public final class A : Foo { + public constructor A() + 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 + } + + public final class B : Foo { + public constructor B() + 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/smartCasts/fakeSmartCastOnEquality.txt b/compiler/testData/diagnostics/tests/smartCasts/fakeSmartCastOnEquality.txt index 37cc7ceaaf3..3c13604bec0 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/fakeSmartCastOnEquality.txt +++ b/compiler/testData/diagnostics/tests/smartCasts/fakeSmartCastOnEquality.txt @@ -65,7 +65,7 @@ public open class OpenClass2 { } public sealed class Sealed { - internal constructor Sealed() + protected constructor Sealed() public final fun check(/*0*/ arg: Sealed.Sealed1): kotlin.Unit public open override /*1*/ 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/smartCasts/openInSealed.txt b/compiler/testData/diagnostics/tests/smartCasts/openInSealed.txt index 050f6bbc035..fb117bcb527 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/openInSealed.txt +++ b/compiler/testData/diagnostics/tests/smartCasts/openInSealed.txt @@ -1,7 +1,7 @@ package public sealed class My { - internal constructor My(/*0*/ x: kotlin.Int?) + protected constructor My(/*0*/ x: kotlin.Int?) public open 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/tailRecOnVirtualMember.txt b/compiler/testData/diagnostics/tests/tailRecOnVirtualMember.txt index 1860f2bcccb..c1e5c96e5d9 100644 --- a/compiler/testData/diagnostics/tests/tailRecOnVirtualMember.txt +++ b/compiler/testData/diagnostics/tests/tailRecOnVirtualMember.txt @@ -51,7 +51,7 @@ public object D : A { } public sealed class E : A { - internal constructor E() + protected constructor E() internal final override /*1*/ tailrec /*fake_override*/ fun baa(/*0*/ y: kotlin.Int): kotlin.Unit internal open override /*1*/ tailrec fun bar(/*0*/ y: kotlin.Int): kotlin.Unit protected open override /*1*/ tailrec fun baz(/*0*/ y: kotlin.Int): kotlin.Unit diff --git a/compiler/testData/diagnostics/tests/tailRecOnVirtualMemberError.txt b/compiler/testData/diagnostics/tests/tailRecOnVirtualMemberError.txt index 1860f2bcccb..c1e5c96e5d9 100644 --- a/compiler/testData/diagnostics/tests/tailRecOnVirtualMemberError.txt +++ b/compiler/testData/diagnostics/tests/tailRecOnVirtualMemberError.txt @@ -51,7 +51,7 @@ public object D : A { } public sealed class E : A { - internal constructor E() + protected constructor E() internal final override /*1*/ tailrec /*fake_override*/ fun baa(/*0*/ y: kotlin.Int): kotlin.Unit internal open override /*1*/ tailrec fun bar(/*0*/ y: kotlin.Int): kotlin.Unit protected open override /*1*/ tailrec fun baz(/*0*/ y: kotlin.Int): kotlin.Unit diff --git a/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorWrongClass.kt b/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorWrongClass.kt index e0ea89e6131..cafaeda2aa2 100644 --- a/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorWrongClass.kt +++ b/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorWrongClass.kt @@ -17,8 +17,8 @@ val test3a = EnumClass()Test4() -val test4a = SealedClass() +val test4 = Test4() +val test4a = SealedClass() class Outer { inner class Inner diff --git a/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorWrongClass.txt b/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorWrongClass.txt index 766cd3606c4..9abd398cf90 100644 --- a/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorWrongClass.txt +++ b/compiler/testData/diagnostics/tests/typealias/typeAliasConstructorWrongClass.txt @@ -66,7 +66,7 @@ public final class Outer { } public sealed class SealedClass { - internal constructor SealedClass() + protected constructor SealedClass() 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/valueClasses/valueClassDeclarationCheck.txt b/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.txt index 432311e420f..3441adc1500 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.txt +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.txt @@ -152,7 +152,7 @@ package kotlin { } public sealed value class D3 { - internal constructor D3(/*0*/ x: kotlin.Int) + protected constructor D3(/*0*/ x: kotlin.Int) public final val x: kotlin.Int public open override /*1*/ /*synthesized*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*synthesized*/ fun hashCode(): kotlin.Int diff --git a/compiler/testData/diagnostics/tests/when/NonExhaustiveWarningForSealedClass.txt b/compiler/testData/diagnostics/tests/when/NonExhaustiveWarningForSealedClass.txt index 7a7ce296cff..cbb2008f73a 100644 --- a/compiler/testData/diagnostics/tests/when/NonExhaustiveWarningForSealedClass.txt +++ b/compiler/testData/diagnostics/tests/when/NonExhaustiveWarningForSealedClass.txt @@ -26,7 +26,7 @@ public object Last : S { } public sealed class S { - internal constructor S() + protected constructor S() 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/when/RedundantElse.txt b/compiler/testData/diagnostics/tests/when/RedundantElse.txt index 70da44887fa..95ad6de9dad 100644 --- a/compiler/testData/diagnostics/tests/when/RedundantElse.txt +++ b/compiler/testData/diagnostics/tests/when/RedundantElse.txt @@ -50,7 +50,7 @@ public final enum class MyEnum : kotlin.Enum { } public sealed class X { - internal constructor X() + protected constructor X() 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/when/TopLevelSealed.txt b/compiler/testData/diagnostics/tests/when/TopLevelSealed.txt index 888bd637178..54f30dbde5a 100644 --- a/compiler/testData/diagnostics/tests/when/TopLevelSealed.txt +++ b/compiler/testData/diagnostics/tests/when/TopLevelSealed.txt @@ -3,7 +3,7 @@ package public fun test(/*0*/ a: A): kotlin.Unit public sealed class A { - internal constructor A() + protected constructor A() 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/when/withSubjectVariable/smartcastToSealed.txt b/compiler/testData/diagnostics/tests/when/withSubjectVariable/smartcastToSealed.txt index deebd0be736..19381b112ee 100644 --- a/compiler/testData/diagnostics/tests/when/withSubjectVariable/smartcastToSealed.txt +++ b/compiler/testData/diagnostics/tests/when/withSubjectVariable/smartcastToSealed.txt @@ -4,7 +4,7 @@ public fun testSmartcastToSealedInSubjectInitializer1(/*0*/ x: kotlin.Any?): kot public fun testSmartcastToSealedInSubjectInitializer2(/*0*/ x: kotlin.Any?): kotlin.Unit public sealed class Either { - internal constructor Either() + protected constructor Either() 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/testsWithStdLib/annotations/jvmDefault/allCompatibility/specialization.txt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/allCompatibility/specialization.txt index 64beffedaa0..514244d4f68 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/allCompatibility/specialization.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmDefault/allCompatibility/specialization.txt @@ -120,7 +120,7 @@ private final class Outer { } public sealed class SealedSpecialized : Foo { - internal constructor SealedSpecialized() + protected constructor SealedSpecialized() public open override /*1*/ /*fake_override*/ val kotlin.String.prop: kotlin.String 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/testsWithStdLib/inference/performance/kt41644.txt b/compiler/testData/diagnostics/testsWithStdLib/inference/performance/kt41644.txt index 46c0ad5c342..fe0c53963a4 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/inference/performance/kt41644.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/performance/kt41644.txt @@ -3,13 +3,13 @@ package public fun , /*2*/ B, /*3*/ DB : DataType, /*4*/ C, /*5*/ DC : DataType, /*6*/ D, /*7*/ DD : DataType, /*8*/ E, /*9*/ DE : DataType, /*10*/ F, /*11*/ DF : DataType, /*12*/ G, /*13*/ DG : DataType, /*14*/ H, /*15*/ DH : DataType> either8(/*0*/ firstName: kotlin.String, /*1*/ firstType: DA, /*2*/ secondName: kotlin.String, /*3*/ secondType: DB, /*4*/ thirdName: kotlin.String, /*5*/ thirdType: DC, /*6*/ fourthName: kotlin.String, /*7*/ fourthType: DD, /*8*/ fifthName: kotlin.String, /*9*/ fifthType: DE, /*10*/ sixthName: kotlin.String, /*11*/ sixthType: DF, /*12*/ seventhName: kotlin.String, /*13*/ seventhType: DG, /*14*/ eighthName: kotlin.String, /*15*/ eighthType: DH): DataType.NotNull.Partial> public sealed class DataType { - internal constructor DataType() + protected constructor DataType() 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 public sealed class NotNull : DataType { - internal constructor NotNull() + protected constructor NotNull() 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/testsWithStdLib/inference/performance/kt42195.txt b/compiler/testData/diagnostics/testsWithStdLib/inference/performance/kt42195.txt index f6134461709..6720fe7c2d1 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/inference/performance/kt42195.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/performance/kt42195.txt @@ -3,7 +3,7 @@ package public val tree: Tree.Inner public sealed class Tree { - internal constructor Tree() + protected constructor Tree() public abstract val children: kotlin.collections.Map> public abstract val value: TCommon public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean diff --git a/compiler/testData/ir/irText/classes/sealedClasses.kt.txt b/compiler/testData/ir/irText/classes/sealedClasses.kt.txt index bd162164659..a902da26199 100644 --- a/compiler/testData/ir/irText/classes/sealedClasses.kt.txt +++ b/compiler/testData/ir/irText/classes/sealedClasses.kt.txt @@ -1,5 +1,5 @@ sealed class Expr { - internal constructor() /* primary */ { + protected constructor() /* primary */ { super/*Any*/() /* () */ diff --git a/compiler/testData/ir/irText/classes/sealedClasses.txt b/compiler/testData/ir/irText/classes/sealedClasses.txt index f8234fa55d8..b4d45345d9a 100644 --- a/compiler/testData/ir/irText/classes/sealedClasses.txt +++ b/compiler/testData/ir/irText/classes/sealedClasses.txt @@ -1,7 +1,7 @@ FILE fqName: fileName:/sealedClasses.kt CLASS CLASS name:Expr modality:SEALED visibility:public superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Expr - CONSTRUCTOR visibility:internal <> () returnType:.Expr [primary] + CONSTRUCTOR visibility:protected <> () returnType:.Expr [primary] BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Expr modality:SEALED visibility:public superTypes:[kotlin.Any]' @@ -10,7 +10,7 @@ FILE fqName: fileName:/sealedClasses.kt CONSTRUCTOR visibility:public <> (number:kotlin.Double) returnType:.Expr.Const [primary] VALUE_PARAMETER name:number index:0 type:kotlin.Double BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'internal constructor () [primary] declared in .Expr' + DELEGATING_CONSTRUCTOR_CALL 'protected constructor () [primary] declared in .Expr' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Const modality:FINAL visibility:public superTypes:[.Expr]' PROPERTY name:number visibility:public modality:FINAL [val] FIELD PROPERTY_BACKING_FIELD name:number type:kotlin.Double visibility:private [final] @@ -42,7 +42,7 @@ FILE fqName: fileName:/sealedClasses.kt VALUE_PARAMETER name:e1 index:0 type:.Expr VALUE_PARAMETER name:e2 index:1 type:.Expr BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'internal constructor () [primary] declared in .Expr' + DELEGATING_CONSTRUCTOR_CALL 'protected constructor () [primary] declared in .Expr' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Sum modality:FINAL visibility:public superTypes:[.Expr]' PROPERTY name:e1 visibility:public modality:FINAL [val] FIELD PROPERTY_BACKING_FIELD name:e1 type:.Expr visibility:private [final] @@ -83,7 +83,7 @@ FILE fqName: fileName:/sealedClasses.kt $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Expr.NotANumber CONSTRUCTOR visibility:private <> () returnType:.Expr.NotANumber [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'internal constructor () [primary] declared in .Expr' + DELEGATING_CONSTRUCTOR_CALL 'protected constructor () [primary] declared in .Expr' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:NotANumber modality:FINAL visibility:public superTypes:[.Expr]' FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: diff --git a/compiler/testData/ir/irText/declarations/multiplatform/expectedSealedClass.kt.txt b/compiler/testData/ir/irText/declarations/multiplatform/expectedSealedClass.kt.txt index 8e4b78d0641..17913f80757 100644 --- a/compiler/testData/ir/irText/declarations/multiplatform/expectedSealedClass.kt.txt +++ b/compiler/testData/ir/irText/declarations/multiplatform/expectedSealedClass.kt.txt @@ -1,5 +1,5 @@ expect sealed class Ops { - internal expect constructor() /* primary */ + protected expect constructor() /* primary */ } @@ -9,7 +9,7 @@ expect class Add : Ops { } sealed class Ops { - internal constructor() /* primary */ { + protected constructor() /* primary */ { super/*Any*/() /* () */ diff --git a/compiler/testData/ir/irText/declarations/multiplatform/expectedSealedClass.txt b/compiler/testData/ir/irText/declarations/multiplatform/expectedSealedClass.txt index 5d65736964f..6fc0053b071 100644 --- a/compiler/testData/ir/irText/declarations/multiplatform/expectedSealedClass.txt +++ b/compiler/testData/ir/irText/declarations/multiplatform/expectedSealedClass.txt @@ -1,7 +1,7 @@ FILE fqName: fileName:/expectedSealedClass.kt CLASS CLASS name:Ops modality:SEALED visibility:public [expect] superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Ops - CONSTRUCTOR visibility:internal <> () returnType:.Ops [primary,expect] + CONSTRUCTOR visibility:protected <> () returnType:.Ops [primary,expect] FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any @@ -33,7 +33,7 @@ FILE fqName: fileName:/expectedSealedClass.kt $this: VALUE_PARAMETER name: type:kotlin.Any CLASS CLASS name:Ops modality:SEALED visibility:public superTypes:[kotlin.Any] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Ops - CONSTRUCTOR visibility:internal <> () returnType:.Ops [primary] + CONSTRUCTOR visibility:protected <> () returnType:.Ops [primary] BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Ops modality:SEALED visibility:public superTypes:[kotlin.Any]' @@ -54,7 +54,7 @@ FILE fqName: fileName:/expectedSealedClass.kt $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:.Add CONSTRUCTOR visibility:public <> () returnType:.Add [primary] BLOCK_BODY - DELEGATING_CONSTRUCTOR_CALL 'internal constructor () [primary] declared in .Ops' + DELEGATING_CONSTRUCTOR_CALL 'protected constructor () [primary] declared in .Ops' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Add modality:FINAL visibility:public superTypes:[.Ops]' FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] overridden: diff --git a/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/HiddenConstructorWithInlineClassParameters.txt b/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/HiddenConstructorWithInlineClassParameters.txt index 50112e06d47..2bf9c168f9b 100644 --- a/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/HiddenConstructorWithInlineClassParameters.txt +++ b/compiler/testData/loadJava/compiledKotlin/annotations/classMembers/HiddenConstructorWithInlineClassParameters.txt @@ -5,7 +5,7 @@ public final annotation class Ann : kotlin.Annotation { } public sealed class Sealed { - /*primary*/ @test.Ann internal constructor Sealed(/*0*/ @test.Ann z: test.Z) + /*primary*/ @test.Ann protected constructor Sealed(/*0*/ @test.Ann z: test.Z) public final val z: test.Z public final fun (): test.Z diff --git a/compiler/testData/loadJava/compiledKotlin/class/SealedClass.txt b/compiler/testData/loadJava/compiledKotlin/class/SealedClass.txt index af4e2a97b3e..a1a8bffe248 100644 --- a/compiler/testData/loadJava/compiledKotlin/class/SealedClass.txt +++ b/compiler/testData/loadJava/compiledKotlin/class/SealedClass.txt @@ -9,7 +9,7 @@ public final class Inheritor3 : test.SealedClass { } public sealed class SealedClass { - /*primary*/ internal constructor SealedClass() + /*primary*/ protected constructor SealedClass() public final class Inheritor1 : test.SealedClass { /*primary*/ public constructor Inheritor1() diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java index 9ab80c8a85b..f0355b8a1ec 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java @@ -24487,6 +24487,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/sealed/kt44316.kt"); } + @Test + @TestMetadata("kt44861.kt") + public void testKt44861() throws Exception { + runTest("compiler/testData/diagnostics/tests/sealed/kt44861.kt"); + } + @Test @TestMetadata("Local.kt") public void testLocal() throws Exception { diff --git a/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.java b/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.java index 51f6c92f8f2..effc64e6849 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.java +++ b/core/descriptors/src/org/jetbrains/kotlin/resolve/DescriptorUtils.java @@ -390,7 +390,7 @@ public class DescriptorUtils { } if (isSealedClass(classDescriptor)) { if (freedomForSealedInterfacesSupported) { - return DescriptorVisibilities.INTERNAL; + return DescriptorVisibilities.PROTECTED; } else { return DescriptorVisibilities.PRIVATE; } diff --git a/idea/testData/decompiler/stubBuilder/Sealed/Sealed.txt b/idea/testData/decompiler/stubBuilder/Sealed/Sealed.txt index 97af5678c57..ba85febe4fc 100644 --- a/idea/testData/decompiler/stubBuilder/Sealed/Sealed.txt +++ b/idea/testData/decompiler/stubBuilder/Sealed/Sealed.txt @@ -5,7 +5,7 @@ PsiJetFileStubImpl[package=test] CLASS[fqName=test.Sealed, isEnumEntry=false, isInterface=false, isLocal=false, isTopLevel=true, name=Sealed, superNames=[]] MODIFIER_LIST[public sealed] PRIMARY_CONSTRUCTOR - MODIFIER_LIST[internal] + MODIFIER_LIST[protected] VALUE_PARAMETER_LIST CLASS_BODY CLASS[fqName=test.Sealed.Nested, isEnumEntry=false, isInterface=false, isLocal=false, isTopLevel=false, name=Nested, superNames=[Sealed]] diff --git a/idea/testData/quickfix/addDataModifier/sealed.kt b/idea/testData/quickfix/addDataModifier/sealed.kt index 9ed02042cc2..5e413353fb7 100644 --- a/idea/testData/quickfix/addDataModifier/sealed.kt +++ b/idea/testData/quickfix/addDataModifier/sealed.kt @@ -5,6 +5,7 @@ // ACTION: Create member function 'Foo.component2' // ACTION: Enable a trailing comma by default in the formatter // ACTION: Put arguments on separate lines +// ERROR: Cannot access '': it is protected in 'Foo' // ERROR: Destructuring declaration initializer of type Foo must have a 'component1()' function // ERROR: Destructuring declaration initializer of type Foo must have a 'component2()' function // ERROR: Sealed types cannot be instantiated diff --git a/libraries/tools/kotlinp/testData/NestedClasses.txt b/libraries/tools/kotlinp/testData/NestedClasses.txt index 0e604d1bc9e..ac02ec4c155 100644 --- a/libraries/tools/kotlinp/testData/NestedClasses.txt +++ b/libraries/tools/kotlinp/testData/NestedClasses.txt @@ -55,7 +55,7 @@ public final enum class A.D.E : kotlin/Enum { public sealed class A.D.F : kotlin/Any { // signature: ()V - internal constructor() + protected constructor() // nested class: G