[FE1.0, FIR] Support secondary constructors for Value Classes

Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179
This commit is contained in:
Evgeniy.Zhelenskiy
2022-10-13 19:18:08 +02:00
committed by Space Team
parent 8c3fa6f09f
commit 6107caa8e2
18 changed files with 296 additions and 93 deletions
@@ -263,11 +263,13 @@ class ReservedMembersAndConstructsForInlineClass : DeclarationChecker {
}
is ConstructorDescriptor -> {
val secondaryConstructor = declaration as? KtSecondaryConstructor ?: return
val bodyExpression = secondaryConstructor.bodyExpression
if (secondaryConstructor.hasBlockBody() && bodyExpression is KtBlockExpression) {
val lBrace = bodyExpression.lBrace ?: return
context.trace.report(Errors.SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_VALUE_CLASS.on(lBrace))
if (!context.languageVersionSettings.supportsFeature(LanguageFeature.ValueClassesSecondaryConstructorWithBody)) {
val secondaryConstructor = declaration as? KtSecondaryConstructor ?: return
val bodyExpression = secondaryConstructor.bodyExpression
if (secondaryConstructor.hasBlockBody() && bodyExpression is KtBlockExpression) {
val lBrace = bodyExpression.lBrace ?: return
context.trace.report(Errors.SECONDARY_CONSTRUCTOR_WITH_BODY_INSIDE_VALUE_CLASS.on(lBrace))
}
}
}
}