[FE] Change message for sealed interfaces with language target < 1.5

This commit is contained in:
Dmitriy Novozhilov
2021-02-16 12:43:25 +03:00
parent 8521d844e2
commit cdf7de5524
3 changed files with 3 additions and 3 deletions
@@ -18,6 +18,6 @@ object SealedInterfaceAllowedChecker : DeclarationChecker {
if (descriptor !is ClassDescriptor) return
if (descriptor.kind != ClassKind.INTERFACE) return
val keyword = declaration.modifierList?.getModifier(KtTokens.SEALED_KEYWORD) ?: return
context.trace.report(Errors.WRONG_MODIFIER_TARGET.on(keyword, KtTokens.SEALED_KEYWORD, KotlinTarget.INTERFACE.description))
context.trace.report(Errors.UNSUPPORTED_FEATURE.on(keyword, LanguageFeature.SealedInterfaces to context.languageVersionSettings))
}
}
@@ -7,7 +7,7 @@ This mode is not recommended for production use,
as no stability/compatibility guarantees are given on
compiler or generated code. Use it at your own risk!
compiler/testData/cli/jvm/internalArgDisableLanguageFeature.kt:1:1: error: modifier 'sealed' is not applicable to 'interface'
compiler/testData/cli/jvm/internalArgDisableLanguageFeature.kt:1:1: error: the feature "sealed interfaces" is disabled
sealed interface A
^
COMPILATION_ERROR
@@ -2,4 +2,4 @@
// !LANGUAGE: -SealedInterfaces
// !DIAGNOSTICS: -UNUSED_VARIABLE
<!WRONG_MODIFIER_TARGET!>sealed<!> interface Base
<!UNSUPPORTED_FEATURE!>sealed<!> interface Base