[FE] Change message for sealed interfaces with language target < 1.5
This commit is contained in:
+1
-1
@@ -18,6 +18,6 @@ object SealedInterfaceAllowedChecker : DeclarationChecker {
|
|||||||
if (descriptor !is ClassDescriptor) return
|
if (descriptor !is ClassDescriptor) return
|
||||||
if (descriptor.kind != ClassKind.INTERFACE) return
|
if (descriptor.kind != ClassKind.INTERFACE) return
|
||||||
val keyword = declaration.modifierList?.getModifier(KtTokens.SEALED_KEYWORD) ?: 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
|
as no stability/compatibility guarantees are given on
|
||||||
compiler or generated code. Use it at your own risk!
|
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
|
sealed interface A
|
||||||
^
|
^
|
||||||
COMPILATION_ERROR
|
COMPILATION_ERROR
|
||||||
|
|||||||
+1
-1
@@ -2,4 +2,4 @@
|
|||||||
// !LANGUAGE: -SealedInterfaces
|
// !LANGUAGE: -SealedInterfaces
|
||||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||||
|
|
||||||
<!WRONG_MODIFIER_TARGET!>sealed<!> interface Base
|
<!UNSUPPORTED_FEATURE!>sealed<!> interface Base
|
||||||
|
|||||||
Reference in New Issue
Block a user