提交 7c61ddc7 编写于 作者: D Dmitriy Novozhilov 提交者: TeamCityServer

[FE] Allow declaring protected constructors in sealed classes

#KT-44865 Fixed
上级 f3a8fcae
...@@ -24511,6 +24511,18 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti ...@@ -24511,6 +24511,18 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
runTest("compiler/testData/diagnostics/tests/sealed/OperationWhen.kt"); runTest("compiler/testData/diagnostics/tests/sealed/OperationWhen.kt");
} }
@Test
@TestMetadata("protectedConstructors_disabled.kt")
public void testProtectedConstructors_disabled() throws Exception {
runTest("compiler/testData/diagnostics/tests/sealed/protectedConstructors_disabled.kt");
}
@Test
@TestMetadata("protectedConstructors_enabled.kt")
public void testProtectedConstructors_enabled() throws Exception {
runTest("compiler/testData/diagnostics/tests/sealed/protectedConstructors_enabled.kt");
}
@Test @Test
@TestMetadata("RedundantAbstract.kt") @TestMetadata("RedundantAbstract.kt")
public void testRedundantAbstract() throws Exception { public void testRedundantAbstract() throws Exception {
...@@ -346,6 +346,7 @@ public interface Errors { ...@@ -346,6 +346,7 @@ public interface Errors {
DiagnosticFactory0<PsiElement> NON_PRIVATE_CONSTRUCTOR_IN_ENUM = DiagnosticFactory0.create(ERROR); DiagnosticFactory0<PsiElement> NON_PRIVATE_CONSTRUCTOR_IN_ENUM = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<PsiElement> NON_PRIVATE_CONSTRUCTOR_IN_SEALED = DiagnosticFactory0.create(ERROR); DiagnosticFactory0<PsiElement> NON_PRIVATE_CONSTRUCTOR_IN_SEALED = DiagnosticFactory0.create(ERROR);
DiagnosticFactory0<PsiElement> NON_PRIVATE_OR_PROTECTED_CONSTRUCTOR_IN_SEALED = DiagnosticFactory0.create(ERROR);
// Inline and value classes // Inline and value classes
......
...@@ -705,6 +705,7 @@ public class DefaultErrorMessages { ...@@ -705,6 +705,7 @@ public class DefaultErrorMessages {
MAP.put(NON_PRIVATE_CONSTRUCTOR_IN_ENUM, "Constructor must be private in enum class"); MAP.put(NON_PRIVATE_CONSTRUCTOR_IN_ENUM, "Constructor must be private in enum class");
MAP.put(NON_PRIVATE_CONSTRUCTOR_IN_SEALED, "Constructor must be private in sealed class"); MAP.put(NON_PRIVATE_CONSTRUCTOR_IN_SEALED, "Constructor must be private in sealed class");
MAP.put(NON_PRIVATE_OR_PROTECTED_CONSTRUCTOR_IN_SEALED, "Constructor must be private or protected in sealed class");
MAP.put(INLINE_CLASS_NOT_TOP_LEVEL, "Inline classes cannot be local or inner"); MAP.put(INLINE_CLASS_NOT_TOP_LEVEL, "Inline classes cannot be local or inner");
MAP.put(INLINE_CLASS_NOT_FINAL, "Inline classes can be only final"); MAP.put(INLINE_CLASS_NOT_FINAL, "Inline classes can be only final");
......
...@@ -289,12 +289,22 @@ class DeclarationsChecker( ...@@ -289,12 +289,22 @@ class DeclarationsChecker(
private fun checkConstructorVisibility(constructorDescriptor: ClassConstructorDescriptor, declaration: KtDeclaration) { private fun checkConstructorVisibility(constructorDescriptor: ClassConstructorDescriptor, declaration: KtDeclaration) {
val visibilityModifier = declaration.visibilityModifier() val visibilityModifier = declaration.visibilityModifier()
if (visibilityModifier != null && visibilityModifier.node?.elementType != KtTokens.PRIVATE_KEYWORD) { val visibilityKeyword = visibilityModifier?.node?.elementType ?: return
val classDescriptor = constructorDescriptor.containingDeclaration val classDescriptor = constructorDescriptor.containingDeclaration
if (classDescriptor.kind == ClassKind.ENUM_CLASS) {
when {
classDescriptor.kind == ClassKind.ENUM_CLASS -> {
if (visibilityKeyword != KtTokens.PRIVATE_KEYWORD) {
trace.report(NON_PRIVATE_CONSTRUCTOR_IN_ENUM.on(visibilityModifier)) trace.report(NON_PRIVATE_CONSTRUCTOR_IN_ENUM.on(visibilityModifier))
} else if (classDescriptor.modality == Modality.SEALED) { }
trace.report(NON_PRIVATE_CONSTRUCTOR_IN_SEALED.on(visibilityModifier)) }
classDescriptor.modality == Modality.SEALED -> {
val protectedIsAllowed =
languageVersionSettings.supportsFeature(LanguageFeature.AllowSealedInheritorsInDifferentFilesOfSamePackage)
if (!(visibilityKeyword == KtTokens.PRIVATE_KEYWORD || (protectedIsAllowed && visibilityKeyword == KtTokens.PROTECTED_KEYWORD))) {
val factory = if (protectedIsAllowed) NON_PRIVATE_OR_PROTECTED_CONSTRUCTOR_IN_SEALED else NON_PRIVATE_CONSTRUCTOR_IN_SEALED
trace.report(factory.on(visibilityModifier))
}
} }
} }
} }
......
sealed class Sealed <!NON_PRIVATE_CONSTRUCTOR_IN_SEALED!>protected<!> constructor(val x: Int) { sealed class Sealed protected constructor(val x: Int) {
object FIRST : Sealed() object FIRST : Sealed()
<!NON_PRIVATE_CONSTRUCTOR_IN_SEALED!>public<!> constructor(): this(42) <!NON_PRIVATE_OR_PROTECTED_CONSTRUCTOR_IN_SEALED!>public<!> constructor(): this(42)
constructor(y: Int, z: Int): this(y + z) constructor(y: Int, z: Int): this(y + z)
} }
// LANGUAGE: -AllowSealedInheritorsInDifferentFilesOfSamePackage
// DIAGNOSTICS: -UNUSED_PARAMETER
sealed class Case1(val x: Int) {
<!NON_PRIVATE_CONSTRUCTOR_IN_SEALED!>protected constructor(s: String) : this(s.length)<!>
class Inheritor1 : Case1(10)
class Inheritor2 : Case1("Hello")
}
sealed class Case2 <!NON_PRIVATE_CONSTRUCTOR_IN_SEALED!>protected constructor(val x: Int)<!> {
<!NON_PRIVATE_CONSTRUCTOR_IN_SEALED!>protected constructor(s: String) : this(s.length)<!>
class Inheritor1 : Case2(10)
class Inheritor2 : Case2("Hello")
}
sealed class Case3 private constructor(val x: Int) {
<!NON_PRIVATE_CONSTRUCTOR_IN_SEALED!>protected constructor(s: String) : this(s.length)<!>
class Inheritor1 : Case3(10) // should OK
class Inheritor2 : Case3("Hello")
}
class Case3Inheritor3 : <!INAPPLICABLE_CANDIDATE!>Case3<!>(20) // should be an error in 1.6 (?)
sealed class Case4 {
<!NON_PRIVATE_CONSTRUCTOR_IN_SEALED!>protected constructor(x: Int)<!>
<!NON_PRIVATE_CONSTRUCTOR_IN_SEALED!>protected constructor(s: String) : this(s.length)<!>
class Inheritor1 : Case4(10)
class Inheritor2 : Case4("Hello")
}
sealed class Case5() {
private constructor(x: Int) : this()
<!NON_PRIVATE_CONSTRUCTOR_IN_SEALED!>protected constructor(x: Byte) : this()<!>
<!NON_PRIVATE_CONSTRUCTOR_IN_SEALED!>internal constructor(x: Short) : this()<!>
<!NON_PRIVATE_CONSTRUCTOR_IN_SEALED!>public constructor(x: Long) : this()<!>
constructor(x: Double) : this()
}
// LANGUAGE: -AllowSealedInheritorsInDifferentFilesOfSamePackage
// DIAGNOSTICS: -UNUSED_PARAMETER
sealed class Case1(val x: Int) {
<!NON_PRIVATE_CONSTRUCTOR_IN_SEALED!>protected<!> constructor(s: String) : this(s.length)
class Inheritor1 : Case1(10)
class Inheritor2 : Case1("Hello")
}
sealed class Case2 <!NON_PRIVATE_CONSTRUCTOR_IN_SEALED!>protected<!> constructor(val x: Int) {
<!NON_PRIVATE_CONSTRUCTOR_IN_SEALED!>protected<!> constructor(s: String) : this(s.length)
class Inheritor1 : Case2(10)
class Inheritor2 : Case2("Hello")
}
sealed class Case3 private constructor(val x: Int) {
<!NON_PRIVATE_CONSTRUCTOR_IN_SEALED!>protected<!> constructor(s: String) : this(s.length)
class Inheritor1 : Case3(10) // should OK
class Inheritor2 : Case3("Hello")
}
class Case3Inheritor3 : Case3(20) // should be an error in 1.6 (?)
sealed class Case4 {
<!NON_PRIVATE_CONSTRUCTOR_IN_SEALED!>protected<!> constructor(x: Int)
<!NON_PRIVATE_CONSTRUCTOR_IN_SEALED!>protected<!> constructor(s: String) : this(s.length)
class Inheritor1 : Case4(10)
class Inheritor2 : Case4("Hello")
}
sealed class Case5() {
private constructor(x: Int) : this()
<!NON_PRIVATE_CONSTRUCTOR_IN_SEALED!>protected<!> constructor(x: Byte) : this()
<!NON_PRIVATE_CONSTRUCTOR_IN_SEALED!>internal<!> constructor(x: Short) : this()
<!NON_PRIVATE_CONSTRUCTOR_IN_SEALED!>public<!> constructor(x: Long) : this()
constructor(x: Double) : this()
}
package
public sealed class Case1 {
private constructor Case1(/*0*/ x: kotlin.Int)
protected constructor Case1(/*0*/ s: kotlin.String)
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
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public final class Inheritor1 : Case1 {
public constructor Inheritor1()
public final override /*1*/ /*fake_override*/ 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
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class Inheritor2 : Case1 {
public constructor Inheritor2()
public final override /*1*/ /*fake_override*/ 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
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
public sealed class Case2 {
protected constructor Case2(/*0*/ x: kotlin.Int)
protected constructor Case2(/*0*/ s: kotlin.String)
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
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public final class Inheritor1 : Case2 {
public constructor Inheritor1()
public final override /*1*/ /*fake_override*/ 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
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class Inheritor2 : Case2 {
public constructor Inheritor2()
public final override /*1*/ /*fake_override*/ 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
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
public sealed class Case3 {
private constructor Case3(/*0*/ x: kotlin.Int)
protected constructor Case3(/*0*/ s: kotlin.String)
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
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public final class Inheritor1 : Case3 {
public constructor Inheritor1()
public final override /*1*/ /*fake_override*/ 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
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class Inheritor2 : Case3 {
public constructor Inheritor2()
public final override /*1*/ /*fake_override*/ 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
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
public final class Case3Inheritor3 : Case3 {
public constructor Case3Inheritor3()
public final override /*1*/ /*fake_override*/ 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
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public sealed class Case4 {
protected constructor Case4(/*0*/ x: kotlin.Int)
protected constructor Case4(/*0*/ s: 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
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public final class Inheritor1 : Case4 {
public constructor Inheritor1()
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 Inheritor2 : Case4 {
public constructor Inheritor2()
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 Case5 {
private constructor Case5()
protected constructor Case5(/*0*/ x: kotlin.Byte)
private constructor Case5(/*0*/ x: kotlin.Double)
private constructor Case5(/*0*/ x: kotlin.Int)
public constructor Case5(/*0*/ x: kotlin.Long)
internal constructor Case5(/*0*/ x: kotlin.Short)
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
}
// LANGUAGE: +AllowSealedInheritorsInDifferentFilesOfSamePackage
// DIAGNOSTICS: -UNUSED_PARAMETER
sealed class Case1(val x: Int) {
<!NON_PRIVATE_CONSTRUCTOR_IN_SEALED!>protected constructor(s: String) : this(s.length)<!>
class Inheritor1 : Case1(10)
class Inheritor2 : Case1("Hello")
}
sealed class Case2 <!NON_PRIVATE_CONSTRUCTOR_IN_SEALED!>protected constructor(val x: Int)<!> { // should be REDUNDANT_MODIFIER
<!NON_PRIVATE_CONSTRUCTOR_IN_SEALED!>protected constructor(s: String) : this(s.length)<!>
class Inheritor1 : Case2(10)
class Inheritor2 : Case2("Hello")
}
sealed class Case3 private constructor(val x: Int) {
<!NON_PRIVATE_CONSTRUCTOR_IN_SEALED!>protected constructor(s: String) : this(s.length)<!>
class Inheritor1 : Case3(10) // should OK
class Inheritor2 : Case3("Hello")
}
class Case3Inheritor3 : <!INAPPLICABLE_CANDIDATE!>Case3<!>(20) // should be an error in 1.6 (?)
sealed class Case4 {
<!NON_PRIVATE_CONSTRUCTOR_IN_SEALED!>protected constructor(x: Int)<!>
<!NON_PRIVATE_CONSTRUCTOR_IN_SEALED!>protected constructor(s: String) : this(s.length)<!>
class Inheritor1 : Case4(10)
class Inheritor2 : Case4("Hello")
}
sealed class Case5() {
private constructor(x: Int) : this()
<!NON_PRIVATE_CONSTRUCTOR_IN_SEALED!>protected constructor(x: Byte) : this()<!>
<!NON_PRIVATE_CONSTRUCTOR_IN_SEALED!>internal constructor(x: Short) : this()<!>
<!NON_PRIVATE_CONSTRUCTOR_IN_SEALED!>public constructor(x: Long) : this()<!>
constructor(x: Double) : this()
}
// LANGUAGE: +AllowSealedInheritorsInDifferentFilesOfSamePackage
// DIAGNOSTICS: -UNUSED_PARAMETER
sealed class Case1(val x: Int) {
protected constructor(s: String) : this(s.length)
class Inheritor1 : Case1(10)
class Inheritor2 : Case1("Hello")
}
sealed class Case2 protected constructor(val x: Int) { // should be REDUNDANT_MODIFIER
protected constructor(s: String) : this(s.length)
class Inheritor1 : Case2(10)
class Inheritor2 : Case2("Hello")
}
sealed class Case3 private constructor(val x: Int) {
protected constructor(s: String) : this(s.length)
class Inheritor1 : Case3(10) // should OK
class Inheritor2 : Case3("Hello")
}
class Case3Inheritor3 : Case3(20) // should be an error in 1.6 (?)
sealed class Case4 {
protected constructor(x: Int)
protected constructor(s: String) : this(s.length)
class Inheritor1 : Case4(10)
class Inheritor2 : Case4("Hello")
}
sealed class Case5() {
private constructor(x: Int) : this()
protected constructor(x: Byte) : this()
<!NON_PRIVATE_OR_PROTECTED_CONSTRUCTOR_IN_SEALED!>internal<!> constructor(x: Short) : this()
<!NON_PRIVATE_OR_PROTECTED_CONSTRUCTOR_IN_SEALED!>public<!> constructor(x: Long) : this()
constructor(x: Double) : this()
}
package
public sealed class Case1 {
protected constructor Case1(/*0*/ x: kotlin.Int)
protected constructor Case1(/*0*/ s: kotlin.String)
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
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public final class Inheritor1 : Case1 {
public constructor Inheritor1()
public final override /*1*/ /*fake_override*/ 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
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class Inheritor2 : Case1 {
public constructor Inheritor2()
public final override /*1*/ /*fake_override*/ 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
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
public sealed class Case2 {
protected constructor Case2(/*0*/ x: kotlin.Int)
protected constructor Case2(/*0*/ s: kotlin.String)
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
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public final class Inheritor1 : Case2 {
public constructor Inheritor1()
public final override /*1*/ /*fake_override*/ 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
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class Inheritor2 : Case2 {
public constructor Inheritor2()
public final override /*1*/ /*fake_override*/ 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
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
public sealed class Case3 {
private constructor Case3(/*0*/ x: kotlin.Int)
protected constructor Case3(/*0*/ s: kotlin.String)
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
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public final class Inheritor1 : Case3 {
public constructor Inheritor1()
public final override /*1*/ /*fake_override*/ 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
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class Inheritor2 : Case3 {
public constructor Inheritor2()
public final override /*1*/ /*fake_override*/ 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
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
public final class Case3Inheritor3 : Case3 {
public constructor Case3Inheritor3()
public final override /*1*/ /*fake_override*/ 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
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public sealed class Case4 {
protected constructor Case4(/*0*/ x: kotlin.Int)
protected constructor Case4(/*0*/ s: 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
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public final class Inheritor1 : Case4 {
public constructor Inheritor1()
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 Inheritor2 : Case4 {
public constructor Inheritor2()
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 Case5 {
protected constructor Case5()
protected constructor Case5(/*0*/ x: kotlin.Byte)
protected constructor Case5(/*0*/ x: kotlin.Double)
private constructor Case5(/*0*/ x: kotlin.Int)
public constructor Case5(/*0*/ x: kotlin.Long)
internal constructor Case5(/*0*/ x: kotlin.Short)
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
}
...@@ -24601,6 +24601,18 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { ...@@ -24601,6 +24601,18 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/sealed/OperationWhen.kt"); runTest("compiler/testData/diagnostics/tests/sealed/OperationWhen.kt");
} }
@Test
@TestMetadata("protectedConstructors_disabled.kt")
public void testProtectedConstructors_disabled() throws Exception {
runTest("compiler/testData/diagnostics/tests/sealed/protectedConstructors_disabled.kt");
}
@Test
@TestMetadata("protectedConstructors_enabled.kt")
public void testProtectedConstructors_enabled() throws Exception {
runTest("compiler/testData/diagnostics/tests/sealed/protectedConstructors_enabled.kt");
}
@Test @Test
@TestMetadata("RedundantAbstract.kt") @TestMetadata("RedundantAbstract.kt")
public void testRedundantAbstract() throws Exception { public void testRedundantAbstract() throws Exception {
...@@ -149,6 +149,7 @@ class QuickFixRegistrar : QuickFixContributor { ...@@ -149,6 +149,7 @@ class QuickFixRegistrar : QuickFixContributor {
REPEATED_MODIFIER.registerFactory(removeModifierFactory) REPEATED_MODIFIER.registerFactory(removeModifierFactory)
NON_PRIVATE_CONSTRUCTOR_IN_ENUM.registerFactory(removeModifierFactory) NON_PRIVATE_CONSTRUCTOR_IN_ENUM.registerFactory(removeModifierFactory)
NON_PRIVATE_CONSTRUCTOR_IN_SEALED.registerFactory(removeModifierFactory) NON_PRIVATE_CONSTRUCTOR_IN_SEALED.registerFactory(removeModifierFactory)
NON_PRIVATE_OR_PROTECTED_CONSTRUCTOR_IN_SEALED.registerFactory(removeModifierFactory)
TYPE_CANT_BE_USED_FOR_CONST_VAL.registerFactory(removeModifierFactory) TYPE_CANT_BE_USED_FOR_CONST_VAL.registerFactory(removeModifierFactory)
DEPRECATED_BINARY_MOD.registerFactory(removeModifierFactory) DEPRECATED_BINARY_MOD.registerFactory(removeModifierFactory)
DEPRECATED_BINARY_MOD.registerFactory(RenameModToRemFix.Factory) DEPRECATED_BINARY_MOD.registerFactory(RenameModToRemFix.Factory)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册