diff --git a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KtFirDataClassConverters.kt b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KtFirDataClassConverters.kt index ea5b70219c7..568e6ec2714 100644 --- a/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KtFirDataClassConverters.kt +++ b/analysis/analysis-api-fir/src/org/jetbrains/kotlin/analysis/api/fir/diagnostics/KtFirDataClassConverters.kt @@ -1236,19 +1236,19 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert token, ) } - add(FirErrors.INLINE_CLASS_NOT_TOP_LEVEL) { firDiagnostic -> + add(FirErrors.VALUE_CLASS_NOT_TOP_LEVEL) { firDiagnostic -> InlineClassNotTopLevelImpl( firDiagnostic as KtPsiDiagnostic, token, ) } - add(FirErrors.INLINE_CLASS_NOT_FINAL) { firDiagnostic -> + add(FirErrors.VALUE_CLASS_NOT_FINAL) { firDiagnostic -> InlineClassNotFinalImpl( firDiagnostic as KtPsiDiagnostic, token, ) } - add(FirErrors.ABSENCE_OF_PRIMARY_CONSTRUCTOR_FOR_INLINE_CLASS) { firDiagnostic -> + add(FirErrors.ABSENCE_OF_PRIMARY_CONSTRUCTOR_FOR_VALUE_CLASS) { firDiagnostic -> AbsenceOfPrimaryConstructorForInlineClassImpl( firDiagnostic as KtPsiDiagnostic, token, @@ -1260,63 +1260,63 @@ internal val KT_DIAGNOSTIC_CONVERTER = KtDiagnosticConverterBuilder.buildConvert token, ) } - add(FirErrors.INLINE_CLASS_CONSTRUCTOR_NOT_FINAL_READ_ONLY_PARAMETER) { firDiagnostic -> + add(FirErrors.VALUE_CLASS_CONSTRUCTOR_NOT_FINAL_READ_ONLY_PARAMETER) { firDiagnostic -> InlineClassConstructorNotFinalReadOnlyParameterImpl( firDiagnostic as KtPsiDiagnostic, token, ) } - add(FirErrors.PROPERTY_WITH_BACKING_FIELD_INSIDE_INLINE_CLASS) { firDiagnostic -> + add(FirErrors.PROPERTY_WITH_BACKING_FIELD_INSIDE_VALUE_CLASS) { firDiagnostic -> PropertyWithBackingFieldInsideInlineClassImpl( firDiagnostic as KtPsiDiagnostic, token, ) } - add(FirErrors.DELEGATED_PROPERTY_INSIDE_INLINE_CLASS) { firDiagnostic -> + add(FirErrors.DELEGATED_PROPERTY_INSIDE_VALUE_CLASS) { firDiagnostic -> DelegatedPropertyInsideInlineClassImpl( firDiagnostic as KtPsiDiagnostic, token, ) } - add(FirErrors.INLINE_CLASS_HAS_INAPPLICABLE_PARAMETER_TYPE) { firDiagnostic -> + add(FirErrors.VALUE_CLASS_HAS_INAPPLICABLE_PARAMETER_TYPE) { firDiagnostic -> InlineClassHasInapplicableParameterTypeImpl( firSymbolBuilder.typeBuilder.buildKtType(firDiagnostic.a), firDiagnostic as KtPsiDiagnostic, token, ) } - add(FirErrors.INLINE_CLASS_CANNOT_IMPLEMENT_INTERFACE_BY_DELEGATION) { firDiagnostic -> + add(FirErrors.VALUE_CLASS_CANNOT_IMPLEMENT_INTERFACE_BY_DELEGATION) { firDiagnostic -> InlineClassCannotImplementInterfaceByDelegationImpl( firDiagnostic as KtPsiDiagnostic, token, ) } - add(FirErrors.INLINE_CLASS_CANNOT_EXTEND_CLASSES) { firDiagnostic -> + add(FirErrors.VALUE_CLASS_CANNOT_EXTEND_CLASSES) { firDiagnostic -> InlineClassCannotExtendClassesImpl( firDiagnostic as KtPsiDiagnostic, token, ) } - add(FirErrors.INLINE_CLASS_CANNOT_BE_RECURSIVE) { firDiagnostic -> + add(FirErrors.VALUE_CLASS_CANNOT_BE_RECURSIVE) { firDiagnostic -> InlineClassCannotBeRecursiveImpl( firDiagnostic as KtPsiDiagnostic, token, ) } - add(FirErrors.RESERVED_MEMBER_INSIDE_INLINE_CLASS) { firDiagnostic -> + add(FirErrors.RESERVED_MEMBER_INSIDE_VALUE_CLASS) { firDiagnostic -> ReservedMemberInsideInlineClassImpl( firDiagnostic.a, firDiagnostic as KtPsiDiagnostic, token, ) } - add(FirErrors.SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_INLINE_CLASS) { firDiagnostic -> + add(FirErrors.SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_VALUE_CLASS) { firDiagnostic -> SecondaryConstructorWithBodyInsideInlineClassImpl( firDiagnostic as KtPsiDiagnostic, token, ) } - add(FirErrors.INNER_CLASS_INSIDE_INLINE_CLASS) { firDiagnostic -> + add(FirErrors.INNER_CLASS_INSIDE_VALUE_CLASS) { firDiagnostic -> InnerClassInsideInlineClassImpl( firDiagnostic as KtPsiDiagnostic, token, diff --git a/compiler/fir/analysis-tests/testData/resolve/fromBuilder/simpleClass.kt b/compiler/fir/analysis-tests/testData/resolve/fromBuilder/simpleClass.kt index a16fc196212..57090db58fb 100644 --- a/compiler/fir/analysis-tests/testData/resolve/fromBuilder/simpleClass.kt +++ b/compiler/fir/analysis-tests/testData/resolve/fromBuilder/simpleClass.kt @@ -18,4 +18,4 @@ class SomeClass : SomeInterface { lateinit var fau: Double } -inline class InlineClass +inline class InlineClass diff --git a/compiler/fir/analysis-tests/testData/resolve/inlineClasses/inlineClassConstructor.kt b/compiler/fir/analysis-tests/testData/resolve/inlineClasses/inlineClassConstructor.kt index 5266114e6f5..a1e0e9c80c0 100644 --- a/compiler/fir/analysis-tests/testData/resolve/inlineClasses/inlineClassConstructor.kt +++ b/compiler/fir/analysis-tests/testData/resolve/inlineClasses/inlineClassConstructor.kt @@ -1,21 +1,21 @@ -value class WithoutConstructor {} +value class WithoutConstructor {} inline class WithoutParameter() {} inline class WithTwoParameters(val x: Int, val y: String) {} inline class Ok(private val x: Int) {} -inline class OpenParameter(open val x: Int) {} -inline class VarargParameter(vararg x: Int) {} -inline class VarParameter(var x: Int) {} -inline class SimpleParameter(x: Int) {} +inline class OpenParameter(open val x: Int) {} +inline class VarargParameter(vararg x: Int) {} +inline class VarParameter(var x: Int) {} +inline class SimpleParameter(x: Int) {} -inline class UnitParameter(val x: Unit) -inline class NothingParameter(val x: Nothing) -inline class TypeParameterType(val x: T) -inline class ArrayOfTypeParameters(val x: Array) +inline class UnitParameter(val x: Unit) +inline class NothingParameter(val x: Nothing) +inline class TypeParameterType(val x: T) +inline class ArrayOfTypeParameters(val x: Array) inline class ListOfTypeParameters(val x: List) inline class StarProjection(val x: Array<*>) -inline class SimpleRecursive(val x: SimpleRecursive) -inline class DoubleRecursive1(val x: DoubleRecursive2) -inline class DoubleRecursive2(val x: DoubleRecursive1) +inline class SimpleRecursive(val x: SimpleRecursive) +inline class DoubleRecursive1(val x: DoubleRecursive2) +inline class DoubleRecursive2(val x: DoubleRecursive1) diff --git a/compiler/fir/analysis-tests/testData/resolve/inlineClasses/inlineClassDeclaration.kt b/compiler/fir/analysis-tests/testData/resolve/inlineClasses/inlineClassDeclaration.kt index a5cba659e5f..90a202cc613 100644 --- a/compiler/fir/analysis-tests/testData/resolve/inlineClasses/inlineClassDeclaration.kt +++ b/compiler/fir/analysis-tests/testData/resolve/inlineClasses/inlineClassDeclaration.kt @@ -1,19 +1,19 @@ class A { - inline inner class B(val x: Int) + inline inner class B(val x: Int) fun foo() { - inline class C(val x: Int) + inline class C(val x: Int) } - inner value class D(val x: Int) + inner value class D(val x: Int) } -open inline class NotFinalClass1(val x: Int) -abstract inline class NotFinalClass2(val x: Int) -sealed inline class NotFinalClass3(val x: Int) +open inline class NotFinalClass1(val x: Int) +abstract inline class NotFinalClass2(val x: Int) +sealed inline class NotFinalClass3(val x: Int) value class CloneableClass1(val x: Int): Cloneable inline class CloneableClass2(val x: Int): java.lang.Cloneable open class Test -inline class ExtendTest(val x: Int): Test +inline class ExtendTest(val x: Int): Test -inline class ImplementByDelegation(val x: Int) : Comparable by x +inline class ImplementByDelegation(val x: Int) : Comparable by x diff --git a/compiler/fir/analysis-tests/testData/resolve/inlineClasses/inlineClassMembers.kt b/compiler/fir/analysis-tests/testData/resolve/inlineClasses/inlineClassMembers.kt index c51f4e6bf19..f43088773c3 100644 --- a/compiler/fir/analysis-tests/testData/resolve/inlineClasses/inlineClassMembers.kt +++ b/compiler/fir/analysis-tests/testData/resolve/inlineClasses/inlineClassMembers.kt @@ -1,5 +1,5 @@ value class BackingFields(val x: Int) { - val y = 0 + val y = 0 var z: String get() = "" set(value) {} @@ -9,24 +9,24 @@ class Val { operator fun getValue(thisRef: Any?, kProp: Any?) = 1 } inline class DelegatedProp(val x: Int) { - val testVal by Val() + val testVal by Val() } inline class ReversedMembers(val x: Int) { - fun box() {} - fun unbox() {} + fun box() {} + fun unbox() {} - override fun equals(other: Any?) = true - override fun hashCode() = 1 + override fun equals(other: Any?) = true + override fun hashCode() = 1 } inline class SecondaryConstructors(val x: Int) { constructor(y: String) : this(5) - constructor(x: Int, y: String) : this(x) { + constructor(x: Int, y: String) : this(x) { } } value class WithInner(val x: String) { - inner class Inner + inner class Inner } diff --git a/compiler/fir/checkers/checkers-component-generator/src/org/jetbrains/kotlin/fir/checkers/generator/diagnostics/FirDiagnosticsList.kt b/compiler/fir/checkers/checkers-component-generator/src/org/jetbrains/kotlin/fir/checkers/generator/diagnostics/FirDiagnosticsList.kt index 2044be338ca..3094fea933f 100644 --- a/compiler/fir/checkers/checkers-component-generator/src/org/jetbrains/kotlin/fir/checkers/generator/diagnostics/FirDiagnosticsList.kt +++ b/compiler/fir/checkers/checkers-component-generator/src/org/jetbrains/kotlin/fir/checkers/generator/diagnostics/FirDiagnosticsList.kt @@ -395,25 +395,25 @@ object DIAGNOSTICS_LIST : DiagnosticList("FirErrors") { val NO_EXPLICIT_RETURN_TYPE_IN_API_MODE_WARNING by warning(PositioningStrategy.DECLARATION_NAME) } - val INLINE_CLASSES by object : DiagnosticGroup("Inline classes") { - val INLINE_CLASS_NOT_TOP_LEVEL by error(PositioningStrategy.INLINE_OR_VALUE_MODIFIER) - val INLINE_CLASS_NOT_FINAL by error(PositioningStrategy.MODALITY_MODIFIER) - val ABSENCE_OF_PRIMARY_CONSTRUCTOR_FOR_INLINE_CLASS by error(PositioningStrategy.INLINE_OR_VALUE_MODIFIER) + val VALUE_CLASSES by object : DiagnosticGroup("Value classes") { + val VALUE_CLASS_NOT_TOP_LEVEL by error(PositioningStrategy.INLINE_OR_VALUE_MODIFIER) + val VALUE_CLASS_NOT_FINAL by error(PositioningStrategy.MODALITY_MODIFIER) + val ABSENCE_OF_PRIMARY_CONSTRUCTOR_FOR_VALUE_CLASS by error(PositioningStrategy.INLINE_OR_VALUE_MODIFIER) val INLINE_CLASS_CONSTRUCTOR_WRONG_PARAMETERS_SIZE by error() - val INLINE_CLASS_CONSTRUCTOR_NOT_FINAL_READ_ONLY_PARAMETER by error() - val PROPERTY_WITH_BACKING_FIELD_INSIDE_INLINE_CLASS by error(PositioningStrategy.DECLARATION_SIGNATURE) - val DELEGATED_PROPERTY_INSIDE_INLINE_CLASS by error() - val INLINE_CLASS_HAS_INAPPLICABLE_PARAMETER_TYPE by error { + val VALUE_CLASS_CONSTRUCTOR_NOT_FINAL_READ_ONLY_PARAMETER by error() + val PROPERTY_WITH_BACKING_FIELD_INSIDE_VALUE_CLASS by error(PositioningStrategy.DECLARATION_SIGNATURE) + val DELEGATED_PROPERTY_INSIDE_VALUE_CLASS by error() + val VALUE_CLASS_HAS_INAPPLICABLE_PARAMETER_TYPE by error { parameter("type") } - val INLINE_CLASS_CANNOT_IMPLEMENT_INTERFACE_BY_DELEGATION by error() - val INLINE_CLASS_CANNOT_EXTEND_CLASSES by error() - val INLINE_CLASS_CANNOT_BE_RECURSIVE by error() - val RESERVED_MEMBER_INSIDE_INLINE_CLASS by error(PositioningStrategy.DECLARATION_NAME) { + val VALUE_CLASS_CANNOT_IMPLEMENT_INTERFACE_BY_DELEGATION by error() + val VALUE_CLASS_CANNOT_EXTEND_CLASSES by error() + val VALUE_CLASS_CANNOT_BE_RECURSIVE by error() + val RESERVED_MEMBER_INSIDE_VALUE_CLASS by error(PositioningStrategy.DECLARATION_NAME) { parameter("name") } - val SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_INLINE_CLASS by error() - val INNER_CLASS_INSIDE_INLINE_CLASS by error(PositioningStrategy.INNER_MODIFIER) + val SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_VALUE_CLASS by error() + val INNER_CLASS_INSIDE_VALUE_CLASS by error(PositioningStrategy.INNER_MODIFIER) val VALUE_CLASS_CANNOT_BE_CLONEABLE by error(PositioningStrategy.INLINE_OR_VALUE_MODIFIER) } diff --git a/compiler/fir/checkers/gen/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt b/compiler/fir/checkers/gen/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt index 30812978f73..2c427713a23 100644 --- a/compiler/fir/checkers/gen/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt +++ b/compiler/fir/checkers/gen/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrors.kt @@ -296,21 +296,21 @@ object FirErrors { val NO_EXPLICIT_RETURN_TYPE_IN_API_MODE by error0(SourceElementPositioningStrategies.DECLARATION_NAME) val NO_EXPLICIT_RETURN_TYPE_IN_API_MODE_WARNING by warning0(SourceElementPositioningStrategies.DECLARATION_NAME) - // Inline classes - val INLINE_CLASS_NOT_TOP_LEVEL by error0(SourceElementPositioningStrategies.INLINE_OR_VALUE_MODIFIER) - val INLINE_CLASS_NOT_FINAL by error0(SourceElementPositioningStrategies.MODALITY_MODIFIER) - val ABSENCE_OF_PRIMARY_CONSTRUCTOR_FOR_INLINE_CLASS by error0(SourceElementPositioningStrategies.INLINE_OR_VALUE_MODIFIER) + // Value classes + val VALUE_CLASS_NOT_TOP_LEVEL by error0(SourceElementPositioningStrategies.INLINE_OR_VALUE_MODIFIER) + val VALUE_CLASS_NOT_FINAL by error0(SourceElementPositioningStrategies.MODALITY_MODIFIER) + val ABSENCE_OF_PRIMARY_CONSTRUCTOR_FOR_VALUE_CLASS by error0(SourceElementPositioningStrategies.INLINE_OR_VALUE_MODIFIER) val INLINE_CLASS_CONSTRUCTOR_WRONG_PARAMETERS_SIZE by error0() - val INLINE_CLASS_CONSTRUCTOR_NOT_FINAL_READ_ONLY_PARAMETER by error0() - val PROPERTY_WITH_BACKING_FIELD_INSIDE_INLINE_CLASS by error0(SourceElementPositioningStrategies.DECLARATION_SIGNATURE) - val DELEGATED_PROPERTY_INSIDE_INLINE_CLASS by error0() - val INLINE_CLASS_HAS_INAPPLICABLE_PARAMETER_TYPE by error1() - val INLINE_CLASS_CANNOT_IMPLEMENT_INTERFACE_BY_DELEGATION by error0() - val INLINE_CLASS_CANNOT_EXTEND_CLASSES by error0() - val INLINE_CLASS_CANNOT_BE_RECURSIVE by error0() - val RESERVED_MEMBER_INSIDE_INLINE_CLASS by error1(SourceElementPositioningStrategies.DECLARATION_NAME) - val SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_INLINE_CLASS by error0() - val INNER_CLASS_INSIDE_INLINE_CLASS by error0(SourceElementPositioningStrategies.INNER_MODIFIER) + val VALUE_CLASS_CONSTRUCTOR_NOT_FINAL_READ_ONLY_PARAMETER by error0() + val PROPERTY_WITH_BACKING_FIELD_INSIDE_VALUE_CLASS by error0(SourceElementPositioningStrategies.DECLARATION_SIGNATURE) + val DELEGATED_PROPERTY_INSIDE_VALUE_CLASS by error0() + val VALUE_CLASS_HAS_INAPPLICABLE_PARAMETER_TYPE by error1() + val VALUE_CLASS_CANNOT_IMPLEMENT_INTERFACE_BY_DELEGATION by error0() + val VALUE_CLASS_CANNOT_EXTEND_CLASSES by error0() + val VALUE_CLASS_CANNOT_BE_RECURSIVE by error0() + val RESERVED_MEMBER_INSIDE_VALUE_CLASS by error1(SourceElementPositioningStrategies.DECLARATION_NAME) + val SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_VALUE_CLASS by error0() + val INNER_CLASS_INSIDE_VALUE_CLASS by error0(SourceElementPositioningStrategies.INNER_MODIFIER) val VALUE_CLASS_CANNOT_BE_CLONEABLE by error0(SourceElementPositioningStrategies.INLINE_OR_VALUE_MODIFIER) // Applicability diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirInlineClassDeclarationChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirInlineClassDeclarationChecker.kt index 02a00a03e4b..fb9f4816fe5 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirInlineClassDeclarationChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirInlineClassDeclarationChecker.kt @@ -39,16 +39,16 @@ object FirInlineClassDeclarationChecker : FirRegularClassChecker() { } if (declaration.isInner || declaration.isLocal) { - reporter.reportOn(declaration.source, FirErrors.INLINE_CLASS_NOT_TOP_LEVEL, context) + reporter.reportOn(declaration.source, FirErrors.VALUE_CLASS_NOT_TOP_LEVEL, context) } if (declaration.modality != Modality.FINAL) { - reporter.reportOn(declaration.source, FirErrors.INLINE_CLASS_NOT_FINAL, context) + reporter.reportOn(declaration.source, FirErrors.VALUE_CLASS_NOT_FINAL, context) } for (supertypeEntry in declaration.superTypeRefs) { if (supertypeEntry.toRegularClassSymbol(context.session)?.isInterface != true) { - reporter.reportOnWithSuppression(supertypeEntry, FirErrors.INLINE_CLASS_CANNOT_EXTEND_CLASSES, context) + reporter.reportOnWithSuppression(supertypeEntry, FirErrors.VALUE_CLASS_CANNOT_EXTEND_CLASSES, context) } } @@ -73,7 +73,7 @@ object FirInlineClassDeclarationChecker : FirRegularClassChecker() { val body = innerDeclaration.body!! withSuppressedDiagnostics(innerDeclaration, context) { context -> reporter.reportOnWithSuppression( - body, FirErrors.SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_INLINE_CLASS, context + body, FirErrors.SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_VALUE_CLASS, context ) } } @@ -81,7 +81,7 @@ object FirInlineClassDeclarationChecker : FirRegularClassChecker() { } is FirRegularClass -> { if (innerDeclaration.isInner) { - reporter.reportOnWithSuppression(innerDeclaration, FirErrors.INNER_CLASS_INSIDE_INLINE_CLASS, context) + reporter.reportOnWithSuppression(innerDeclaration, FirErrors.INNER_CLASS_INSIDE_VALUE_CLASS, context) } } is FirSimpleFunction -> { @@ -89,7 +89,7 @@ object FirInlineClassDeclarationChecker : FirRegularClassChecker() { if (functionName in reservedFunctionNames) { reporter.reportOnWithSuppression( - innerDeclaration, FirErrors.RESERVED_MEMBER_INSIDE_INLINE_CLASS, functionName, context + innerDeclaration, FirErrors.RESERVED_MEMBER_INSIDE_VALUE_CLASS, functionName, context ) } } @@ -99,7 +99,7 @@ object FirInlineClassDeclarationChecker : FirRegularClassChecker() { withSuppressedDiagnostics(innerDeclaration, context) { context -> reporter.reportOn( delegatedTypeRefSource, - FirErrors.INLINE_CLASS_CANNOT_IMPLEMENT_INTERFACE_BY_DELEGATION, + FirErrors.VALUE_CLASS_CANNOT_IMPLEMENT_INTERFACE_BY_DELEGATION, context ) } @@ -114,7 +114,7 @@ object FirInlineClassDeclarationChecker : FirRegularClassChecker() { withSuppressedDiagnostics(innerDeclaration, context) { context -> reporter.reportOn( innerDeclaration.delegate!!.source, - FirErrors.DELEGATED_PROPERTY_INSIDE_INLINE_CLASS, + FirErrors.DELEGATED_PROPERTY_INSIDE_VALUE_CLASS, context ) } @@ -123,7 +123,7 @@ object FirInlineClassDeclarationChecker : FirRegularClassChecker() { innerDeclaration.source?.kind !is KtFakeSourceElementKind -> reporter.reportOnWithSuppression( innerDeclaration, - FirErrors.PROPERTY_WITH_BACKING_FIELD_INSIDE_INLINE_CLASS, + FirErrors.PROPERTY_WITH_BACKING_FIELD_INSIDE_VALUE_CLASS, context ) } @@ -134,7 +134,7 @@ object FirInlineClassDeclarationChecker : FirRegularClassChecker() { } if (primaryConstructor?.source?.kind !is KtRealSourceElementKind) { - reporter.reportOn(declaration.source, FirErrors.ABSENCE_OF_PRIMARY_CONSTRUCTOR_FOR_INLINE_CLASS, context) + reporter.reportOn(declaration.source, FirErrors.ABSENCE_OF_PRIMARY_CONSTRUCTOR_FOR_VALUE_CLASS, context) return } @@ -149,14 +149,14 @@ object FirInlineClassDeclarationChecker : FirRegularClassChecker() { primaryConstructorParameter.isNotFinalReadOnly(primaryConstructorProperty) -> reporter.reportOn( primaryConstructorParameter.source, - FirErrors.INLINE_CLASS_CONSTRUCTOR_NOT_FINAL_READ_ONLY_PARAMETER, + FirErrors.VALUE_CLASS_CONSTRUCTOR_NOT_FINAL_READ_ONLY_PARAMETER, context ) primaryConstructorParameter.returnTypeRef.isInapplicableParameterType() -> reporter.reportOn( primaryConstructorParameter.returnTypeRef.source, - FirErrors.INLINE_CLASS_HAS_INAPPLICABLE_PARAMETER_TYPE, + FirErrors.VALUE_CLASS_HAS_INAPPLICABLE_PARAMETER_TYPE, primaryConstructorParameter.returnTypeRef.coneType, context ) @@ -164,7 +164,7 @@ object FirInlineClassDeclarationChecker : FirRegularClassChecker() { primaryConstructorParameter.returnTypeRef.coneType.isRecursiveInlineClassType(context.session) -> reporter.reportOnWithSuppression( primaryConstructorParameter.returnTypeRef, - FirErrors.INLINE_CLASS_CANNOT_BE_RECURSIVE, + FirErrors.VALUE_CLASS_CANNOT_BE_RECURSIVE, context ) } diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrorsDefaultMessages.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrorsDefaultMessages.kt index 57b491cb15e..8bd2c54eafc 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrorsDefaultMessages.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/diagnostics/FirErrorsDefaultMessages.kt @@ -33,7 +33,7 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.FirDiagnosticRenderers.SYMB import org.jetbrains.kotlin.fir.analysis.diagnostics.FirDiagnosticRenderers.SYMBOLS import org.jetbrains.kotlin.fir.analysis.diagnostics.FirDiagnosticRenderers.VARIABLE_NAME import org.jetbrains.kotlin.fir.analysis.diagnostics.FirDiagnosticRenderers.WHEN_MISSING_CASES -import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.ABSENCE_OF_PRIMARY_CONSTRUCTOR_FOR_INLINE_CLASS +import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.ABSENCE_OF_PRIMARY_CONSTRUCTOR_FOR_VALUE_CLASS import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.ABSTRACT_CLASS_MEMBER_NOT_IMPLEMENTED import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.ABSTRACT_DELEGATED_PROPERTY import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.ABSTRACT_FUNCTION_IN_NON_ABSTRACT_CLASS @@ -130,7 +130,7 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.DATA_CLASS_OVERRI import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.DATA_CLASS_VARARG_PARAMETER import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.DATA_CLASS_WITHOUT_PARAMETERS import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.DECLARATION_CANT_BE_INLINED -import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.DELEGATED_PROPERTY_INSIDE_INLINE_CLASS +import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.DELEGATED_PROPERTY_INSIDE_VALUE_CLASS import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.DELEGATED_PROPERTY_IN_INTERFACE import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.DELEGATE_SPECIAL_FUNCTION_AMBIGUITY import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.DELEGATE_SPECIAL_FUNCTION_MISSING @@ -236,17 +236,17 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.INFIX_MODIFIER_RE import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.INITIALIZATION_BEFORE_DECLARATION import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.INITIALIZER_REQUIRED_FOR_DESTRUCTURING_DECLARATION import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.INITIALIZER_TYPE_MISMATCH -import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.INLINE_CLASS_CANNOT_BE_RECURSIVE -import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.INLINE_CLASS_CANNOT_EXTEND_CLASSES -import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.INLINE_CLASS_CANNOT_IMPLEMENT_INTERFACE_BY_DELEGATION -import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.INLINE_CLASS_CONSTRUCTOR_NOT_FINAL_READ_ONLY_PARAMETER +import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.VALUE_CLASS_CANNOT_BE_RECURSIVE +import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.VALUE_CLASS_CANNOT_EXTEND_CLASSES +import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.VALUE_CLASS_CANNOT_IMPLEMENT_INTERFACE_BY_DELEGATION +import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.VALUE_CLASS_CONSTRUCTOR_NOT_FINAL_READ_ONLY_PARAMETER import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.INLINE_CLASS_CONSTRUCTOR_WRONG_PARAMETERS_SIZE -import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.INLINE_CLASS_HAS_INAPPLICABLE_PARAMETER_TYPE -import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.INLINE_CLASS_NOT_FINAL -import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.INLINE_CLASS_NOT_TOP_LEVEL +import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.VALUE_CLASS_HAS_INAPPLICABLE_PARAMETER_TYPE +import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.VALUE_CLASS_NOT_FINAL +import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.VALUE_CLASS_NOT_TOP_LEVEL import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.INLINE_PROPERTY_WITH_BACKING_FIELD import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.INLINE_SUSPEND_FUNCTION_TYPE_UNSUPPORTED -import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.INNER_CLASS_INSIDE_INLINE_CLASS +import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.INNER_CLASS_INSIDE_VALUE_CLASS import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.INNER_CLASS_OF_GENERIC_THROWABLE_SUBCLASS import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.INSTANCE_ACCESS_BEFORE_SUPER_CALL import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.INTERFACE_WITH_SUPERCLASS @@ -372,7 +372,7 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.PROPERTY_MUST_HAV import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.PROPERTY_TYPE_MISMATCH_BY_DELEGATION import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.PROPERTY_TYPE_MISMATCH_ON_INHERITANCE import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.PROPERTY_TYPE_MISMATCH_ON_OVERRIDE -import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.PROPERTY_WITH_BACKING_FIELD_INSIDE_INLINE_CLASS +import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.PROPERTY_WITH_BACKING_FIELD_INSIDE_VALUE_CLASS import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.PROPERTY_WITH_NO_TYPE_NO_INITIALIZER import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.PROTECTED_CALL_FROM_PUBLIC_INLINE import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.PROTECTED_CALL_FROM_PUBLIC_INLINE_ERROR @@ -407,7 +407,7 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.REPEATED_ANNOTATI import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.REPEATED_ANNOTATION_WARNING import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.REPEATED_BOUND import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.REPEATED_MODIFIER -import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.RESERVED_MEMBER_INSIDE_INLINE_CLASS +import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.RESERVED_MEMBER_INSIDE_VALUE_CLASS import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.RESOLUTION_TO_CLASSIFIER import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.RESOLVED_TO_UNDERSCORE_NAMED_CATCH_PARAMETER import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.RESULT_TYPE_MISMATCH @@ -423,7 +423,7 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SEALED_INHERITOR_ import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SEALED_INHERITOR_IN_DIFFERENT_PACKAGE import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SEALED_SUPERTYPE import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SEALED_SUPERTYPE_IN_LOCAL_CLASS -import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_INLINE_CLASS +import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_VALUE_CLASS import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SENSELESS_COMPARISON import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SENSELESS_NULL_IN_WHEN import org.jetbrains.kotlin.fir.analysis.diagnostics.FirErrors.SETTER_PROJECTED_OUT @@ -737,6 +737,7 @@ object FirErrorsDefaultMessages : BaseDiagnosticRendererFactory() { ) map.put(REPEATED_ANNOTATION, "This annotation is not repeatable") map.put(REPEATED_ANNOTATION_WARNING, "This annotation is not repeatable") + map.put(NON_INTERNAL_PUBLISHED_API, "@PublishedApi annotation is only applicable for internal declaration") // OptIn map.put(OPT_IN_USAGE, "{1}", TO_STRING, STRING) @@ -1062,21 +1063,36 @@ object FirErrorsDefaultMessages : BaseDiagnosticRendererFactory() { RENDER_TYPE ) - // Inline and value classes - 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(ABSENCE_OF_PRIMARY_CONSTRUCTOR_FOR_INLINE_CLASS, "Primary constructor is required for inline class") - map.put(INLINE_CLASS_CONSTRUCTOR_WRONG_PARAMETERS_SIZE, "Inline class must have exactly one primary constructor parameter") + // Value classes + map.put(VALUE_CLASS_NOT_TOP_LEVEL, "Value classes cannot be local or inner") + map.put(VALUE_CLASS_NOT_FINAL, "Value classes can be only final") + map.put(ABSENCE_OF_PRIMARY_CONSTRUCTOR_FOR_VALUE_CLASS, "Primary constructor is required for value class") + map.put(INLINE_CLASS_CONSTRUCTOR_WRONG_PARAMETERS_SIZE, "Inline class must have exactly one primary constructor parameter") // + map.put( - INLINE_CLASS_CONSTRUCTOR_NOT_FINAL_READ_ONLY_PARAMETER, + VALUE_CLASS_CONSTRUCTOR_NOT_FINAL_READ_ONLY_PARAMETER, "Value class primary constructor must have only final read-only (val) property parameter" ) - map.put(PROPERTY_WITH_BACKING_FIELD_INSIDE_INLINE_CLASS, "Inline class cannot have properties with backing fields") - map.put(DELEGATED_PROPERTY_INSIDE_INLINE_CLASS, "Inline class cannot have delegated properties") - map.put(INLINE_CLASS_HAS_INAPPLICABLE_PARAMETER_TYPE, "Inline class cannot have value parameter of type ''{0}''", TO_STRING) - map.put(INLINE_CLASS_CANNOT_IMPLEMENT_INTERFACE_BY_DELEGATION, "Inline class cannot implement an interface by delegation") - map.put(INLINE_CLASS_CANNOT_EXTEND_CLASSES, "Inline class cannot extend classes") - map.put(INLINE_CLASS_CANNOT_BE_RECURSIVE, "Inline class cannot be recursive") + map.put(PROPERTY_WITH_BACKING_FIELD_INSIDE_VALUE_CLASS, "Value class cannot have properties with backing fields") + map.put(DELEGATED_PROPERTY_INSIDE_VALUE_CLASS, "Value class cannot have delegated properties") + map.put(VALUE_CLASS_HAS_INAPPLICABLE_PARAMETER_TYPE, "Value class cannot have value parameter of type ''{0}''", TO_STRING) + map.put(VALUE_CLASS_CANNOT_IMPLEMENT_INTERFACE_BY_DELEGATION, "Value class cannot implement an interface by delegation") + map.put(VALUE_CLASS_CANNOT_EXTEND_CLASSES, "Value class cannot extend classes") + map.put(VALUE_CLASS_CANNOT_BE_RECURSIVE, "Value class cannot be recursive") + map.put( + INVALID_DEFAULT_FUNCTIONAL_PARAMETER_FOR_INLINE, + "Invalid default value for inline parameter: ''{0}''. Only lambdas, anonymous functions, and callable references are supported", + FIR, + DECLARATION_NAME + ) + map.put(RESERVED_MEMBER_INSIDE_VALUE_CLASS, "Member with the name ''{0}'' is reserved for future releases", TO_STRING) + map.put( + SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_VALUE_CLASS, + "Secondary constructors with bodies are reserved for for future releases" + ) + map.put(INNER_CLASS_INSIDE_VALUE_CLASS, "Value class cannot have inner classes") + map.put(VALUE_CLASS_CANNOT_BE_CLONEABLE, "Value class cannot be Cloneable") + + // Inline map.put( DECLARATION_CANT_BE_INLINED, "'inline' modifier is not allowed on virtual members. Only private or final members can be inlined" @@ -1084,20 +1100,6 @@ object FirErrorsDefaultMessages : BaseDiagnosticRendererFactory() { map.put(OVERRIDE_BY_INLINE, "Override by an inline function") map.put(REIFIED_TYPE_PARAMETER_IN_OVERRIDE, "Override by a function with reified type parameter") map.put(INLINE_PROPERTY_WITH_BACKING_FIELD, "Inline property cannot have backing field") - map.put(NON_INTERNAL_PUBLISHED_API, "@PublishedApi annotation is only applicable for internal declaration") - map.put( - INVALID_DEFAULT_FUNCTIONAL_PARAMETER_FOR_INLINE, - "Invalid default value for inline parameter: ''{0}''. Only lambdas, anonymous functions, and callable references are supported", - FIR, - DECLARATION_NAME - ) - map.put(RESERVED_MEMBER_INSIDE_INLINE_CLASS, "Member with the name ''{0}'' is reserved for future releases", TO_STRING) - map.put( - SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_INLINE_CLASS, - "Secondary constructors with bodies are reserved for for future releases" - ) - map.put(INNER_CLASS_INSIDE_INLINE_CLASS, "Inline class cannot have inner classes") - map.put(VALUE_CLASS_CANNOT_BE_CLONEABLE, "Value class cannot be Cloneable") // Overrides map.put(NOTHING_TO_OVERRIDE, "''{0}'' overrides nothing", DECLARATION_NAME) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java index e955a7be508..f72706d2a9e 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/Errors.java @@ -369,20 +369,20 @@ public interface Errors { // Inline classes - DiagnosticFactory0 INLINE_CLASS_NOT_TOP_LEVEL = DiagnosticFactory0.create(ERROR); - DiagnosticFactory0 INLINE_CLASS_NOT_FINAL = DiagnosticFactory0.create(ERROR); - DiagnosticFactory0 ABSENCE_OF_PRIMARY_CONSTRUCTOR_FOR_INLINE_CLASS = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 VALUE_CLASS_NOT_TOP_LEVEL = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 VALUE_CLASS_NOT_FINAL = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 ABSENCE_OF_PRIMARY_CONSTRUCTOR_FOR_VALUE_CLASS = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 INLINE_CLASS_CONSTRUCTOR_WRONG_PARAMETERS_SIZE = DiagnosticFactory0.create(ERROR); - DiagnosticFactory0 INLINE_CLASS_CONSTRUCTOR_NOT_FINAL_READ_ONLY_PARAMETER = DiagnosticFactory0.create(ERROR); - DiagnosticFactory0 PROPERTY_WITH_BACKING_FIELD_INSIDE_INLINE_CLASS = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE); - DiagnosticFactory0 DELEGATED_PROPERTY_INSIDE_INLINE_CLASS = DiagnosticFactory0.create(ERROR); - DiagnosticFactory1 INLINE_CLASS_HAS_INAPPLICABLE_PARAMETER_TYPE = DiagnosticFactory1.create(ERROR); - DiagnosticFactory0 INLINE_CLASS_CANNOT_IMPLEMENT_INTERFACE_BY_DELEGATION = DiagnosticFactory0.create(ERROR); - DiagnosticFactory0 INLINE_CLASS_CANNOT_EXTEND_CLASSES = DiagnosticFactory0.create(ERROR); - DiagnosticFactory0 INLINE_CLASS_CANNOT_BE_RECURSIVE = DiagnosticFactory0.create(ERROR); - DiagnosticFactory1 RESERVED_MEMBER_INSIDE_INLINE_CLASS = DiagnosticFactory1.create(ERROR); - DiagnosticFactory0 SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_INLINE_CLASS = DiagnosticFactory0.create(ERROR); - DiagnosticFactory0 INNER_CLASS_INSIDE_INLINE_CLASS = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 VALUE_CLASS_CONSTRUCTOR_NOT_FINAL_READ_ONLY_PARAMETER = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 PROPERTY_WITH_BACKING_FIELD_INSIDE_VALUE_CLASS = DiagnosticFactory0.create(ERROR, DECLARATION_SIGNATURE); + DiagnosticFactory0 DELEGATED_PROPERTY_INSIDE_VALUE_CLASS = DiagnosticFactory0.create(ERROR); + DiagnosticFactory1 VALUE_CLASS_HAS_INAPPLICABLE_PARAMETER_TYPE = DiagnosticFactory1.create(ERROR); + DiagnosticFactory0 VALUE_CLASS_CANNOT_IMPLEMENT_INTERFACE_BY_DELEGATION = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 VALUE_CLASS_CANNOT_EXTEND_CLASSES = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 VALUE_CLASS_CANNOT_BE_RECURSIVE = DiagnosticFactory0.create(ERROR); + DiagnosticFactory1 RESERVED_MEMBER_INSIDE_VALUE_CLASS = DiagnosticFactory1.create(ERROR); + DiagnosticFactory0 SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_VALUE_CLASS = DiagnosticFactory0.create(ERROR); + DiagnosticFactory0 INNER_CLASS_INSIDE_VALUE_CLASS = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 VALUE_CLASS_CANNOT_BE_CLONEABLE = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 INLINE_CLASS_DEPRECATED = DiagnosticFactory0.create(WARNING); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java index 01dc462e9ac..1679c1ae2e5 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java @@ -742,20 +742,20 @@ public class DefaultErrorMessages { 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_FINAL, "Inline classes can be only final"); - MAP.put(ABSENCE_OF_PRIMARY_CONSTRUCTOR_FOR_INLINE_CLASS, "Primary constructor is required for inline class"); - MAP.put(INLINE_CLASS_CONSTRUCTOR_WRONG_PARAMETERS_SIZE, "Inline class must have exactly one primary constructor parameter"); - MAP.put(INLINE_CLASS_CONSTRUCTOR_NOT_FINAL_READ_ONLY_PARAMETER, "Value class primary constructor must have only final read-only (val) property parameter"); - MAP.put(PROPERTY_WITH_BACKING_FIELD_INSIDE_INLINE_CLASS, "Inline class cannot have properties with backing fields"); - MAP.put(DELEGATED_PROPERTY_INSIDE_INLINE_CLASS, "Inline class cannot have delegated properties"); - MAP.put(INLINE_CLASS_HAS_INAPPLICABLE_PARAMETER_TYPE, "Inline class cannot have value parameter of type ''{0}''", RENDER_TYPE); - MAP.put(INLINE_CLASS_CANNOT_IMPLEMENT_INTERFACE_BY_DELEGATION, "Inline class cannot implement an interface by delegation"); - MAP.put(INLINE_CLASS_CANNOT_EXTEND_CLASSES, "Inline class cannot extend classes"); - MAP.put(INLINE_CLASS_CANNOT_BE_RECURSIVE, "Inline class cannot be recursive"); - MAP.put(RESERVED_MEMBER_INSIDE_INLINE_CLASS, "Member with the name ''{0}'' is reserved for future releases", STRING); - MAP.put(SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_INLINE_CLASS, "Secondary constructors with bodies are reserved for for future releases"); - MAP.put(INNER_CLASS_INSIDE_INLINE_CLASS, "Inline class cannot have inner classes"); + MAP.put(VALUE_CLASS_NOT_TOP_LEVEL, "Value classes cannot be local or inner"); + MAP.put(VALUE_CLASS_NOT_FINAL, "Value classes can be only final"); + MAP.put(ABSENCE_OF_PRIMARY_CONSTRUCTOR_FOR_VALUE_CLASS, "Primary constructor is required for value class"); + MAP.put(INLINE_CLASS_CONSTRUCTOR_WRONG_PARAMETERS_SIZE, "Inline class must have exactly one primary constructor parameter"); // + + MAP.put(VALUE_CLASS_CONSTRUCTOR_NOT_FINAL_READ_ONLY_PARAMETER, "Value class primary constructor must have only final read-only (val) property parameter"); + MAP.put(PROPERTY_WITH_BACKING_FIELD_INSIDE_VALUE_CLASS, "Value class cannot have properties with backing fields"); + MAP.put(DELEGATED_PROPERTY_INSIDE_VALUE_CLASS, "Value class cannot have delegated properties"); + MAP.put(VALUE_CLASS_HAS_INAPPLICABLE_PARAMETER_TYPE, "Value class cannot have value parameter of type ''{0}''", RENDER_TYPE); + MAP.put(VALUE_CLASS_CANNOT_IMPLEMENT_INTERFACE_BY_DELEGATION, "Value class cannot implement an interface by delegation"); + MAP.put(VALUE_CLASS_CANNOT_EXTEND_CLASSES, "Value class cannot extend classes"); + MAP.put(VALUE_CLASS_CANNOT_BE_RECURSIVE, "Value class cannot be recursive"); + MAP.put(RESERVED_MEMBER_INSIDE_VALUE_CLASS, "Member with the name ''{0}'' is reserved for future releases", STRING); + MAP.put(SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_VALUE_CLASS, "Secondary constructors with bodies are reserved for for future releases"); + MAP.put(INNER_CLASS_INSIDE_VALUE_CLASS, "Value class cannot have inner classes"); MAP.put(VALUE_CLASS_CANNOT_BE_CLONEABLE, "Value class cannot be Cloneable"); MAP.put(INLINE_CLASS_DEPRECATED, "'inline' modifier is deprecated. Use 'value' instead"); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/InlineClassDeclarationChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/InlineClassDeclarationChecker.kt index 3d99fd989df..1c2632b6a14 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/InlineClassDeclarationChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/checkers/InlineClassDeclarationChecker.kt @@ -54,19 +54,19 @@ object InlineClassDeclarationChecker : DeclarationChecker { require(inlineOrValueKeyword != null) { "Declaration of inline class must have 'inline' keyword" } if (descriptor.isInner || DescriptorUtils.isLocal(descriptor)) { - trace.report(Errors.INLINE_CLASS_NOT_TOP_LEVEL.on(inlineOrValueKeyword)) + trace.report(Errors.VALUE_CLASS_NOT_TOP_LEVEL.on(inlineOrValueKeyword)) return } val modalityModifier = declaration.modalityModifier() if (modalityModifier != null && descriptor.modality != Modality.FINAL) { - trace.report(Errors.INLINE_CLASS_NOT_FINAL.on(modalityModifier)) + trace.report(Errors.VALUE_CLASS_NOT_FINAL.on(modalityModifier)) return } val primaryConstructor = declaration.primaryConstructor if (primaryConstructor == null) { - trace.report(Errors.ABSENCE_OF_PRIMARY_CONSTRUCTOR_FOR_INLINE_CLASS.on(inlineOrValueKeyword)) + trace.report(Errors.ABSENCE_OF_PRIMARY_CONSTRUCTOR_FOR_VALUE_CLASS.on(inlineOrValueKeyword)) return } @@ -79,7 +79,7 @@ object InlineClassDeclarationChecker : DeclarationChecker { } if (!isParameterAcceptableForInlineClass(baseParameter)) { - trace.report(Errors.INLINE_CLASS_CONSTRUCTOR_NOT_FINAL_READ_ONLY_PARAMETER.on(baseParameter)) + trace.report(Errors.VALUE_CLASS_CONSTRUCTOR_NOT_FINAL_READ_ONLY_PARAMETER.on(baseParameter)) return } @@ -87,26 +87,26 @@ object InlineClassDeclarationChecker : DeclarationChecker { val baseParameterTypeReference = baseParameter.typeReference if (baseParameterType != null && baseParameterTypeReference != null) { if (baseParameterType.isInapplicableParameterType()) { - trace.report(Errors.INLINE_CLASS_HAS_INAPPLICABLE_PARAMETER_TYPE.on(baseParameterTypeReference, baseParameterType)) + trace.report(Errors.VALUE_CLASS_HAS_INAPPLICABLE_PARAMETER_TYPE.on(baseParameterTypeReference, baseParameterType)) return } if (baseParameterType.isRecursiveInlineClassType()) { - trace.report(Errors.INLINE_CLASS_CANNOT_BE_RECURSIVE.on(baseParameterTypeReference)) + trace.report(Errors.VALUE_CLASS_CANNOT_BE_RECURSIVE.on(baseParameterTypeReference)) return } } for (supertypeEntry in declaration.superTypeListEntries) { if (supertypeEntry is KtDelegatedSuperTypeEntry) { - trace.report(Errors.INLINE_CLASS_CANNOT_IMPLEMENT_INTERFACE_BY_DELEGATION.on(supertypeEntry)) + trace.report(Errors.VALUE_CLASS_CANNOT_IMPLEMENT_INTERFACE_BY_DELEGATION.on(supertypeEntry)) return } else { val typeReference = supertypeEntry.typeReference ?: continue val type = trace[BindingContext.TYPE, typeReference] ?: continue val typeDescriptor = type.constructor.declarationDescriptor ?: continue if (!DescriptorUtils.isInterface(typeDescriptor)) { - trace.report(Errors.INLINE_CLASS_CANNOT_EXTEND_CLASSES.on(typeReference)) + trace.report(Errors.VALUE_CLASS_CANNOT_EXTEND_CLASSES.on(typeReference)) return } } @@ -146,11 +146,11 @@ class PropertiesWithBackingFieldsInsideInlineClass : DeclarationChecker { if (!descriptor.containingDeclaration.isInlineClass()) return if (context.trace.get(BindingContext.BACKING_FIELD_REQUIRED, descriptor) == true) { - context.trace.report(Errors.PROPERTY_WITH_BACKING_FIELD_INSIDE_INLINE_CLASS.on(declaration)) + context.trace.report(Errors.PROPERTY_WITH_BACKING_FIELD_INSIDE_VALUE_CLASS.on(declaration)) } declaration.delegate?.let { - context.trace.report(Errors.DELEGATED_PROPERTY_INSIDE_INLINE_CLASS.on(it)) + context.trace.report(Errors.DELEGATED_PROPERTY_INSIDE_VALUE_CLASS.on(it)) } } } @@ -163,7 +163,7 @@ class InnerClassInsideInlineClass : DeclarationChecker { if (!descriptor.containingDeclaration.isInlineClass()) return - context.trace.report(Errors.INNER_CLASS_INSIDE_INLINE_CLASS.on(declaration.modifierList!!.getModifier(KtTokens.INNER_KEYWORD)!!)) + context.trace.report(Errors.INNER_CLASS_INSIDE_VALUE_CLASS.on(declaration.modifierList!!.getModifier(KtTokens.INNER_KEYWORD)!!)) } } @@ -185,7 +185,7 @@ class ReservedMembersAndConstructsForInlineClass : DeclarationChecker { val functionName = descriptor.name.asString() if (functionName in reservedFunctions) { val nameIdentifier = ktFunction.nameIdentifier ?: return - context.trace.report(Errors.RESERVED_MEMBER_INSIDE_INLINE_CLASS.on(nameIdentifier, functionName)) + context.trace.report(Errors.RESERVED_MEMBER_INSIDE_VALUE_CLASS.on(nameIdentifier, functionName)) } } @@ -194,7 +194,7 @@ class ReservedMembersAndConstructsForInlineClass : DeclarationChecker { val bodyExpression = secondaryConstructor.bodyExpression if (secondaryConstructor.hasBlockBody() && bodyExpression is KtBlockExpression) { val lBrace = bodyExpression.lBrace ?: return - context.trace.report(Errors.SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_INLINE_CLASS.on(lBrace)) + context.trace.report(Errors.SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_VALUE_CLASS.on(lBrace)) } } } diff --git a/compiler/testData/codegen/box/inlineClasses/boxImplDoesNotExecuteInSecondaryConstructor.kt b/compiler/testData/codegen/box/inlineClasses/boxImplDoesNotExecuteInSecondaryConstructor.kt index b21f11e86bf..946b333ea4a 100644 --- a/compiler/testData/codegen/box/inlineClasses/boxImplDoesNotExecuteInSecondaryConstructor.kt +++ b/compiler/testData/codegen/box/inlineClasses/boxImplDoesNotExecuteInSecondaryConstructor.kt @@ -3,7 +3,7 @@ @Suppress("OPTIONAL_DECLARATION_USAGE_IN_NON_COMMON_SOURCE") @kotlin.jvm.JvmInline value class IC private constructor(val i: Int) { - @Suppress("SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_INLINE_CLASS") + @Suppress("SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_VALUE_CLASS") constructor() : this(0) { counter += 1 } diff --git a/compiler/testData/codegen/box/inlineClasses/inlineClassWithCustomEquals.kt b/compiler/testData/codegen/box/inlineClasses/inlineClassWithCustomEquals.kt index a6fb2e9eab5..018b07f9ba3 100644 --- a/compiler/testData/codegen/box/inlineClasses/inlineClassWithCustomEquals.kt +++ b/compiler/testData/codegen/box/inlineClasses/inlineClassWithCustomEquals.kt @@ -3,7 +3,7 @@ // IGNORE_BACKEND: JVM_IR // WITH_RUNTIME -@file:Suppress("RESERVED_MEMBER_INSIDE_INLINE_CLASS") +@file:Suppress("RESERVED_MEMBER_INSIDE_VALUE_CLASS") @Suppress("OPTIONAL_DECLARATION_USAGE_IN_NON_COMMON_SOURCE") @kotlin.jvm.JvmInline diff --git a/compiler/testData/codegen/box/inlineClasses/kt27705.kt b/compiler/testData/codegen/box/inlineClasses/kt27705.kt index c6f17a2f155..f0a7f273782 100644 --- a/compiler/testData/codegen/box/inlineClasses/kt27705.kt +++ b/compiler/testData/codegen/box/inlineClasses/kt27705.kt @@ -3,7 +3,7 @@ @Suppress("OPTIONAL_DECLARATION_USAGE_IN_NON_COMMON_SOURCE") @kotlin.jvm.JvmInline value class Z(val x: Int) { - @Suppress("INNER_CLASS_INSIDE_INLINE_CLASS") + @Suppress("INNER_CLASS_INSIDE_VALUE_CLASS") inner class Inner(val y: Int) { val xx = x } diff --git a/compiler/testData/codegen/box/inlineClasses/kt27706.kt b/compiler/testData/codegen/box/inlineClasses/kt27706.kt index 6ff72a15005..a6820b7bea8 100644 --- a/compiler/testData/codegen/box/inlineClasses/kt27706.kt +++ b/compiler/testData/codegen/box/inlineClasses/kt27706.kt @@ -3,7 +3,7 @@ @Suppress("OPTIONAL_DECLARATION_USAGE_IN_NON_COMMON_SOURCE") @kotlin.jvm.JvmInline value class Z(val x: Int) { - @Suppress("INNER_CLASS_INSIDE_INLINE_CLASS") + @Suppress("INNER_CLASS_INSIDE_VALUE_CLASS") inner class Inner(val z: Z) { val xx = x } diff --git a/compiler/testData/codegen/box/inlineClasses/secondaryConstructorsInsideInlineClass.kt b/compiler/testData/codegen/box/inlineClasses/secondaryConstructorsInsideInlineClass.kt index 0ada043f7b7..912f7137ddf 100644 --- a/compiler/testData/codegen/box/inlineClasses/secondaryConstructorsInsideInlineClass.kt +++ b/compiler/testData/codegen/box/inlineClasses/secondaryConstructorsInsideInlineClass.kt @@ -1,6 +1,6 @@ // WITH_RUNTIME -@file:Suppress("SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_INLINE_CLASS") +@file:Suppress("SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_VALUE_CLASS") var global = "wrong" diff --git a/compiler/testData/codegen/box/inlineClasses/secondaryConstructorsInsideInlineClassWithPrimitiveCarrierType.kt b/compiler/testData/codegen/box/inlineClasses/secondaryConstructorsInsideInlineClassWithPrimitiveCarrierType.kt index a1d47118dbf..e6440133fd7 100644 --- a/compiler/testData/codegen/box/inlineClasses/secondaryConstructorsInsideInlineClassWithPrimitiveCarrierType.kt +++ b/compiler/testData/codegen/box/inlineClasses/secondaryConstructorsInsideInlineClassWithPrimitiveCarrierType.kt @@ -9,7 +9,7 @@ value class Foo(val x: Int) { constructor(z: Long) : this(z.toInt() + 1) - @Suppress("SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_INLINE_CLASS") + @Suppress("SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_VALUE_CLASS") constructor(other: Char) : this(other.toInt().toString()) { global = "OK" } diff --git a/compiler/testData/codegen/box/inlineClasses/simpleSecondaryConstructor.kt b/compiler/testData/codegen/box/inlineClasses/simpleSecondaryConstructor.kt index 58f63172de1..e365f73d8e7 100644 --- a/compiler/testData/codegen/box/inlineClasses/simpleSecondaryConstructor.kt +++ b/compiler/testData/codegen/box/inlineClasses/simpleSecondaryConstructor.kt @@ -4,7 +4,7 @@ // IGNORE_BACKEND: JS_IR_ES6 // WITH_RUNTIME -@file:Suppress("SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_INLINE_CLASS") +@file:Suppress("SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_VALUE_CLASS") @Suppress("OPTIONAL_DECLARATION_USAGE_IN_NON_COMMON_SOURCE") @kotlin.jvm.JvmInline diff --git a/compiler/testData/codegen/box/reflection/call/inlineClasses/constructorWithInlineClassParameters.kt b/compiler/testData/codegen/box/reflection/call/inlineClasses/constructorWithInlineClassParameters.kt index fb2716354de..19ef1becae5 100644 --- a/compiler/testData/codegen/box/reflection/call/inlineClasses/constructorWithInlineClassParameters.kt +++ b/compiler/testData/codegen/box/reflection/call/inlineClasses/constructorWithInlineClassParameters.kt @@ -12,7 +12,7 @@ class Outer(val z1: Z) { } inline class InlineOuter(val z1: Z) { - @Suppress("INNER_CLASS_INSIDE_INLINE_CLASS") + @Suppress("INNER_CLASS_INSIDE_VALUE_CLASS") inner class Inner(val z2: Z) { val test = "$z1 $z2" } diff --git a/compiler/testData/diagnostics/tests/inlineClasses/basicInlineClassDeclarationDisabled.fir.kt b/compiler/testData/diagnostics/tests/inlineClasses/basicInlineClassDeclarationDisabled.fir.kt index 7f4c16190d7..e925d84753a 100644 --- a/compiler/testData/diagnostics/tests/inlineClasses/basicInlineClassDeclarationDisabled.fir.kt +++ b/compiler/testData/diagnostics/tests/inlineClasses/basicInlineClassDeclarationDisabled.fir.kt @@ -7,4 +7,4 @@ inline class Foo(val x: Int) inline object InlineObject inline enum class InlineEnum -inline class NotVal(x: Int) +inline class NotVal(x: Int) diff --git a/compiler/testData/diagnostics/tests/inlineClasses/basicInlineClassDeclarationDisabled.kt b/compiler/testData/diagnostics/tests/inlineClasses/basicInlineClassDeclarationDisabled.kt index 69349b88485..b24fe29b8d9 100644 --- a/compiler/testData/diagnostics/tests/inlineClasses/basicInlineClassDeclarationDisabled.kt +++ b/compiler/testData/diagnostics/tests/inlineClasses/basicInlineClassDeclarationDisabled.kt @@ -7,4 +7,4 @@ inline object InlineObject inline enum class InlineEnum -inline class NotVal(x: Int) \ No newline at end of file +inline class NotVal(x: Int) \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inlineClasses/delegatedPropertyInInlineClass.fir.kt b/compiler/testData/diagnostics/tests/inlineClasses/delegatedPropertyInInlineClass.fir.kt index 6078d277be2..167656e82a7 100644 --- a/compiler/testData/diagnostics/tests/inlineClasses/delegatedPropertyInInlineClass.fir.kt +++ b/compiler/testData/diagnostics/tests/inlineClasses/delegatedPropertyInInlineClass.fir.kt @@ -20,9 +20,9 @@ object VarObject { } inline class Z(val data: Int) { - val testVal by Val() - var testVar by Var() + val testVal by Val() + var testVar by Var() - val testValBySingleton by ValObject - var testVarBySingleton by VarObject + val testValBySingleton by ValObject + var testVarBySingleton by VarObject } diff --git a/compiler/testData/diagnostics/tests/inlineClasses/delegatedPropertyInInlineClass.kt b/compiler/testData/diagnostics/tests/inlineClasses/delegatedPropertyInInlineClass.kt index c677dc5ebd8..b5cd2cc4268 100644 --- a/compiler/testData/diagnostics/tests/inlineClasses/delegatedPropertyInInlineClass.kt +++ b/compiler/testData/diagnostics/tests/inlineClasses/delegatedPropertyInInlineClass.kt @@ -20,9 +20,9 @@ object VarObject { } inline class Z(val data: Int) { - val testVal by Val() - var testVar by Var() + val testVal by Val() + var testVar by Var() - val testValBySingleton by ValObject - var testVarBySingleton by VarObject + val testValBySingleton by ValObject + var testVarBySingleton by VarObject } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inlineClasses/inlineClassCanOnlyImplementInterfaces.kt b/compiler/testData/diagnostics/tests/inlineClasses/inlineClassCanOnlyImplementInterfaces.kt index e8fb24cbfce..897a37970e1 100644 --- a/compiler/testData/diagnostics/tests/inlineClasses/inlineClassCanOnlyImplementInterfaces.kt +++ b/compiler/testData/diagnostics/tests/inlineClasses/inlineClassCanOnlyImplementInterfaces.kt @@ -7,8 +7,8 @@ open class OpenBaseClass interface BaseInterface -inline class TestExtendsAbstractClass(val x: Int) : AbstractBaseClass() +inline class TestExtendsAbstractClass(val x: Int) : AbstractBaseClass() -inline class TestExtendsOpenClass(val x: Int) : OpenBaseClass() +inline class TestExtendsOpenClass(val x: Int) : OpenBaseClass() inline class TestImplementsInterface(val x: Int) : BaseInterface \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inlineClasses/inlineClassCannotImplementInterfaceByDelegation.fir.kt b/compiler/testData/diagnostics/tests/inlineClasses/inlineClassCannotImplementInterfaceByDelegation.fir.kt index 81570804f55..e389a728b36 100644 --- a/compiler/testData/diagnostics/tests/inlineClasses/inlineClassCannotImplementInterfaceByDelegation.fir.kt +++ b/compiler/testData/diagnostics/tests/inlineClasses/inlineClassCannotImplementInterfaceByDelegation.fir.kt @@ -4,6 +4,6 @@ interface IFoo object FooImpl : IFoo -inline class Test1(val x: Any) : IFoo by FooImpl +inline class Test1(val x: Any) : IFoo by FooImpl -inline class Test2(val x: IFoo) : IFoo by x +inline class Test2(val x: IFoo) : IFoo by x diff --git a/compiler/testData/diagnostics/tests/inlineClasses/inlineClassCannotImplementInterfaceByDelegation.kt b/compiler/testData/diagnostics/tests/inlineClasses/inlineClassCannotImplementInterfaceByDelegation.kt index 10a855b9089..7a20bfab1b0 100644 --- a/compiler/testData/diagnostics/tests/inlineClasses/inlineClassCannotImplementInterfaceByDelegation.kt +++ b/compiler/testData/diagnostics/tests/inlineClasses/inlineClassCannotImplementInterfaceByDelegation.kt @@ -4,6 +4,6 @@ interface IFoo object FooImpl : IFoo -inline class Test1(val x: Any) : IFoo by FooImpl +inline class Test1(val x: Any) : IFoo by FooImpl -inline class Test2(val x: IFoo) : IFoo by x \ No newline at end of file +inline class Test2(val x: IFoo) : IFoo by x \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inlineClasses/inlineClassDeclarationCheck.fir.kt b/compiler/testData/diagnostics/tests/inlineClasses/inlineClassDeclarationCheck.fir.kt index 8f6a1027058..5ad1a241631 100644 --- a/compiler/testData/diagnostics/tests/inlineClasses/inlineClassDeclarationCheck.fir.kt +++ b/compiler/testData/diagnostics/tests/inlineClasses/inlineClassDeclarationCheck.fir.kt @@ -3,38 +3,38 @@ inline class A0(val x: Int) -inline class A1 +inline class A1 inline class A2() -inline class A3(x: Int) -inline class A4(var x: Int) +inline class A3(x: Int) +inline class A4(var x: Int) inline class A5(val x: Int, val y: Int) inline class A6(x: Int, val y: Int) -inline class A7(vararg val x: Int) -inline class A8(open val x: Int) +inline class A7(vararg val x: Int) +inline class A8(open val x: Int) inline class A9(final val x: Int) class B1 { companion object { inline class C1(val x: Int) - inner inline class C11(val x: Int) + inner inline class C11(val x: Int) } inline class C2(val x: Int) - inner inline class C21(val x: Int) + inner inline class C21(val x: Int) } object B2 { inline class C3(val x: Int) - inner inline class C31(val x: Int) + inner inline class C31(val x: Int) } fun foo() { - inline class C4(val x: Int) + inline class C4(val x: Int) } final inline class D0(val x: Int) -open inline class D1(val x: Int) -abstract inline class D2(val x: Int) -sealed inline class D3(val x: Int) +open inline class D1(val x: Int) +abstract inline class D2(val x: Int) +sealed inline class D3(val x: Int) inline data class D4(val x: String) diff --git a/compiler/testData/diagnostics/tests/inlineClasses/inlineClassDeclarationCheck.kt b/compiler/testData/diagnostics/tests/inlineClasses/inlineClassDeclarationCheck.kt index 55dc2157158..42ad38b8bf5 100644 --- a/compiler/testData/diagnostics/tests/inlineClasses/inlineClassDeclarationCheck.kt +++ b/compiler/testData/diagnostics/tests/inlineClasses/inlineClassDeclarationCheck.kt @@ -3,14 +3,14 @@ inline class A0(val x: Int) -inline class A1 +inline class A1 inline class A2() -inline class A3(x: Int) -inline class A4(var x: Int) +inline class A3(x: Int) +inline class A4(var x: Int) inline class A5(val x: Int, val y: Int) inline class A6(x: Int, val y: Int) -inline class A7(vararg val x: Int) -inline class A8(open val x: Int) +inline class A7(vararg val x: Int) +inline class A8(open val x: Int) inline class A9(final val x: Int) class B1 { @@ -20,7 +20,7 @@ class B1 { } inline class C2(val x: Int) - inner inline class C21(val x: Int) + inner inline class C21(val x: Int) } object B2 { @@ -29,12 +29,12 @@ object B2 { } fun foo() { - inline class C4(val x: Int) + inline class C4(val x: Int) } final inline class D0(val x: Int) -open inline class D1(val x: Int) -abstract inline class D2(val x: Int) -sealed inline class D3(val x: Int) +open inline class D1(val x: Int) +abstract inline class D2(val x: Int) +sealed inline class D3(val x: Int) inline data class D4(val x: String) diff --git a/compiler/testData/diagnostics/tests/inlineClasses/inlineClassWithForbiddenUnderlyingType.kt b/compiler/testData/diagnostics/tests/inlineClasses/inlineClassWithForbiddenUnderlyingType.kt index 7970009df22..ae7a756af43 100644 --- a/compiler/testData/diagnostics/tests/inlineClasses/inlineClassWithForbiddenUnderlyingType.kt +++ b/compiler/testData/diagnostics/tests/inlineClasses/inlineClassWithForbiddenUnderlyingType.kt @@ -1,17 +1,17 @@ // FIR_IDENTICAL // !LANGUAGE: +InlineClasses, -JvmInlineValueClasses -inline class Foo(val x: T) -inline class FooNullable(val x: T?) +inline class Foo(val x: T) +inline class FooNullable(val x: T?) -inline class FooGenericArray(val x: Array) -inline class FooGenericArray2(val x: Array>) +inline class FooGenericArray(val x: Array) +inline class FooGenericArray2(val x: Array>) inline class FooStarProjectedArray(val x: Array<*>) inline class FooStarProjectedArray2(val x: Array>) -inline class Bar(val u: Unit) +inline class Bar(val u: Unit) inline class BarNullable(val u: Unit?) -inline class Baz(val u: Nothing) +inline class Baz(val u: Nothing) inline class BazNullable(val u: Nothing?) diff --git a/compiler/testData/diagnostics/tests/inlineClasses/innerClassInsideInlineClass.fir.kt b/compiler/testData/diagnostics/tests/inlineClasses/innerClassInsideInlineClass.fir.kt index 8febc04f811..bf01f42d614 100644 --- a/compiler/testData/diagnostics/tests/inlineClasses/innerClassInsideInlineClass.fir.kt +++ b/compiler/testData/diagnostics/tests/inlineClasses/innerClassInsideInlineClass.fir.kt @@ -2,7 +2,7 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE inline class Foo(val x: Int) { - inner class InnerC - inner object InnerO - inner interface InnerI + inner class InnerC + inner object InnerO + inner interface InnerI } diff --git a/compiler/testData/diagnostics/tests/inlineClasses/innerClassInsideInlineClass.kt b/compiler/testData/diagnostics/tests/inlineClasses/innerClassInsideInlineClass.kt index 35c0d17b85a..4157f2eead2 100644 --- a/compiler/testData/diagnostics/tests/inlineClasses/innerClassInsideInlineClass.kt +++ b/compiler/testData/diagnostics/tests/inlineClasses/innerClassInsideInlineClass.kt @@ -2,7 +2,7 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE inline class Foo(val x: Int) { - inner class InnerC + inner class InnerC inner object InnerO inner interface InnerI } diff --git a/compiler/testData/diagnostics/tests/inlineClasses/propertiesWithBackingFieldsInsideInlineClass.kt b/compiler/testData/diagnostics/tests/inlineClasses/propertiesWithBackingFieldsInsideInlineClass.kt index 305931974d1..559a97e3cc7 100644 --- a/compiler/testData/diagnostics/tests/inlineClasses/propertiesWithBackingFieldsInsideInlineClass.kt +++ b/compiler/testData/diagnostics/tests/inlineClasses/propertiesWithBackingFieldsInsideInlineClass.kt @@ -14,13 +14,13 @@ inline class Foo(val x: Int) : A, B { val a0 get() = 0 - val a1 = 0 + val a1 = 0 var a2: Int get() = 1 set(value) {} - var a3: Int = 0 + var a3: Int = 0 get() = 1 set(value) { field = value @@ -29,7 +29,7 @@ inline class Foo(val x: Int) : A, B { override val goodSize: Int get() = 0 - override val badSize: Int = 0 + override val badSize: Int = 0 - lateinit var lateinitProperty: String + lateinit var lateinitProperty: String } diff --git a/compiler/testData/diagnostics/tests/inlineClasses/recursiveInlineClasses.kt b/compiler/testData/diagnostics/tests/inlineClasses/recursiveInlineClasses.kt index 9c5ff061e47..f2a05c8d59d 100644 --- a/compiler/testData/diagnostics/tests/inlineClasses/recursiveInlineClasses.kt +++ b/compiler/testData/diagnostics/tests/inlineClasses/recursiveInlineClasses.kt @@ -1,22 +1,22 @@ // FIR_IDENTICAL // !LANGUAGE: +InlineClasses, -JvmInlineValueClasses -inline class Test1(val x: Test1) +inline class Test1(val x: Test1) -inline class Test2A(val x: Test2B) -inline class Test2B(val x: Test2A) +inline class Test2A(val x: Test2B) +inline class Test2B(val x: Test2A) -inline class Test3A(val x: Test3B) -inline class Test3B(val x: Test3C) -inline class Test3C(val x: Test3A) +inline class Test3A(val x: Test3B) +inline class Test3B(val x: Test3C) +inline class Test3C(val x: Test3A) -inline class TestNullable(val x: TestNullable?) +inline class TestNullable(val x: TestNullable?) inline class TestRecursionInTypeArguments(val x: List) inline class TestRecursionInArray(val x: Array) -inline class TestRecursionInUpperBounds>(val x: T) +inline class TestRecursionInUpperBounds>(val x: T) -inline class Id(val x: T) +inline class Id(val x: T) inline class TestRecursionThroughId(val x: Id) \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/inlineClasses/reservedMembersAndConstructsInsideInlineClass.fir.kt b/compiler/testData/diagnostics/tests/inlineClasses/reservedMembersAndConstructsInsideInlineClass.fir.kt index 5a44a079fee..a03875eb0de 100644 --- a/compiler/testData/diagnostics/tests/inlineClasses/reservedMembersAndConstructsInsideInlineClass.fir.kt +++ b/compiler/testData/diagnostics/tests/inlineClasses/reservedMembersAndConstructsInsideInlineClass.fir.kt @@ -2,32 +2,32 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER inline class IC1(val x: Any) { - fun box() {} - fun box(x: Any) {} + fun box() {} + fun box(x: Any) {} - fun unbox() {} - fun unbox(x: Any) {} + fun unbox() {} + fun unbox(x: Any) {} - override fun equals(other: Any?): Boolean = true - override fun hashCode(): Int = 0 + override fun equals(other: Any?): Boolean = true + override fun hashCode(): Int = 0 } inline class IC2(val x: Any) { - fun box(x: Any) {} - fun box(): Any = TODO() + fun box(x: Any) {} + fun box(): Any = TODO() - fun unbox(x: Any) {} - fun unbox(): Any = TODO() + fun unbox(x: Any) {} + fun unbox(): Any = TODO() - fun equals(my: Any, other: Any): Boolean = true - fun hashCode(a: Any): Int = 0 + fun equals(my: Any, other: Any): Boolean = true + fun hashCode(a: Any): Int = 0 } inline class IC3(val x: Any) { - fun box(x: Any): Any = TODO() - fun unbox(x: Any): Any = TODO() + fun box(x: Any): Any = TODO() + fun unbox(x: Any): Any = TODO() - fun equals(): Boolean = true + fun equals(): Boolean = true } interface WithBox { @@ -35,11 +35,11 @@ interface WithBox { } inline class IC4(val s: String) : WithBox { - override fun box(): String = "" + override fun box(): String = "" } inline class IC5(val a: String) { - constructor(i: Int) : this(i.toString()) { + constructor(i: Int) : this(i.toString()) { TODO("something") } } diff --git a/compiler/testData/diagnostics/tests/inlineClasses/reservedMembersAndConstructsInsideInlineClass.kt b/compiler/testData/diagnostics/tests/inlineClasses/reservedMembersAndConstructsInsideInlineClass.kt index 3aadda3104c..d8ff8e5ac72 100644 --- a/compiler/testData/diagnostics/tests/inlineClasses/reservedMembersAndConstructsInsideInlineClass.kt +++ b/compiler/testData/diagnostics/tests/inlineClasses/reservedMembersAndConstructsInsideInlineClass.kt @@ -2,32 +2,32 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER inline class IC1(val x: Any) { - fun box() {} - fun box(x: Any) {} + fun box() {} + fun box(x: Any) {} - fun unbox() {} - fun unbox(x: Any) {} + fun unbox() {} + fun unbox(x: Any) {} - override fun equals(other: Any?): Boolean = true - override fun hashCode(): Int = 0 + override fun equals(other: Any?): Boolean = true + override fun hashCode(): Int = 0 } inline class IC2(val x: Any) { - fun box(x: Any) {} - fun box(): Any = TODO() + fun box(x: Any) {} + fun box(): Any = TODO() - fun unbox(x: Any) {} - fun unbox(): Any = TODO() + fun unbox(x: Any) {} + fun unbox(): Any = TODO() - fun equals(my: Any, other: Any): Boolean = true - fun hashCode(a: Any): Int = 0 + fun equals(my: Any, other: Any): Boolean = true + fun hashCode(a: Any): Int = 0 } inline class IC3(val x: Any) { - fun box(x: Any): Any = TODO() - fun unbox(x: Any): Any = TODO() + fun box(x: Any): Any = TODO() + fun unbox(x: Any): Any = TODO() - fun equals(): Boolean = true + fun equals(): Boolean = true } interface WithBox { @@ -35,11 +35,11 @@ interface WithBox { } inline class IC4(val s: String) : WithBox { - override fun box(): String = "" + override fun box(): String = "" } inline class IC5(val a: String) { - constructor(i: Int) : this(i.toString()) { + constructor(i: Int) : this(i.toString()) { TODO("something") } } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/multiplatform/inlineClasses/expectActualInlineClass.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/inlineClasses/expectActualInlineClass.fir.kt index dfb2e466e3e..432b6333128 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/inlineClasses/expectActualInlineClass.fir.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/inlineClasses/expectActualInlineClass.fir.kt @@ -8,7 +8,7 @@ expect inline class Foo1(val x: Int) { expect inline class Foo2(val x: Int) -expect inline class Foo3 +expect inline class Foo3 expect class NonInlineExpect @@ -21,7 +21,7 @@ actual inline class Foo1(val x: Int) { actual fun bar(): String = "Hello" } actual inline class Foo2(val x: String) -actual inline class Foo3 +actual inline class Foo3 actual inline class NonInlineExpect(val x: Int) diff --git a/compiler/testData/diagnostics/tests/multiplatform/inlineClasses/expectActualInlineClass.kt b/compiler/testData/diagnostics/tests/multiplatform/inlineClasses/expectActualInlineClass.kt index 2dd69e286af..9f8199b1e06 100644 --- a/compiler/testData/diagnostics/tests/multiplatform/inlineClasses/expectActualInlineClass.kt +++ b/compiler/testData/diagnostics/tests/multiplatform/inlineClasses/expectActualInlineClass.kt @@ -8,7 +8,7 @@ expect inline class Foo1(val x: Int) { expect inline class Foo2(val x: Int) -expect inline class Foo3 +expect inline class Foo3 expect class NonInlineExpect @@ -21,7 +21,7 @@ actual inline class Foo1(val x: Int) { actual fun bar(): String = "Hello" } actual inline class Foo2(val x: String) -actual inline class Foo3 +actual inline class Foo3 actual inline class NonInlineExpect(val x: Int) diff --git a/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.kt b/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.kt index 9d396da1078..33c7f9f9410 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/basicValueClassDeclarationDisabled.kt @@ -15,4 +15,4 @@ annotation class JvmInline value enum class InlineEnum @JvmInline -value class NotVal(x: Int) +value class NotVal(x: Int) diff --git a/compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.fir.kt index 84431819bd0..5a2d781df54 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.fir.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.fir.kt @@ -26,9 +26,9 @@ object VarObject { @JvmInline value class Z(val data: Int) { - val testVal by Val() - var testVar by Var() + val testVal by Val() + var testVar by Var() - val testValBySingleton by ValObject - var testVarBySingleton by VarObject + val testValBySingleton by ValObject + var testVarBySingleton by VarObject } diff --git a/compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.kt b/compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.kt index b4ba9da6d1c..d0ac3ace7ec 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/delegatedPropertyInValueClass.kt @@ -26,9 +26,9 @@ object VarObject { @JvmInline value class Z(val data: Int) { - val testVal by Val() - var testVar by Var() + val testVal by Val() + var testVar by Var() - val testValBySingleton by ValObject - var testVarBySingleton by VarObject + val testValBySingleton by ValObject + var testVarBySingleton by VarObject } diff --git a/compiler/testData/diagnostics/tests/valueClasses/propertiesWithBackingFieldsInsideValueClass.kt b/compiler/testData/diagnostics/tests/valueClasses/propertiesWithBackingFieldsInsideValueClass.kt index 634c51a8e8b..0825d056eb0 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/propertiesWithBackingFieldsInsideValueClass.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/propertiesWithBackingFieldsInsideValueClass.kt @@ -20,13 +20,13 @@ value class Foo(val x: Int) : A, B { val a0 get() = 0 - val a1 = 0 + val a1 = 0 var a2: Int get() = 1 set(value) {} - var a3: Int = 0 + var a3: Int = 0 get() = 1 set(value) { field = value @@ -35,7 +35,7 @@ value class Foo(val x: Int) : A, B { override val goodSize: Int get() = 0 - override val badSize: Int = 0 + override val badSize: Int = 0 - lateinit var lateinitProperty: String + lateinit var lateinitProperty: String } diff --git a/compiler/testData/diagnostics/tests/valueClasses/recursiveValueClasses.kt b/compiler/testData/diagnostics/tests/valueClasses/recursiveValueClasses.kt index 0b4ab1e319f..019e85c0b2d 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/recursiveValueClasses.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/recursiveValueClasses.kt @@ -7,22 +7,22 @@ package kotlin.jvm annotation class JvmInline @JvmInline -value class Test1(val x: Test1) +value class Test1(val x: Test1) @JvmInline -value class Test2A(val x: Test2B) +value class Test2A(val x: Test2B) @JvmInline -value class Test2B(val x: Test2A) +value class Test2B(val x: Test2A) @JvmInline -value class Test3A(val x: Test3B) +value class Test3A(val x: Test3B) @JvmInline -value class Test3B(val x: Test3C) +value class Test3B(val x: Test3C) @JvmInline -value class Test3C(val x: Test3A) +value class Test3C(val x: Test3A) @JvmInline -value class TestNullable(val x: TestNullable?) +value class TestNullable(val x: TestNullable?) @JvmInline value class TestRecursionInTypeArguments(val x: List) @@ -31,9 +31,9 @@ value class TestRecursionInTypeArguments(val x: List) @JvmInline -value class TestRecursionInUpperBounds>(val x: T) +value class TestRecursionInUpperBounds>(val x: T) @JvmInline -value class Id(val x: T) +value class Id(val x: T) @JvmInline value class TestRecursionThroughId(val x: Id) diff --git a/compiler/testData/diagnostics/tests/valueClasses/reservedMembersAndConstructsInsideValueClass.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/reservedMembersAndConstructsInsideValueClass.fir.kt index ec08f5bd6e8..c3e9c80183f 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/reservedMembersAndConstructsInsideValueClass.fir.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/reservedMembersAndConstructsInsideValueClass.fir.kt @@ -8,34 +8,34 @@ annotation class JvmInline @JvmInline value class IC1(val x: Any) { - fun box() {} - fun box(x: Any) {} + fun box() {} + fun box(x: Any) {} - fun unbox() {} - fun unbox(x: Any) {} + fun unbox() {} + fun unbox(x: Any) {} - override fun equals(other: Any?): Boolean = true - override fun hashCode(): Int = 0 + override fun equals(other: Any?): Boolean = true + override fun hashCode(): Int = 0 } @JvmInline value class IC2(val x: Any) { - fun box(x: Any) {} - fun box(): Any = TODO() + fun box(x: Any) {} + fun box(): Any = TODO() - fun unbox(x: Any) {} - fun unbox(): Any = TODO() + fun unbox(x: Any) {} + fun unbox(): Any = TODO() - fun equals(my: Any, other: Any): Boolean = true - fun hashCode(a: Any): Int = 0 + fun equals(my: Any, other: Any): Boolean = true + fun hashCode(a: Any): Int = 0 } @JvmInline value class IC3(val x: Any) { - fun box(x: Any): Any = TODO() - fun unbox(x: Any): Any = TODO() + fun box(x: Any): Any = TODO() + fun unbox(x: Any): Any = TODO() - fun equals(): Boolean = true + fun equals(): Boolean = true } interface WithBox { @@ -44,12 +44,12 @@ interface WithBox { @JvmInline value class IC4(val s: String) : WithBox { - override fun box(): String = "" + override fun box(): String = "" } @JvmInline value class IC5(val a: String) { - constructor(i: Int) : this(i.toString()) { + constructor(i: Int) : this(i.toString()) { TODO("something") } } diff --git a/compiler/testData/diagnostics/tests/valueClasses/reservedMembersAndConstructsInsideValueClass.kt b/compiler/testData/diagnostics/tests/valueClasses/reservedMembersAndConstructsInsideValueClass.kt index c77858a8c9d..50f056d36bf 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/reservedMembersAndConstructsInsideValueClass.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/reservedMembersAndConstructsInsideValueClass.kt @@ -8,34 +8,34 @@ annotation class JvmInline @JvmInline value class IC1(val x: Any) { - fun box() {} - fun box(x: Any) {} + fun box() {} + fun box(x: Any) {} - fun unbox() {} - fun unbox(x: Any) {} + fun unbox() {} + fun unbox(x: Any) {} - override fun equals(other: Any?): Boolean = true - override fun hashCode(): Int = 0 + override fun equals(other: Any?): Boolean = true + override fun hashCode(): Int = 0 } @JvmInline value class IC2(val x: Any) { - fun box(x: Any) {} - fun box(): Any = TODO() + fun box(x: Any) {} + fun box(): Any = TODO() - fun unbox(x: Any) {} - fun unbox(): Any = TODO() + fun unbox(x: Any) {} + fun unbox(): Any = TODO() - fun equals(my: Any, other: Any): Boolean = true - fun hashCode(a: Any): Int = 0 + fun equals(my: Any, other: Any): Boolean = true + fun hashCode(a: Any): Int = 0 } @JvmInline value class IC3(val x: Any) { - fun box(x: Any): Any = TODO() - fun unbox(x: Any): Any = TODO() + fun box(x: Any): Any = TODO() + fun unbox(x: Any): Any = TODO() - fun equals(): Boolean = true + fun equals(): Boolean = true } interface WithBox { @@ -44,12 +44,12 @@ interface WithBox { @JvmInline value class IC4(val s: String) : WithBox { - override fun box(): String = "" + override fun box(): String = "" } @JvmInline value class IC5(val a: String) { - constructor(i: Int) : this(i.toString()) { + constructor(i: Int) : this(i.toString()) { TODO("something") } } diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassCanOnlyImplementInterfaces.kt b/compiler/testData/diagnostics/tests/valueClasses/valueClassCanOnlyImplementInterfaces.kt index 438088b3c57..0f92f1f6ff3 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/valueClassCanOnlyImplementInterfaces.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassCanOnlyImplementInterfaces.kt @@ -13,10 +13,10 @@ open class OpenBaseClass interface BaseInterface @JvmInline -value class TestExtendsAbstractClass(val x: Int) : AbstractBaseClass() +value class TestExtendsAbstractClass(val x: Int) : AbstractBaseClass() @JvmInline -value class TestExtendsOpenClass(val x: Int) : OpenBaseClass() +value class TestExtendsOpenClass(val x: Int) : OpenBaseClass() @JvmInline value class TestImplementsInterface(val x: Int) : BaseInterface diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassCannotImplementInterfaceByDelegation.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/valueClassCannotImplementInterfaceByDelegation.fir.kt index dba6b02e2bf..3102b095438 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/valueClassCannotImplementInterfaceByDelegation.fir.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassCannotImplementInterfaceByDelegation.fir.kt @@ -10,7 +10,7 @@ interface IFoo object FooImpl : IFoo @JvmInline -value class Test1(val x: Any) : IFoo by FooImpl +value class Test1(val x: Any) : IFoo by FooImpl @JvmInline -value class Test2(val x: IFoo) : IFoo by x +value class Test2(val x: IFoo) : IFoo by x diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassCannotImplementInterfaceByDelegation.kt b/compiler/testData/diagnostics/tests/valueClasses/valueClassCannotImplementInterfaceByDelegation.kt index 1aec09d3e4f..8b16aefb048 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/valueClassCannotImplementInterfaceByDelegation.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassCannotImplementInterfaceByDelegation.kt @@ -10,7 +10,7 @@ interface IFoo object FooImpl : IFoo @JvmInline -value class Test1(val x: Any) : IFoo by FooImpl +value class Test1(val x: Any) : IFoo by FooImpl @JvmInline -value class Test2(val x: IFoo) : IFoo by x +value class Test2(val x: IFoo) : IFoo by x diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.fir.kt b/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.fir.kt index d084e1cd00f..13c44ae164f 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.fir.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.fir.kt @@ -10,21 +10,21 @@ annotation class JvmInline value class A0(val x: Int) @JvmInline -value class A1 +value class A1 @JvmInline value class A2() @JvmInline -value class A3(x: Int) +value class A3(x: Int) @JvmInline -value class A4(var x: Int) +value class A4(var x: Int) @JvmInline value class A5(val x: Int, val y: Int) @JvmInline value class A6(x: Int, val y: Int) @JvmInline -value class A7(vararg val x: Int) +value class A7(vararg val x: Int) @JvmInline -value class A8(open val x: Int) +value class A8(open val x: Int) @JvmInline value class A9(final val x: Int) @@ -45,8 +45,8 @@ object B2 { @JvmInline final value class D0(val x: Int) -open value class D1(val x: Int) -abstract value class D2(val x: Int) -sealed value class D3(val x: Int) +open value class D1(val x: Int) +abstract value class D2(val x: Int) +sealed value class D3(val x: Int) value data class D4(val x: String) diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.kt b/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.kt index a3337a6371a..70aacac053f 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassDeclarationCheck.kt @@ -10,21 +10,21 @@ annotation class JvmInline value class A0(val x: Int) @JvmInline -value class A1 +value class A1 @JvmInline value class A2() @JvmInline -value class A3(x: Int) +value class A3(x: Int) @JvmInline -value class A4(var x: Int) +value class A4(var x: Int) @JvmInline value class A5(val x: Int, val y: Int) @JvmInline value class A6(x: Int, val y: Int) @JvmInline -value class A7(vararg val x: Int) +value class A7(vararg val x: Int) @JvmInline -value class A8(open val x: Int) +value class A8(open val x: Int) @JvmInline value class A9(final val x: Int) @@ -45,8 +45,8 @@ object B2 { @JvmInline final value class D0(val x: Int) -open value class D1(val x: Int) -abstract value class D2(val x: Int) -sealed value class D3(val x: Int) +open value class D1(val x: Int) +abstract value class D2(val x: Int) +sealed value class D3(val x: Int) value data class D4(val x: String) diff --git a/compiler/testData/diagnostics/tests/valueClasses/valueClassWithForbiddenUnderlyingType.kt b/compiler/testData/diagnostics/tests/valueClasses/valueClassWithForbiddenUnderlyingType.kt index 0875ff51735..57f7ba860e4 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/valueClassWithForbiddenUnderlyingType.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/valueClassWithForbiddenUnderlyingType.kt @@ -7,14 +7,14 @@ package kotlin.jvm annotation class JvmInline @JvmInline -value class Foo(val x: T) +value class Foo(val x: T) @JvmInline -value class FooNullable(val x: T?) +value class FooNullable(val x: T?) @JvmInline -value class FooGenericArray(val x: Array) +value class FooGenericArray(val x: Array) @JvmInline -value class FooGenericArray2(val x: Array>) +value class FooGenericArray2(val x: Array>) @JvmInline value class FooStarProjectedArray(val x: Array<*>) @@ -22,11 +22,11 @@ value class FooStarProjectedArray(val x: Array<*>) value class FooStarProjectedArray2(val x: Array>) @JvmInline -value class Bar(val u: Unit) +value class Bar(val u: Unit) @JvmInline value class BarNullable(val u: Unit?) @JvmInline -value class Baz(val u: Nothing) +value class Baz(val u: Nothing) @JvmInline value class BazNullable(val u: Nothing?) diff --git a/kotlin-native/backend.native/tests/codegen/inlineClass/customEquals.kt b/kotlin-native/backend.native/tests/codegen/inlineClass/customEquals.kt index 03b447b43d3..0c22415e72b 100644 --- a/kotlin-native/backend.native/tests/codegen/inlineClass/customEquals.kt +++ b/kotlin-native/backend.native/tests/codegen/inlineClass/customEquals.kt @@ -2,7 +2,7 @@ * Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license * that can be found in the LICENSE file. */ -@file:Suppress("RESERVED_MEMBER_INSIDE_INLINE_CLASS") +@file:Suppress("RESERVED_MEMBER_INSIDE_VALUE_CLASS") package codegen.inlineClass.customEquals import kotlin.test.* diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/NativePtr.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/NativePtr.kt index 3932410d131..de7b6314f7c 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/NativePtr.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/native/internal/NativePtr.kt @@ -3,7 +3,7 @@ * that can be found in the LICENSE file. */ -@file:Suppress("RESERVED_MEMBER_INSIDE_INLINE_CLASS") +@file:Suppress("RESERVED_MEMBER_INSIDE_VALUE_CLASS") package kotlin.native.internal