[FIR] KT-46483: Forbid annotations in where Clauses
Merge-request: KT-MR-7208 Merged-by: Nikolay Lunyak <lunyak.kolya@mail.ru>
This commit is contained in:
@@ -343,6 +343,8 @@ public interface Errors {
|
||||
|
||||
DiagnosticFactory0<PsiElement> NON_PARENTHESIZED_ANNOTATIONS_ON_FUNCTIONAL_TYPES = DiagnosticFactory0.create(ERROR);
|
||||
|
||||
DiagnosticFactory0<KtAnnotationEntry> ANNOTATION_IN_WHERE_CLAUSE_WARNING = DiagnosticFactory0.create(WARNING);
|
||||
|
||||
// Const
|
||||
DiagnosticFactory0<PsiElement> CONST_VAL_NOT_TOP_LEVEL_OR_OBJECT = DiagnosticFactory0.create(ERROR);
|
||||
DiagnosticFactory0<PsiElement> CONST_VAL_WITH_GETTER = DiagnosticFactory0.create(ERROR);
|
||||
|
||||
+2
@@ -187,6 +187,8 @@ public class DefaultErrorMessages {
|
||||
|
||||
MAP.put(NON_PARENTHESIZED_ANNOTATIONS_ON_FUNCTIONAL_TYPES, "Non-parenthesized annotations on function types without receiver aren't yet supported (see KT-31734 for details)");
|
||||
|
||||
MAP.put(ANNOTATION_IN_WHERE_CLAUSE_WARNING, "Type parameter annotations will not be allowed inside where clauses in future releases. You should probably move annotations to the type parameter declaration");
|
||||
|
||||
MAP.put(REDUNDANT_MODIFIER, "Modifier ''{0}'' is redundant because ''{1}'' is present", TO_STRING, TO_STRING);
|
||||
MAP.put(REDUNDANT_OPEN_IN_INTERFACE, "Modifier 'open' is redundant for abstract interface members");
|
||||
MAP.put(REDUNDANT_MODIFIER_IN_GETTER, "Visibility modifiers are redundant in getter");
|
||||
|
||||
@@ -537,6 +537,12 @@ class DeclarationsChecker(
|
||||
checkSupertypesForConsistency(typeParameterDescriptor, typeParameter)
|
||||
checkOnlyOneTypeParameterBound(typeParameterDescriptor, typeParameter, typeParameterListOwner)
|
||||
}
|
||||
|
||||
for (constraint in constraints) {
|
||||
constraint.annotationEntries.forEach {
|
||||
trace.report(ANNOTATION_IN_WHERE_CLAUSE_WARNING.on(it))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkConstructorInInterface(klass: KtClass) {
|
||||
|
||||
Reference in New Issue
Block a user