[FE] Allow declare sealed class inheritors as inner or nested classes
#KT-13495
This commit is contained in:
committed by
TeamCityServer
parent
f5f1984a60
commit
70c61be1ef
@@ -56,6 +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.TopLevelSealedInheritance;
|
||||
import static org.jetbrains.kotlin.diagnostics.Errors.*;
|
||||
import static org.jetbrains.kotlin.resolve.BindingContext.*;
|
||||
@@ -635,7 +636,12 @@ public class BodyResolver {
|
||||
containingDescriptor = containingDescriptor.getContainingDeclaration();
|
||||
}
|
||||
if (containingDescriptor == null) {
|
||||
trace.report(SEALED_SUPERTYPE.on(typeReference));
|
||||
if (
|
||||
!languageVersionSettings.supportsFeature(FreedomForSealedClasses) ||
|
||||
DescriptorUtils.isLocal(supertypeOwner)
|
||||
) {
|
||||
trace.report(SEALED_SUPERTYPE.on(typeReference));
|
||||
}
|
||||
}
|
||||
else {
|
||||
trace.report(SEALED_SUPERTYPE_IN_LOCAL_CLASS.on(typeReference));
|
||||
|
||||
Reference in New Issue
Block a user