[FE] Rename FreedomForSealedClasses feature with more meaningful name
This commit is contained in:
committed by
TeamCityServer
parent
77aad06008
commit
b6bd7c48f4
@@ -56,7 +56,7 @@ import org.jetbrains.kotlin.util.ReenteringLazyValueComputationException;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static org.jetbrains.kotlin.config.LanguageFeature.FreedomForSealedClasses;
|
||||
import static org.jetbrains.kotlin.config.LanguageFeature.AllowSealedInheritorsInDifferentFilesOfSamePackage;
|
||||
import static org.jetbrains.kotlin.config.LanguageFeature.TopLevelSealedInheritance;
|
||||
import static org.jetbrains.kotlin.diagnostics.Errors.*;
|
||||
import static org.jetbrains.kotlin.resolve.BindingContext.*;
|
||||
@@ -637,7 +637,7 @@ public class BodyResolver {
|
||||
}
|
||||
if (containingDescriptor == null) {
|
||||
if (
|
||||
!languageVersionSettings.supportsFeature(FreedomForSealedClasses) ||
|
||||
!languageVersionSettings.supportsFeature(AllowSealedInheritorsInDifferentFilesOfSamePackage) ||
|
||||
DescriptorUtils.isLocal(supertypeOwner)
|
||||
) {
|
||||
trace.report(SEALED_SUPERTYPE.on(typeReference));
|
||||
|
||||
@@ -392,7 +392,7 @@ class FunctionDescriptorResolver(
|
||||
resolveValueParameters(constructorDescriptor, parameterScope, valueParameters, trace, null),
|
||||
resolveVisibilityFromModifiers(
|
||||
modifierList,
|
||||
DescriptorUtils.getDefaultConstructorVisibility(classDescriptor, languageVersionSettings.supportsFeature(LanguageFeature.FreedomForSealedClasses))
|
||||
DescriptorUtils.getDefaultConstructorVisibility(classDescriptor, languageVersionSettings.supportsFeature(LanguageFeature.AllowSealedInheritorsInDifferentFilesOfSamePackage))
|
||||
)
|
||||
)
|
||||
constructor.returnType = classDescriptor.defaultType
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ import org.jetbrains.kotlin.resolve.bindingContextUtil.getAbbreviatedTypeOrType
|
||||
|
||||
object SealedInheritorInSamePackageChecker : DeclarationChecker {
|
||||
override fun check(declaration: KtDeclaration, descriptor: DeclarationDescriptor, context: DeclarationCheckerContext) {
|
||||
if (!context.languageVersionSettings.supportsFeature(LanguageFeature.FreedomForSealedClasses)) return
|
||||
if (!context.languageVersionSettings.supportsFeature(LanguageFeature.AllowSealedInheritorsInDifferentFilesOfSamePackage)) return
|
||||
if (descriptor !is ClassDescriptor || declaration !is KtClassOrObject) return
|
||||
val classPackage = descriptor.containingPackage() ?: return // local class, SEALED_SUPERTYPE already reported
|
||||
for (superTypeListEntry in declaration.superTypeListEntries) {
|
||||
|
||||
+1
-2
@@ -30,7 +30,6 @@ import org.jetbrains.kotlin.resolve.BindingContext;
|
||||
import org.jetbrains.kotlin.resolve.BindingTrace;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
|
||||
import org.jetbrains.kotlin.resolve.lazy.ForceResolveUtil;
|
||||
import org.jetbrains.kotlin.resolve.lazy.LazyClassContext;
|
||||
import org.jetbrains.kotlin.resolve.lazy.LazyEntity;
|
||||
@@ -270,7 +269,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
|
||||
)
|
||||
);
|
||||
|
||||
boolean freedomForSealedInterfacesSupported = c.getLanguageVersionSettings().supportsFeature(LanguageFeature.FreedomForSealedClasses);
|
||||
boolean freedomForSealedInterfacesSupported = c.getLanguageVersionSettings().supportsFeature(LanguageFeature.AllowSealedInheritorsInDifferentFilesOfSamePackage);
|
||||
this.sealedSubclasses = storageManager.createLazyValue(() -> c.getSealedClassInheritorsProvider().computeSealedSubclasses(this, freedomForSealedInterfacesSupported));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user