[FE 1.0] Prohibit access to members of companion of enum from enum entry initializer
^KT-49461 Fixed ^KT-49110
This commit is contained in:
committed by
TeamCityServer
parent
4f0c3c3c0d
commit
58889a2b5c
+9
-1
@@ -407,7 +407,15 @@ class ControlFlowInformationProviderImpl private constructor(
|
||||
report(Errors.UNINITIALIZED_ENUM_ENTRY.on(element, classDescriptor), ctxt)
|
||||
ClassKind.OBJECT -> if (classDescriptor.isCompanionObject) {
|
||||
val container = classDescriptor.containingDeclaration
|
||||
if (container is ClassDescriptor && container.kind == ClassKind.ENUM_CLASS) {
|
||||
/*
|
||||
* ProhibitAccessToEnumCompanionMembersInEnumConstructorCall feature enabled then UNINITIALIZED_ENUM_COMPANION
|
||||
* will be reported from EnumCompanionInEnumConstructorCallChecker
|
||||
*/
|
||||
if (
|
||||
container is ClassDescriptor &&
|
||||
container.kind == ClassKind.ENUM_CLASS &&
|
||||
!languageVersionSettings.supportsFeature(LanguageFeature.ProhibitAccessToEnumCompanionMembersInEnumConstructorCall)
|
||||
) {
|
||||
report(Errors.UNINITIALIZED_ENUM_COMPANION.on(element, container), ctxt)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user