[FIR] Update diagnostic messages
This commit is contained in:
committed by
Space Team
parent
6cd9b5ec98
commit
de1c92a32f
+59
-59
@@ -75,138 +75,138 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.js.FirJsErrors.WRONG_OPERAT
|
||||
@Suppress("unused")
|
||||
object FirJsErrorsDefaultMessages : BaseDiagnosticRendererFactory() {
|
||||
override val MAP = KtDiagnosticFactoryToRendererMap("FIR").also { map ->
|
||||
map.put(WRONG_JS_QUALIFIER, "Qualifier contains illegal characters")
|
||||
map.put(JS_MODULE_PROHIBITED_ON_VAR, "@JsModule and @JsNonModule annotations prohibited for 'var' declarations. Use 'val' instead.")
|
||||
map.put(JS_MODULE_PROHIBITED_ON_NON_NATIVE, "@JsModule and @JsNonModule annotations prohibited for non-external declarations.")
|
||||
map.put(WRONG_JS_QUALIFIER, "Qualifier contains illegal characters.")
|
||||
map.put(JS_MODULE_PROHIBITED_ON_VAR, "'@JsModule' and '@JsNonModule' annotations are prohibited for 'var' declarations. Use 'val' instead.")
|
||||
map.put(JS_MODULE_PROHIBITED_ON_NON_NATIVE, "'@JsModule' and '@JsNonModule' annotations are prohibited for non-external declarations.")
|
||||
map.put(
|
||||
NESTED_JS_MODULE_PROHIBITED,
|
||||
"@JsModule and @JsNonModule can't appear on here since the file is already marked by either @JsModule or @JsNonModule"
|
||||
"'@JsModule' and '@JsNonModule' cannot appear here since the file is already marked by either '@JsModule' or '@JsNonModule'."
|
||||
)
|
||||
map.put(
|
||||
CALL_FROM_UMD_MUST_BE_JS_MODULE_AND_JS_NON_MODULE,
|
||||
"When accessing module declarations from UMD, they must be marked by both @JsModule and @JsNonModule"
|
||||
"When accessing module declarations from UMD, they must be marked with both @JsModule and @JsNonModule."
|
||||
)
|
||||
map.put(
|
||||
CALL_TO_JS_MODULE_WITHOUT_MODULE_SYSTEM,
|
||||
"Can''t access {0} marked with @JsModule annotation from non-modular project", FirDiagnosticRenderers.SYMBOL
|
||||
"Can''t access ''{0}'' marked with @JsModule annotation from non-modular project.", FirDiagnosticRenderers.SYMBOL
|
||||
)
|
||||
map.put(
|
||||
CALL_TO_JS_NON_MODULE_WITH_MODULE_SYSTEM,
|
||||
"Can''t access {0} marked with @JsNonModule annotation from modular project", FirDiagnosticRenderers.SYMBOL
|
||||
"Can''t access ''{0}'' marked with @JsNonModule annotation from modular project.", FirDiagnosticRenderers.SYMBOL
|
||||
)
|
||||
map.put(
|
||||
WRONG_MULTIPLE_INHERITANCE,
|
||||
"Can''t apply multiple inheritance here, since it''s impossible to generate bridge for system function {0}",
|
||||
"Multiple inheritance cannot be used here, since it''s impossible to generate a bridge for system function {0}.",
|
||||
FirDiagnosticRenderers.SYMBOL
|
||||
)
|
||||
map.put(DELEGATION_BY_DYNAMIC, "Can't delegate to dynamic value")
|
||||
map.put(PROPERTY_DELEGATION_BY_DYNAMIC, "Can't apply property delegation by dynamic handler")
|
||||
map.put(SPREAD_OPERATOR_IN_DYNAMIC_CALL, "Can't apply spread operator in dynamic call")
|
||||
map.put(WRONG_OPERATION_WITH_DYNAMIC, "Wrong operation with dynamic value: {0}", CommonRenderers.STRING)
|
||||
map.put(IMPLEMENTING_FUNCTION_INTERFACE, "Implementing function interface is prohibited in JavaScript")
|
||||
map.put(OVERRIDING_EXTERNAL_FUN_WITH_OPTIONAL_PARAMS, "Overriding `external` function with optional parameters")
|
||||
map.put(DELEGATION_BY_DYNAMIC, "Cannot delegate to dynamic value.")
|
||||
map.put(PROPERTY_DELEGATION_BY_DYNAMIC, "Cannot apply property delegation by dynamic handler.")
|
||||
map.put(SPREAD_OPERATOR_IN_DYNAMIC_CALL, "Cannot apply spread operator in dynamic call.")
|
||||
map.put(WRONG_OPERATION_WITH_DYNAMIC, "Wrong operation with dynamic value: {0}.", CommonRenderers.STRING)
|
||||
map.put(IMPLEMENTING_FUNCTION_INTERFACE, "Implementing a function interface is prohibited in JavaScript.")
|
||||
map.put(OVERRIDING_EXTERNAL_FUN_WITH_OPTIONAL_PARAMS, "Overriding 'external' function with optional parameters.")
|
||||
map.put(
|
||||
OVERRIDING_EXTERNAL_FUN_WITH_OPTIONAL_PARAMS_WITH_FAKE,
|
||||
"Overriding `external` function with optional parameters by declaration from superclass: {0}",
|
||||
"Overriding ''external'' function with optional parameters by declaration from superclass: {0}.",
|
||||
FirDiagnosticRenderers.SYMBOL
|
||||
)
|
||||
map.put(CALL_TO_DEFINED_EXTERNALLY_FROM_NON_EXTERNAL_DECLARATION, "This property can only be used from external declarations")
|
||||
map.put(RUNTIME_ANNOTATION_ON_EXTERNAL_DECLARATION, "Runtime annotation can't be put on external declaration")
|
||||
map.put(CALL_TO_DEFINED_EXTERNALLY_FROM_NON_EXTERNAL_DECLARATION, "This property can only be used from external declarations.")
|
||||
map.put(RUNTIME_ANNOTATION_ON_EXTERNAL_DECLARATION, "Runtime annotation cannot be put on external declaration.")
|
||||
map.put(
|
||||
RUNTIME_ANNOTATION_NOT_SUPPORTED,
|
||||
"Reflection is not supported in JavaScript target, therefore you won't be able to read this annotation in run-time"
|
||||
"Reflection is not supported in JavaScript target; therefore, you won't be able to read this annotation at runtime."
|
||||
)
|
||||
map.put(EXTERNAL_CLASS_CONSTRUCTOR_PROPERTY_PARAMETER, "External class constructor cannot have a property parameter")
|
||||
map.put(EXTERNAL_ENUM_ENTRY_WITH_BODY, "Entry of external enum class can't have body")
|
||||
map.put(EXTERNAL_ANONYMOUS_INITIALIZER, "Anonymous initializer is not allowed in external classes")
|
||||
map.put(EXTERNAL_DELEGATION, "Can't use delegate on external declaration")
|
||||
map.put(EXTERNAL_DELEGATED_CONSTRUCTOR_CALL, "Delegated constructor call in external class is not allowed")
|
||||
map.put(EXTERNAL_CLASS_CONSTRUCTOR_PROPERTY_PARAMETER, "External class constructor cannot have a property parameter.")
|
||||
map.put(EXTERNAL_ENUM_ENTRY_WITH_BODY, "Entry of external enum class cannot have a body.")
|
||||
map.put(EXTERNAL_ANONYMOUS_INITIALIZER, "Anonymous initializers in external classes are prohibited.")
|
||||
map.put(EXTERNAL_DELEGATION, "Cannot use delegate on external declaration.")
|
||||
map.put(EXTERNAL_DELEGATED_CONSTRUCTOR_CALL, "Delegated constructor call in external class is prohibited.")
|
||||
map.put(
|
||||
WRONG_BODY_OF_EXTERNAL_DECLARATION,
|
||||
"Wrong body of external declaration. Must be either ' = definedExternally' or { definedExternally }"
|
||||
"Wrong body of external declaration. Must be either ' = definedExternally' or '{ definedExternally }'."
|
||||
)
|
||||
map.put(WRONG_INITIALIZER_OF_EXTERNAL_DECLARATION, "Wrong initializer of external declaration. Must be ' = definedExternally'")
|
||||
map.put(WRONG_INITIALIZER_OF_EXTERNAL_DECLARATION, "Wrong initializer of external declaration. Must be ' = definedExternally'.")
|
||||
map.put(
|
||||
WRONG_DEFAULT_VALUE_FOR_EXTERNAL_FUN_PARAMETER,
|
||||
"Wrong default value for parameter of external function. Must be ' = definedExternally'"
|
||||
"Wrong default value for parameter of external function. Must be ' = definedExternally'."
|
||||
)
|
||||
map.put(NESTED_EXTERNAL_DECLARATION, "Non-top-level `external` declaration")
|
||||
map.put(WRONG_EXTERNAL_DECLARATION, "Declaration of such kind ({0}) can''t be external", CommonRenderers.STRING)
|
||||
map.put(NESTED_CLASS_IN_EXTERNAL_INTERFACE, "Interface can't contain nested classes and objects")
|
||||
map.put(EXTERNAL_TYPE_EXTENDS_NON_EXTERNAL_TYPE, "External type extends non-external type")
|
||||
map.put(INLINE_EXTERNAL_DECLARATION, "Inline external declaration")
|
||||
map.put(NESTED_EXTERNAL_DECLARATION, "Non-top-level 'external' declaration.")
|
||||
map.put(WRONG_EXTERNAL_DECLARATION, "Declaration of such kind ({0}) cannot be external.", CommonRenderers.STRING)
|
||||
map.put(NESTED_CLASS_IN_EXTERNAL_INTERFACE, "Interface cannot contain nested classes and objects.")
|
||||
map.put(EXTERNAL_TYPE_EXTENDS_NON_EXTERNAL_TYPE, "External type extends non-external type.")
|
||||
map.put(INLINE_EXTERNAL_DECLARATION, "Inline external declaration.")
|
||||
map.put(
|
||||
INLINE_CLASS_IN_EXTERNAL_DECLARATION_WARNING,
|
||||
"Using value classes as parameter type or return type of external declarations is experimental"
|
||||
"Using value classes as parameter type or return type of external declarations is experimental."
|
||||
)
|
||||
map.put(
|
||||
ENUM_CLASS_IN_EXTERNAL_DECLARATION_WARNING,
|
||||
"Using enum classes with an `external` qualifier becomes deprecated and will be an error in future releases"
|
||||
"Using enum classes with an 'external' qualifier becomes deprecated and will be an error in future releases."
|
||||
)
|
||||
map.put(
|
||||
INLINE_CLASS_IN_EXTERNAL_DECLARATION,
|
||||
"Using value classes as parameter type or return type of external declarations is not supported"
|
||||
"Using value classes as parameter type or return type of external declarations is not supported."
|
||||
)
|
||||
map.put(EXTENSION_FUNCTION_IN_EXTERNAL_DECLARATION, "Function types with receiver are prohibited in external declarations")
|
||||
map.put(EXTENSION_FUNCTION_IN_EXTERNAL_DECLARATION, "Function types with receivers are prohibited in external declarations.")
|
||||
map.put(
|
||||
NON_ABSTRACT_MEMBER_OF_EXTERNAL_INTERFACE,
|
||||
"Only nullable properties of external interfaces are allowed to be non-abstract"
|
||||
"Only nullable properties of external interfaces are allowed to be non-abstract."
|
||||
)
|
||||
map.put(
|
||||
NATIVE_ANNOTATIONS_ALLOWED_ONLY_ON_MEMBER_OR_EXTENSION_FUN,
|
||||
"Annotation ''{0}'' is allowed only on member functions of declaration annotated as ''kotlin.js.native'' or on toplevel extension functions",
|
||||
"Annotation ''{0}'' is only allowed on member functions of declarations annotated with ''kotlin.js.native'' or on top-level extension functions.",
|
||||
FirDiagnosticRenderers.RENDER_TYPE
|
||||
)
|
||||
map.put(
|
||||
NATIVE_INDEXER_KEY_SHOULD_BE_STRING_OR_NUMBER,
|
||||
"Native {0}''s first parameter type should be ''kotlin.String'' or subtype of ''kotlin.Number''",
|
||||
"Native {0}''s first parameter type should be ''kotlin.String'' or a subtype of ''kotlin.Number''.",
|
||||
CommonRenderers.STRING
|
||||
)
|
||||
map.put(NATIVE_INDEXER_CAN_NOT_HAVE_DEFAULT_ARGUMENTS, "Native {0}''s parameter can not have default value", CommonRenderers.STRING)
|
||||
map.put(NATIVE_GETTER_RETURN_TYPE_SHOULD_BE_NULLABLE, "Native getter's return type should be nullable")
|
||||
map.put(NATIVE_INDEXER_CAN_NOT_HAVE_DEFAULT_ARGUMENTS, "Native {0}''s parameter cannot have default value.", CommonRenderers.STRING)
|
||||
map.put(NATIVE_GETTER_RETURN_TYPE_SHOULD_BE_NULLABLE, "Native getter's return type should be nullable.")
|
||||
map.put(
|
||||
NATIVE_SETTER_WRONG_RETURN_TYPE,
|
||||
"Native setter's return type should be 'Unit' or a supertype of the second parameter's type"
|
||||
"Native setter's return type should be 'Unit' or a supertype of the second parameter's type."
|
||||
)
|
||||
map.put(
|
||||
NATIVE_INDEXER_WRONG_PARAMETER_COUNT, "Expected {0} parameters for native {1}",
|
||||
NATIVE_INDEXER_WRONG_PARAMETER_COUNT, "Expected {0} parameters for native {1}.",
|
||||
KtDiagnosticRenderers.TO_STRING,
|
||||
CommonRenderers.STRING
|
||||
)
|
||||
map.put(
|
||||
NON_EXTERNAL_DECLARATION_IN_INAPPROPRIATE_FILE,
|
||||
"Can''t put non-external declarations in file marked with ''{0}'' annotation",
|
||||
"Only external declarations are allowed in files marked with ''{0}'' annotation.",
|
||||
FirDiagnosticRenderers.RENDER_TYPE
|
||||
)
|
||||
map.put(
|
||||
JS_EXTERNAL_INHERITORS_ONLY,
|
||||
"External {0} can''t be a parent of non-external {1}",
|
||||
"External ''{0}'' cannot be a parent of non-external ''{1}''.",
|
||||
FirDiagnosticRenderers.RENDER_CLASS_OR_OBJECT_NAME,
|
||||
FirDiagnosticRenderers.RENDER_CLASS_OR_OBJECT_NAME
|
||||
)
|
||||
map.put(
|
||||
JS_EXTERNAL_ARGUMENT,
|
||||
"Expected argument with external type, but type ''{0}'' is non-external",
|
||||
"Expected argument with external type, but type ''{0}'' is non-external.",
|
||||
FirDiagnosticRenderers.RENDER_TYPE
|
||||
)
|
||||
map.put(
|
||||
EXTERNAL_INTERFACE_AS_REIFIED_TYPE_ARGUMENT,
|
||||
"Cannot pass external interface {0} for reified type parameter",
|
||||
"Cannot pass external interface ''{0}'' for reified type parameter.",
|
||||
FirDiagnosticRenderers.RENDER_TYPE
|
||||
)
|
||||
map.put(JS_NAME_PROHIBITED_FOR_EXTENSION_PROPERTY, "@JsName is prohibited for extension properties")
|
||||
map.put(JS_NAME_PROHIBITED_FOR_EXTENSION_PROPERTY, "'@JsName' is prohibited for extension properties.")
|
||||
map.put(
|
||||
JS_BUILTIN_NAME_CLASH,
|
||||
"JavaScript name generated for this declaration clashes with built-in declaration {0}",
|
||||
"JavaScript name generated for this declaration clashes with built-in declaration ''{0}''.",
|
||||
CommonRenderers.STRING
|
||||
)
|
||||
map.put(NAME_CONTAINS_ILLEGAL_CHARS, "Name contains illegal chars that can't appear in JavaScript identifier")
|
||||
map.put(NAME_CONTAINS_ILLEGAL_CHARS, "Name contains illegal chars that cannot appear in JavaScript identifier.")
|
||||
|
||||
map.put(JS_NAME_IS_NOT_ON_ALL_ACCESSORS, "@JsName should be on all the property accessors")
|
||||
map.put(JS_NAME_PROHIBITED_FOR_NAMED_NATIVE, "@JsName is prohibited for external declaration with explicit name")
|
||||
map.put(JS_NAME_PROHIBITED_FOR_OVERRIDE, "@JsName is prohibited for overridden members")
|
||||
map.put(JS_NAME_ON_PRIMARY_CONSTRUCTOR_PROHIBITED, "@JsName annotation is prohibited for primary constructors")
|
||||
map.put(JS_NAME_ON_ACCESSOR_AND_PROPERTY, "@JsName can be either on a property or its accessors, not both of them")
|
||||
map.put(JS_NAME_IS_NOT_ON_ALL_ACCESSORS, "'@JsName' should be on all the property accessors.")
|
||||
map.put(JS_NAME_PROHIBITED_FOR_NAMED_NATIVE, "'@JsName' is prohibited for external declaration with explicit name.")
|
||||
map.put(JS_NAME_PROHIBITED_FOR_OVERRIDE, "'@JsName' is prohibited for overridden members.")
|
||||
map.put(JS_NAME_ON_PRIMARY_CONSTRUCTOR_PROHIBITED, "'@JsName' annotation is prohibited for primary constructors.")
|
||||
map.put(JS_NAME_ON_ACCESSOR_AND_PROPERTY, "'@JsName' can be either on a property or its accessors, not both of them.")
|
||||
map.put(
|
||||
CANNOT_CHECK_FOR_EXTERNAL_INTERFACE,
|
||||
"Cannot check for external interface: ''{0}''",
|
||||
@@ -214,13 +214,13 @@ object FirJsErrorsDefaultMessages : BaseDiagnosticRendererFactory() {
|
||||
)
|
||||
map.put(
|
||||
UNCHECKED_CAST_TO_EXTERNAL_INTERFACE,
|
||||
"Unchecked cast to external interface: ''{0}'' to ''{1}''",
|
||||
"Unchecked cast to external interface: ''{0}'' to ''{1}''.",
|
||||
FirDiagnosticRenderers.RENDER_TYPE,
|
||||
FirDiagnosticRenderers.RENDER_TYPE,
|
||||
)
|
||||
map.put(EXTERNAL_INTERFACE_AS_CLASS_LITERAL, "Can't refer to external interface from class literal")
|
||||
map.put(NESTED_JS_EXPORT, "@JsExport is only allowed on files and top-level declarations")
|
||||
map.put(WRONG_EXPORTED_DECLARATION, "Declaration of such kind ({0}) can''t be exported to JS", CommonRenderers.STRING)
|
||||
map.put(EXTERNAL_INTERFACE_AS_CLASS_LITERAL, "Cannot refer to external interface from class literal.")
|
||||
map.put(NESTED_JS_EXPORT, "'@JsExport' is only allowed on files and top-level declarations.")
|
||||
map.put(WRONG_EXPORTED_DECLARATION, "Declaration of such kind ({0}) cannot be exported to JavaScript.", CommonRenderers.STRING)
|
||||
map.put(
|
||||
NON_EXPORTABLE_TYPE,
|
||||
"Exported declaration uses non-exportable {0} type: ''{1}''",
|
||||
@@ -229,7 +229,7 @@ object FirJsErrorsDefaultMessages : BaseDiagnosticRendererFactory() {
|
||||
)
|
||||
map.put(
|
||||
NON_CONSUMABLE_EXPORTED_IDENTIFIER,
|
||||
"Exported declaration contains non-consumable identifier ''${0}'', that can''t be represented inside TS definitions and ESM",
|
||||
"Exported declaration contains non-consumable identifier ''{0}'', which cannot be represented inside TS definitions and ESM.",
|
||||
CommonRenderers.STRING,
|
||||
)
|
||||
}
|
||||
|
||||
+66
-66
@@ -83,124 +83,124 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.jvm.FirJvmErrors.VALUE_CLAS
|
||||
object FirJvmErrorsDefaultMessages : BaseDiagnosticRendererFactory() {
|
||||
|
||||
override val MAP = KtDiagnosticFactoryToRendererMap("FIR").also { map ->
|
||||
map.put(CONFLICTING_JVM_DECLARATIONS, "Platform declaration clash")
|
||||
map.put(JAVA_TYPE_MISMATCH, "Java type mismatch: expected ''{0}'' but found ''{1}''. Use explicit cast", RENDER_TYPE, RENDER_TYPE)
|
||||
map.put(UPPER_BOUND_CANNOT_BE_ARRAY, "Upper bound of a type parameter cannot be an array")
|
||||
map.put(STRICTFP_ON_CLASS, "'@Strictfp' annotation on classes is unsupported yet")
|
||||
map.put(SYNCHRONIZED_ON_ABSTRACT, "'@Synchronized' annotation cannot be used on abstract functions")
|
||||
map.put(SYNCHRONIZED_ON_INLINE, "'@Synchronized' annotation has no effect on inline functions")
|
||||
map.put(SYNCHRONIZED_ON_SUSPEND, "@Synchronized annotation is not applicable to suspend functions and lambdas")
|
||||
map.put(SYNCHRONIZED_IN_INTERFACE, "'@Synchronized' annotation cannot be used on interface members")
|
||||
map.put(OVERLOADS_WITHOUT_DEFAULT_ARGUMENTS, "'@JvmOverloads' annotation has no effect for methods without default arguments")
|
||||
map.put(OVERLOADS_ABSTRACT, "'@JvmOverloads' annotation cannot be used on abstract methods")
|
||||
map.put(OVERLOADS_INTERFACE, "'@JvmOverloads' annotation cannot be used on interface methods")
|
||||
map.put(OVERLOADS_PRIVATE, "'@JvmOverloads' annotation has no effect on private declarations")
|
||||
map.put(OVERLOADS_LOCAL, "'@JvmOverloads' annotation cannot be used on local declarations")
|
||||
map.put(CONFLICTING_JVM_DECLARATIONS, "Platform declaration clash.")
|
||||
map.put(JAVA_TYPE_MISMATCH, "Java type mismatch: expected ''{0}'' but found ''{1}''. Use explicit cast.", RENDER_TYPE, RENDER_TYPE)
|
||||
map.put(UPPER_BOUND_CANNOT_BE_ARRAY, "Upper bound of type parameter cannot be an array.")
|
||||
map.put(STRICTFP_ON_CLASS, "'@Strictfp' annotation on classes is not yet supported.")
|
||||
map.put(SYNCHRONIZED_ON_ABSTRACT, "'@Synchronized' annotation cannot be used on abstract functions.")
|
||||
map.put(SYNCHRONIZED_ON_INLINE, "'@Synchronized' annotation has no effect on inline functions.")
|
||||
map.put(SYNCHRONIZED_ON_SUSPEND, "'@Synchronized' annotation is not applicable to 'suspend' functions and lambdas.")
|
||||
map.put(SYNCHRONIZED_IN_INTERFACE, "'@Synchronized' annotation cannot be used on interface members.")
|
||||
map.put(OVERLOADS_WITHOUT_DEFAULT_ARGUMENTS, "'@JvmOverloads' annotation has no effect for methods without default arguments.")
|
||||
map.put(OVERLOADS_ABSTRACT, "'@JvmOverloads' annotation cannot be used on abstract methods.")
|
||||
map.put(OVERLOADS_INTERFACE, "'@JvmOverloads' annotation cannot be used on interface methods.")
|
||||
map.put(OVERLOADS_PRIVATE, "'@JvmOverloads' annotation has no effect on private declarations.")
|
||||
map.put(OVERLOADS_LOCAL, "'@JvmOverloads' annotation cannot be used on local declarations.")
|
||||
map.put(
|
||||
OVERLOADS_ANNOTATION_CLASS_CONSTRUCTOR,
|
||||
"'@JvmOverloads' annotation cannot be used on constructors of annotation classes"
|
||||
"'@JvmOverloads' annotation cannot be used on constructors of annotation classes."
|
||||
)
|
||||
map.put(DEPRECATED_JAVA_ANNOTATION, "This annotation is deprecated in Kotlin. Use ''@{0}'' instead", TO_STRING)
|
||||
map.put(POSITIONED_VALUE_ARGUMENT_FOR_JAVA_ANNOTATION, "Only named arguments are available for Java annotations")
|
||||
map.put(JVM_PACKAGE_NAME_CANNOT_BE_EMPTY, "'@JvmPackageName' annotation value cannot be empty")
|
||||
map.put(DEPRECATED_JAVA_ANNOTATION, "This annotation is deprecated in Kotlin. Use ''@{0}'' instead.", TO_STRING)
|
||||
map.put(POSITIONED_VALUE_ARGUMENT_FOR_JAVA_ANNOTATION, "Only named arguments are available for Java annotations.")
|
||||
map.put(JVM_PACKAGE_NAME_CANNOT_BE_EMPTY, "'@JvmPackageName' annotation value cannot be empty.")
|
||||
map.put(
|
||||
JVM_PACKAGE_NAME_MUST_BE_VALID_NAME,
|
||||
"'@JvmPackageName' annotation value must be a valid dot-qualified name of a package"
|
||||
"'@JvmPackageName' annotation value must be a valid dot-qualified name of a package."
|
||||
)
|
||||
map.put(
|
||||
JVM_PACKAGE_NAME_NOT_SUPPORTED_IN_FILES_WITH_CLASSES,
|
||||
"'@JvmPackageName' annotation is not supported for files with class declarations"
|
||||
"'@JvmPackageName' annotation is not supported for files with class declarations."
|
||||
)
|
||||
map.put(
|
||||
SUPER_CALL_WITH_DEFAULT_PARAMETERS,
|
||||
"Super-calls with default arguments are not allowed. Please specify all arguments of ''super.{0}'' explicitly",
|
||||
"Super-calls with default arguments are prohibited. Please specify all arguments of ''super.{0}'' explicitly.",
|
||||
TO_STRING
|
||||
)
|
||||
|
||||
map.put(LOCAL_JVM_RECORD, "Local @JvmRecord classes are not allowed")
|
||||
map.put(NON_FINAL_JVM_RECORD, "@JvmRecord class should be final")
|
||||
map.put(ENUM_JVM_RECORD, "@JvmRecord class should not be an enum")
|
||||
map.put(LOCAL_JVM_RECORD, "Local '@JvmRecord' classes are prohibited.")
|
||||
map.put(NON_FINAL_JVM_RECORD, "'@JvmRecord' class should be final.")
|
||||
map.put(ENUM_JVM_RECORD, "'@JvmRecord' class should not be an enum.")
|
||||
map.put(
|
||||
JVM_RECORD_WITHOUT_PRIMARY_CONSTRUCTOR_PARAMETERS,
|
||||
"Primary constructor with parameters is required for @JvmRecord class"
|
||||
"Primary constructor with parameters is required for '@JvmRecord' class."
|
||||
)
|
||||
map.put(JVM_RECORD_NOT_VAL_PARAMETER, "Constructor parameter of @JvmRecord class should be a val")
|
||||
map.put(JVM_RECORD_NOT_LAST_VARARG_PARAMETER, "Only the last constructor parameter of @JvmRecord may be a vararg")
|
||||
map.put(JVM_RECORD_EXTENDS_CLASS, "Record cannot inherit a class", RENDER_TYPE)
|
||||
map.put(INNER_JVM_RECORD, "@JvmRecord class should not be inner")
|
||||
map.put(FIELD_IN_JVM_RECORD, "It's not allowed to have non-constructor properties with backing field in @JvmRecord class")
|
||||
map.put(DELEGATION_BY_IN_JVM_RECORD, "Delegation is not allowed for @JvmRecord classes")
|
||||
map.put(NON_DATA_CLASS_JVM_RECORD, "Only data classes are allowed to be marked as @JvmRecord")
|
||||
map.put(ILLEGAL_JAVA_LANG_RECORD_SUPERTYPE, "Classes cannot have explicit 'java.lang.Record' supertype")
|
||||
map.put(JVM_RECORD_NOT_VAL_PARAMETER, "Constructor parameter of '@JvmRecord' class should be a 'val'.")
|
||||
map.put(JVM_RECORD_NOT_LAST_VARARG_PARAMETER, "Only the last constructor parameter of '@JvmRecord' can be a vararg.")
|
||||
map.put(JVM_RECORD_EXTENDS_CLASS, "Record cannot extend a class.", RENDER_TYPE)
|
||||
map.put(INNER_JVM_RECORD, "'@JvmRecord' class should not be inner.")
|
||||
map.put(FIELD_IN_JVM_RECORD, "Non-constructor properties with backing field in '@JvmRecord' class are prohibited.")
|
||||
map.put(DELEGATION_BY_IN_JVM_RECORD, "Delegation is prohibited for '@JvmRecord' classes.")
|
||||
map.put(NON_DATA_CLASS_JVM_RECORD, "Only data classes are allowed to be marked as '@JvmRecord'.")
|
||||
map.put(ILLEGAL_JAVA_LANG_RECORD_SUPERTYPE, "Classes cannot have explicit 'java.lang.Record' supertype.")
|
||||
|
||||
map.put(OVERRIDE_CANNOT_BE_STATIC, "Override member cannot be '@JvmStatic' in object")
|
||||
map.put(OVERRIDE_CANNOT_BE_STATIC, "Override member cannot be '@JvmStatic' in an object.")
|
||||
map.put(
|
||||
JVM_STATIC_NOT_IN_OBJECT_OR_CLASS_COMPANION,
|
||||
"Only members in named objects and companion objects of classes can be annotated with '@JvmStatic'"
|
||||
"Only members in named objects and companion objects of classes can be annotated with '@JvmStatic'."
|
||||
)
|
||||
map.put(
|
||||
JVM_STATIC_NOT_IN_OBJECT_OR_COMPANION,
|
||||
"Only members in named objects and companion objects can be annotated with '@JvmStatic'"
|
||||
"Only members in named objects and companion objects can be annotated with '@JvmStatic'."
|
||||
)
|
||||
map.put(
|
||||
JVM_STATIC_ON_NON_PUBLIC_MEMBER,
|
||||
"Only public members in interface companion objects can be annotated with '@JvmStatic'"
|
||||
"Only public members in interface companion objects can be annotated with '@JvmStatic'."
|
||||
)
|
||||
map.put(
|
||||
JVM_STATIC_ON_CONST_OR_JVM_FIELD,
|
||||
"'@JvmStatic' annotation is useless for const or '@JvmField' properties",
|
||||
"'@JvmStatic' annotation is useless for const or '@JvmField' properties.",
|
||||
)
|
||||
map.put(
|
||||
JVM_STATIC_ON_EXTERNAL_IN_INTERFACE,
|
||||
"'@JvmStatic' annotation cannot be used on 'external' members of interface companions"
|
||||
"'@JvmStatic' annotation cannot be used on 'external' members of interface companions."
|
||||
)
|
||||
|
||||
map.put(INAPPLICABLE_JVM_NAME, "'@JvmName' annotation is not applicable to this declaration")
|
||||
map.put(ILLEGAL_JVM_NAME, "Illegal JVM name")
|
||||
map.put(INAPPLICABLE_JVM_NAME, "'@JvmName' annotation is not applicable to this declaration.")
|
||||
map.put(ILLEGAL_JVM_NAME, "Illegal JVM name.")
|
||||
|
||||
map.put(FUNCTION_DELEGATE_MEMBER_NAME_CLASH, "Spread operator is prohibited for arguments to signature-polymorphic calls")
|
||||
map.put(FUNCTION_DELEGATE_MEMBER_NAME_CLASH, "Spread operator is prohibited for arguments to signature-polymorphic calls.")
|
||||
|
||||
map.put(VALUE_CLASS_WITHOUT_JVM_INLINE_ANNOTATION, "Value classes without @JvmInline annotation are not supported yet")
|
||||
map.put(JVM_INLINE_WITHOUT_VALUE_CLASS, "@JvmInline annotation is only applicable to value classes")
|
||||
map.put(VALUE_CLASS_WITHOUT_JVM_INLINE_ANNOTATION, "Value classes without '@JvmInline' annotation are not yet supported.")
|
||||
map.put(JVM_INLINE_WITHOUT_VALUE_CLASS, "'@JvmInline' annotation is applicable only to value classes.")
|
||||
|
||||
map.put(JVM_DEFAULT_IN_DECLARATION, "Usage of ''@{0}'' is only allowed with -Xjvm-default option", STRING)
|
||||
map.put(JVM_DEFAULT_IN_DECLARATION, "Usage of ''@{0}'' is only allowed with ''-Xjvm-default'' option.", STRING)
|
||||
map.put(
|
||||
JVM_DEFAULT_WITH_COMPATIBILITY_IN_DECLARATION,
|
||||
"Usage of '@JvmDefaultWithCompatibility' is only allowed with '-Xjvm-default=all' option"
|
||||
"Usage of '@JvmDefaultWithCompatibility' is only allowed with '-Xjvm-default=all' option."
|
||||
)
|
||||
map.put(
|
||||
JVM_DEFAULT_WITH_COMPATIBILITY_NOT_ON_INTERFACE,
|
||||
"'@JvmDefaultWithCompatibility' annotation is only allowed on interfaces"
|
||||
"'@JvmDefaultWithCompatibility' annotation is allowed only on interfaces."
|
||||
)
|
||||
|
||||
map.put(EXTERNAL_DECLARATION_IN_INTERFACE, "Members of interfaces can not be external")
|
||||
map.put(EXTERNAL_DECLARATION_CANNOT_BE_ABSTRACT, "External declaration can not be abstract")
|
||||
map.put(EXTERNAL_DECLARATION_CANNOT_HAVE_BODY, "External declaration can not have a body")
|
||||
map.put(EXTERNAL_DECLARATION_CANNOT_BE_INLINED, "Inline functions can not be external")
|
||||
map.put(EXTERNAL_DECLARATION_IN_INTERFACE, "Members of interfaces cannot be external.")
|
||||
map.put(EXTERNAL_DECLARATION_CANNOT_BE_ABSTRACT, "External declaration cannot be abstract.")
|
||||
map.put(EXTERNAL_DECLARATION_CANNOT_HAVE_BODY, "External declaration cannot have a body.")
|
||||
map.put(EXTERNAL_DECLARATION_CANNOT_BE_INLINED, "Inline functions cannot be external.")
|
||||
|
||||
map.put(INAPPLICABLE_JVM_FIELD, "{0}", STRING)
|
||||
map.put(INAPPLICABLE_JVM_FIELD_WARNING, "{0}. This warning will become an error in further releases", STRING)
|
||||
map.put(INAPPLICABLE_JVM_FIELD, "{0}.", STRING)
|
||||
map.put(INAPPLICABLE_JVM_FIELD_WARNING, "{0}. This warning will become an error in future releases.", STRING)
|
||||
|
||||
map.put(JVM_SYNTHETIC_ON_DELEGATE, "'@JvmSynthetic' annotation cannot be used on delegated properties")
|
||||
map.put(JVM_SYNTHETIC_ON_DELEGATE, "'@JvmSynthetic' annotation cannot be used on delegated properties.")
|
||||
|
||||
map.put(
|
||||
NON_SOURCE_REPEATED_ANNOTATION,
|
||||
"Repeatable annotations with non-SOURCE retention are only supported starting from Kotlin 1.6"
|
||||
"Repeatable annotations with non-SOURCE retention are supported only in Kotlin 1.6 and later."
|
||||
)
|
||||
map.put(
|
||||
REPEATED_ANNOTATION_WITH_CONTAINER,
|
||||
"Repeated annotation ''@{0}'' cannot be used on a declaration which is annotated with its container annotation ''@{1}''",
|
||||
"Repeated annotation ''@{0}'' cannot be used on a declaration that is annotated with its container annotation ''@{1}''.",
|
||||
TO_STRING,
|
||||
TO_STRING
|
||||
)
|
||||
|
||||
map.put(
|
||||
INTERFACE_CANT_CALL_DEFAULT_METHOD_VIA_SUPER,
|
||||
"Interfaces can call JVM-default members via super only within JVM-default members. Please use '-Xjvm-default=all/all-compatibility' modes for such calls"
|
||||
"Interfaces can only call JVM-default members via super within JVM-default members. Please use '-Xjvm-default=all/all-compatibility' modes for such calls."
|
||||
)
|
||||
map.put(
|
||||
SUBCLASS_CANT_CALL_COMPANION_PROTECTED_NON_STATIC,
|
||||
"Using protected members which are not @JvmStatic in the superclass companion is unsupported yet"
|
||||
"Using protected members that are not '@JvmStatic' in the superclass companion is not yet supported."
|
||||
)
|
||||
|
||||
map.put(
|
||||
@@ -231,37 +231,37 @@ object FirJvmErrorsDefaultMessages : BaseDiagnosticRendererFactory() {
|
||||
)
|
||||
map.put(
|
||||
REPEATABLE_ANNOTATION_HAS_NESTED_CLASS_NAMED_CONTAINER,
|
||||
"Repeatable annotation cannot have a nested class named 'Container'. This name is reserved for auto-generated container class"
|
||||
"Repeatable annotation cannot have a nested class named 'Container'. This name is reserved for auto-generated container class."
|
||||
)
|
||||
map.put(
|
||||
SUSPENSION_POINT_INSIDE_CRITICAL_SECTION,
|
||||
"The ''{0}'' suspension point is inside a critical section",
|
||||
"The ''{0}'' suspension point is inside a critical section.",
|
||||
SYMBOL
|
||||
)
|
||||
map.put(
|
||||
CONCURRENT_HASH_MAP_CONTAINS_OPERATOR,
|
||||
"Method 'contains' from ConcurrentHashMap may have unexpected semantics: it calls 'containsValue' instead of 'containsKey'. " +
|
||||
"Use explicit form of the call to 'containsKey'/'containsValue'/'contains' or cast the value to kotlin.collections.Map instead. " +
|
||||
"See https://youtrack.jetbrains.com/issue/KT-18053 for more details"
|
||||
"Method 'contains' from ConcurrentHashMap might have unexpected semantics: it calls 'containsValue' instead of 'containsKey'. " +
|
||||
"Use the explicit form of the call to 'containsKey'/'containsValue'/'contains' or cast the value to 'kotlin.collections.Map' instead. " +
|
||||
"See https://youtrack.jetbrains.com/issue/KT-18053 for more details."
|
||||
)
|
||||
map.put(
|
||||
SPREAD_ON_SIGNATURE_POLYMORPHIC_CALL,
|
||||
"Spread operator is prohibited for arguments to signature-polymorphic calls"
|
||||
"Spread operator is prohibited for arguments to signature-polymorphic calls."
|
||||
)
|
||||
map.put(
|
||||
JAVA_SAM_INTERFACE_CONSTRUCTOR_REFERENCE,
|
||||
"Java SAM interface constructor references are prohibited"
|
||||
"Java SAM interface constructor references are prohibited."
|
||||
)
|
||||
map.put(
|
||||
REDUNDANT_REPEATABLE_ANNOTATION,
|
||||
"Please, remove the ''{0}'' annotation, as ''{1}'' is already enough",
|
||||
"Please remove the ''{0}'' annotation, as it is redundant in presence of ''{1}''.",
|
||||
TO_STRING,
|
||||
TO_STRING,
|
||||
)
|
||||
map.put(
|
||||
NO_REFLECTION_IN_CLASS_PATH,
|
||||
"Call uses reflection API which is not found in compilation classpath. " +
|
||||
"Make sure you have kotlin-reflect.jar in the classpath"
|
||||
"Make sure you have kotlin-reflect.jar in the classpath."
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+25
-25
@@ -42,49 +42,49 @@ import org.jetbrains.kotlin.fir.analysis.diagnostics.native.FirNativeErrors.UNCH
|
||||
|
||||
object FirNativeErrorsDefaultMessages : BaseDiagnosticRendererFactory() {
|
||||
override val MAP = KtDiagnosticFactoryToRendererMap("FIR").also { map ->
|
||||
map.put(THROWS_LIST_EMPTY, "Throws must have non-empty class list")
|
||||
map.put(INCOMPATIBLE_THROWS_OVERRIDE, "Member overrides different @Throws filter from {0}", SYMBOL)
|
||||
map.put(INCOMPATIBLE_THROWS_INHERITED, "Member inherits different @Throws filters from {0}", SYMBOLS)
|
||||
map.put(THROWS_LIST_EMPTY, "Throws must have a non-empty class list.")
|
||||
map.put(INCOMPATIBLE_THROWS_OVERRIDE, "Member overrides different ''@Throws'' filter from ''{0}''.", SYMBOL)
|
||||
map.put(INCOMPATIBLE_THROWS_INHERITED, "Member inherits different ''@Throws'' filters from ''{0}''.", SYMBOLS)
|
||||
map.put(
|
||||
MISSING_EXCEPTION_IN_THROWS_ON_SUSPEND, "@Throws on suspend declaration must have {0} (or any of its superclasses) listed",
|
||||
MISSING_EXCEPTION_IN_THROWS_ON_SUSPEND, "''@Throws'' on suspend declaration must have ''{0}'' (or any of its superclasses) listed.",
|
||||
TO_STRING
|
||||
)
|
||||
map.put(
|
||||
INAPPLICABLE_SHARED_IMMUTABLE_PROPERTY,
|
||||
"@SharedImmutable is applicable only to val with backing field or to property with delegation"
|
||||
"'@SharedImmutable' is applicable only to 'val' with backing field or to property with delegation."
|
||||
)
|
||||
map.put(INAPPLICABLE_SHARED_IMMUTABLE_TOP_LEVEL, "@SharedImmutable is applicable only to top level declarations")
|
||||
map.put(INAPPLICABLE_SHARED_IMMUTABLE_TOP_LEVEL, "'@SharedImmutable' is applicable only to top-level declarations.")
|
||||
map.put(
|
||||
INAPPLICABLE_THREAD_LOCAL,
|
||||
"@ThreadLocal is applicable only to property with backing field, to property with delegation or to objects"
|
||||
"'@ThreadLocal' is applicable only to property with backing field, to property with delegation, or to objects."
|
||||
)
|
||||
map.put(INAPPLICABLE_THREAD_LOCAL_TOP_LEVEL, "@ThreadLocal is applicable only to top level declarations")
|
||||
map.put(INVALID_CHARACTERS_NATIVE, "Name {0}", TO_STRING)
|
||||
map.put(REDUNDANT_SWIFT_REFINEMENT, "An ObjC refined declaration can't also be refined in Swift")
|
||||
map.put(INAPPLICABLE_THREAD_LOCAL_TOP_LEVEL, "'@ThreadLocal' is applicable only to top-level declarations.")
|
||||
map.put(INVALID_CHARACTERS_NATIVE, "Name {0}.", TO_STRING)
|
||||
map.put(REDUNDANT_SWIFT_REFINEMENT, "ObjC refined declarations cannot be refined in Swift.")
|
||||
map.put(
|
||||
INCOMPATIBLE_OBJC_REFINEMENT_OVERRIDE,
|
||||
"Refined declaration \"{0}\" overrides declarations with different or no refinement from {1}",
|
||||
"Refined declaration ''{0}'' overrides declarations with different or no refinement from ''{1}''.",
|
||||
SYMBOL,
|
||||
SYMBOLS
|
||||
)
|
||||
map.put(
|
||||
INVALID_OBJC_HIDES_TARGETS,
|
||||
"@HidesFromObjC annotation is only applicable to annotations with targets CLASS, FUNCTION and/or PROPERTY"
|
||||
"'@HidesFromObjC' annotation is only applicable to annotations with targets CLASS, FUNCTION, and/or PROPERTY."
|
||||
)
|
||||
map.put(
|
||||
INVALID_REFINES_IN_SWIFT_TARGETS,
|
||||
"@RefinesInSwift annotation is only applicable to annotations with targets FUNCTION and/or PROPERTY"
|
||||
"'@RefinesInSwift' annotation is only applicable to annotations with targets FUNCTION and/or PROPERTY."
|
||||
)
|
||||
map.put(INAPPLICABLE_OBJC_NAME, "@ObjCName is not applicable on overrides")
|
||||
map.put(INVALID_OBJC_NAME, "@ObjCName should have a name and/or swiftName")
|
||||
map.put(EMPTY_OBJC_NAME, "Empty @ObjCName names aren't supported")
|
||||
map.put(INVALID_OBJC_NAME_CHARS, "@ObjCName contains illegal characters: {0}", TO_STRING)
|
||||
map.put(INVALID_OBJC_NAME_FIRST_CHAR, "@ObjCName contains illegal first characters: {0}", TO_STRING)
|
||||
map.put(INCOMPATIBLE_OBJC_NAME_OVERRIDE, "Member \"{0}\" inherits inconsistent @ObjCName from {1}", SYMBOL, SYMBOLS)
|
||||
map.put(INAPPLICABLE_EXACT_OBJC_NAME, "Exact @ObjCName is only applicable to classes, objects and interfaces")
|
||||
map.put(MISSING_EXACT_OBJC_NAME, "Exact @ObjCName is required to have an ObjC name")
|
||||
map.put(NON_LITERAL_OBJC_NAME_ARG, "@ObjCName accepts only literal string and boolean values")
|
||||
map.put(SUBTYPE_OF_HIDDEN_FROM_OBJC, "Only @HiddenFromObjC declaration can be a subtype of @HiddenFromObjC declaration")
|
||||
map.put(INAPPLICABLE_OBJC_NAME, "'@ObjCName' is not applicable to overrides.")
|
||||
map.put(INVALID_OBJC_NAME, "'@ObjCName' should have a name and/or swiftName.")
|
||||
map.put(EMPTY_OBJC_NAME, "Empty '@ObjCName' names aren't supported.")
|
||||
map.put(INVALID_OBJC_NAME_CHARS, "''@ObjCName'' contains illegal characters ''{0}''.", TO_STRING)
|
||||
map.put(INVALID_OBJC_NAME_FIRST_CHAR, "''@ObjCName'' contains illegal first characters ''{0}''.", TO_STRING)
|
||||
map.put(INCOMPATIBLE_OBJC_NAME_OVERRIDE, "Member ''{0}'' inherits inconsistent ''@ObjCName'' from ''{1}''.", SYMBOL, SYMBOLS)
|
||||
map.put(INAPPLICABLE_EXACT_OBJC_NAME, "Exact '@ObjCName' is only applicable to classes, objects, and interfaces.")
|
||||
map.put(MISSING_EXACT_OBJC_NAME, "Exact '@ObjCName' is required to have an ObjC name.")
|
||||
map.put(NON_LITERAL_OBJC_NAME_ARG, "'@ObjCName' accepts only literal 'String' and 'Boolean' values.")
|
||||
map.put(SUBTYPE_OF_HIDDEN_FROM_OBJC, "Only '@HiddenFromObjC' declaration can be a subtype of '@HiddenFromObjC' declaration.")
|
||||
|
||||
|
||||
map.put(
|
||||
@@ -100,12 +100,12 @@ object FirNativeErrorsDefaultMessages : BaseDiagnosticRendererFactory() {
|
||||
)
|
||||
map.put(
|
||||
FORWARD_DECLARATION_AS_REIFIED_TYPE_ARGUMENT,
|
||||
"Cannot pass forward declaration ''{0}'' for reified type parameter",
|
||||
"Cannot pass forward declaration ''{0}'' for reified type parameter.",
|
||||
FirDiagnosticRenderers.RENDER_TYPE
|
||||
)
|
||||
map.put(
|
||||
FORWARD_DECLARATION_AS_CLASS_LITERAL,
|
||||
"Can't refer to forward declaration ''{0}'' from class literal",
|
||||
"Cannot refer to forward declaration ''{0}'' from class literal.",
|
||||
FirDiagnosticRenderers.RENDER_TYPE
|
||||
)
|
||||
}
|
||||
|
||||
+4
-4
@@ -62,10 +62,10 @@ object FirContractChecker : FirFunctionChecker() {
|
||||
|
||||
fun contractNotAllowed(message: String) = reporter.reportOn(source, FirErrors.CONTRACT_NOT_ALLOWED, message, context)
|
||||
|
||||
if (declaration is FirPropertyAccessor || declaration is FirAnonymousFunction) contractNotAllowed("Contracts are only allowed for functions")
|
||||
else if (declaration.isAbstract || declaration.isOpen || declaration.isOverride) contractNotAllowed("Contracts are not allowed for open or override functions")
|
||||
else if (declaration.isOperator) contractNotAllowed("Contracts are not allowed for operator functions")
|
||||
else if (declaration.symbol.callableId.isLocal || declaration.visibility == Visibilities.Local) contractNotAllowed("Contracts are not allowed for local functions")
|
||||
if (declaration is FirPropertyAccessor || declaration is FirAnonymousFunction) contractNotAllowed("Contracts are only allowed for functions.")
|
||||
else if (declaration.isAbstract || declaration.isOpen || declaration.isOverride) contractNotAllowed("Contracts are not allowed for open or override functions.")
|
||||
else if (declaration.isOperator) contractNotAllowed("Contracts are not allowed for operator functions.")
|
||||
else if (declaration.symbol.callableId.isLocal || declaration.visibility == Visibilities.Local) contractNotAllowed("Contracts are not allowed for local functions.")
|
||||
}
|
||||
|
||||
private object DiagnosticExtractor : KtContractDescriptionVisitor<ConeDiagnostic?, Nothing?, ConeKotlinType, ConeDiagnostic>() {
|
||||
|
||||
+2
-2
@@ -23,9 +23,9 @@ object FirContractNotFirstStatementChecker : FirFunctionCallChecker() {
|
||||
val containingDeclaration = context.containingDeclarations.last()
|
||||
if (!(containingDeclaration is FirFunction && expression.isCorrectlyPlacedIn(containingDeclaration))) {
|
||||
val message = if (containingDeclaration is FirFunction && containingDeclaration.body is FirSingleExpressionBlock) {
|
||||
"Contracts are only allowed in function body blocks"
|
||||
"Contracts are only allowed in function body blocks."
|
||||
} else {
|
||||
"Contract should be the first statement"
|
||||
"Contract should be the first statement."
|
||||
}
|
||||
|
||||
reporter.reportOn(expression.source, FirErrors.CONTRACT_NOT_ALLOWED, message, context)
|
||||
|
||||
+1
-1
@@ -161,7 +161,7 @@ object FirDiagnosticRenderers {
|
||||
}
|
||||
|
||||
val MODULE_DATA = Renderer<FirModuleData> {
|
||||
"Module ${it.name}"
|
||||
"module ${it.name}"
|
||||
}
|
||||
|
||||
val NAME_OF_CONTAINING_DECLARATION_OR_FILE = Renderer { symbol: CallableId ->
|
||||
|
||||
+589
-590
File diff suppressed because it is too large
Load Diff
+1
-2
@@ -9,9 +9,8 @@ import org.jetbrains.kotlin.diagnostics.KtDiagnosticFactoryToRendererMap
|
||||
import org.jetbrains.kotlin.diagnostics.KtDiagnosticRenderers.OPTIONAL_COLON_TO_STRING
|
||||
import org.jetbrains.kotlin.diagnostics.rendering.BaseDiagnosticRendererFactory
|
||||
|
||||
@Suppress("unused")
|
||||
object FirSyntaxErrorsDefaultMessages : BaseDiagnosticRendererFactory() {
|
||||
override val MAP = KtDiagnosticFactoryToRendererMap("FIR").also { map ->
|
||||
map.put(FirSyntaxErrors.SYNTAX, "Syntax error{0}", OPTIONAL_COLON_TO_STRING)
|
||||
map.put(FirSyntaxErrors.SYNTAX, "Syntax error{0}.", OPTIONAL_COLON_TO_STRING)
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -115,7 +115,8 @@ class KtDiagnosticFactoryToRendererMap(val name: String) {
|
||||
private fun KtDiagnosticFactoryForDeprecation<*>.warningMessage(errorMessage: String): String {
|
||||
return buildString {
|
||||
append(errorMessage)
|
||||
append(". This will become an error")
|
||||
if (!errorMessage.endsWith(".")) append(".")
|
||||
append(" This will become an error")
|
||||
val sinceVersion = deprecatingFeature.sinceVersion
|
||||
if (sinceVersion != null) {
|
||||
append(" in Kotlin ")
|
||||
@@ -123,6 +124,7 @@ class KtDiagnosticFactoryToRendererMap(val name: String) {
|
||||
} else {
|
||||
append(" in a future release")
|
||||
}
|
||||
append(".")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+24
-24
@@ -49,126 +49,126 @@ object KtDefaultErrorMessagesParcelize : BaseDiagnosticRendererFactory() {
|
||||
override val MAP = KtDiagnosticFactoryToRendererMap("Parcelize").also { map ->
|
||||
map.put(
|
||||
PARCELABLE_SHOULD_BE_CLASS,
|
||||
"'Parcelable' should be a class"
|
||||
"'Parcelable' should be a class."
|
||||
)
|
||||
|
||||
map.put(
|
||||
PARCELABLE_DELEGATE_IS_NOT_ALLOWED,
|
||||
"Delegating 'Parcelable' is not allowed"
|
||||
"Delegating 'Parcelable' is not allowed."
|
||||
)
|
||||
|
||||
map.put(
|
||||
PARCELABLE_SHOULD_NOT_BE_ENUM_CLASS,
|
||||
"'Parcelable' should not be a 'enum class'"
|
||||
"'Parcelable' should not be a 'enum class'."
|
||||
)
|
||||
|
||||
map.put(
|
||||
PARCELABLE_SHOULD_BE_INSTANTIABLE,
|
||||
"'Parcelable' should not be an 'abstract' class"
|
||||
"'Parcelable' should not be an 'abstract' class."
|
||||
)
|
||||
|
||||
map.put(
|
||||
PARCELABLE_CANT_BE_INNER_CLASS,
|
||||
"'Parcelable' can't be an inner class"
|
||||
"'Parcelable' can't be an inner class."
|
||||
)
|
||||
|
||||
map.put(
|
||||
PARCELABLE_CANT_BE_LOCAL_CLASS,
|
||||
"'Parcelable' can't be a local class"
|
||||
"'Parcelable' can't be a local class."
|
||||
)
|
||||
|
||||
map.put(
|
||||
NO_PARCELABLE_SUPERTYPE,
|
||||
"No 'Parcelable' supertype"
|
||||
"No 'Parcelable' supertype."
|
||||
)
|
||||
|
||||
map.put(
|
||||
PARCELABLE_SHOULD_HAVE_PRIMARY_CONSTRUCTOR,
|
||||
"'Parcelable' should have a primary constructor"
|
||||
"'Parcelable' should have a primary constructor."
|
||||
)
|
||||
|
||||
map.put(
|
||||
PARCELABLE_PRIMARY_CONSTRUCTOR_IS_EMPTY,
|
||||
"The primary constructor is empty, no data will be serialized to 'Parcel'"
|
||||
"The primary constructor is empty, no data will be serialized to 'Parcel'."
|
||||
)
|
||||
|
||||
map.put(
|
||||
PARCELABLE_CONSTRUCTOR_PARAMETER_SHOULD_BE_VAL_OR_VAR,
|
||||
"'Parcelable' constructor parameter should be 'val' or 'var'"
|
||||
"'Parcelable' constructor parameter should be 'val' or 'var'."
|
||||
)
|
||||
|
||||
map.put(
|
||||
PROPERTY_WONT_BE_SERIALIZED,
|
||||
"Property would not be serialized into a 'Parcel'. Add '@IgnoredOnParcel' annotation to remove the warning"
|
||||
"Property would not be serialized into a 'Parcel'. Add '@IgnoredOnParcel' annotation to remove the warning."
|
||||
)
|
||||
|
||||
map.put(
|
||||
OVERRIDING_WRITE_TO_PARCEL_IS_NOT_ALLOWED,
|
||||
"Overriding 'writeToParcel' is not allowed. Use 'Parceler' companion object instead"
|
||||
"Overriding 'writeToParcel' is not allowed. Use 'Parceler' companion object instead."
|
||||
)
|
||||
|
||||
map.put(
|
||||
CREATOR_DEFINITION_IS_NOT_ALLOWED,
|
||||
"'CREATOR' definition is not allowed. Use 'Parceler' companion object instead"
|
||||
"'CREATOR' definition is not allowed. Use 'Parceler' companion object instead."
|
||||
)
|
||||
|
||||
map.put(
|
||||
PARCELABLE_TYPE_NOT_SUPPORTED,
|
||||
"Type is not directly supported by 'Parcelize'. " +
|
||||
"Annotate the parameter type with '@RawValue' if you want it to be serialized using 'writeValue()'"
|
||||
"Annotate the parameter type with '@RawValue' if you want it to be serialized using 'writeValue()'."
|
||||
)
|
||||
|
||||
map.put(
|
||||
PARCELER_SHOULD_BE_OBJECT,
|
||||
"Parceler should be an object"
|
||||
"Parceler should be an object."
|
||||
)
|
||||
|
||||
map.put(
|
||||
PARCELER_TYPE_INCOMPATIBLE,
|
||||
"Parceler type {0} is incompatible with {1}",
|
||||
"Parceler type {0} is incompatible with {1}.",
|
||||
RENDER_TYPE, RENDER_TYPE
|
||||
)
|
||||
|
||||
map.put(
|
||||
DUPLICATING_TYPE_PARCELERS,
|
||||
"Duplicating ''TypeParceler'' annotations"
|
||||
"Duplicating 'TypeParceler' annotations."
|
||||
)
|
||||
|
||||
map.put(
|
||||
REDUNDANT_TYPE_PARCELER,
|
||||
"This ''TypeParceler'' is already provided for {0}",
|
||||
"This ''TypeParceler'' is already provided for ''{0}''.",
|
||||
RENDER_CLASS_OR_OBJECT
|
||||
)
|
||||
|
||||
map.put(
|
||||
CLASS_SHOULD_BE_PARCELIZE,
|
||||
"{0} should be annotated with ''@Parcelize''",
|
||||
"{0} should be annotated with ''@Parcelize''.",
|
||||
RENDER_CLASS_OR_OBJECT
|
||||
)
|
||||
|
||||
map.put(
|
||||
INAPPLICABLE_IGNORED_ON_PARCEL,
|
||||
"'@IgnoredOnParcel' is only applicable to class properties"
|
||||
"'@IgnoredOnParcel' is only applicable to class properties."
|
||||
)
|
||||
|
||||
map.put(
|
||||
INAPPLICABLE_IGNORED_ON_PARCEL_CONSTRUCTOR_PROPERTY,
|
||||
"'@IgnoredOnParcel' is inapplicable to properties without default value declared in the primary constructor"
|
||||
"'@IgnoredOnParcel' is inapplicable to properties without default value declared in the primary constructor."
|
||||
)
|
||||
|
||||
map.put(
|
||||
FORBIDDEN_DEPRECATED_ANNOTATION,
|
||||
"Parceler-related annotations from package 'kotlinx.android.parcel' are forbidden. Change package to 'kotlinx.parcelize'"
|
||||
"Parceler-related annotations from package 'kotlinx.android.parcel' are forbidden. Change package to 'kotlinx.parcelize'."
|
||||
)
|
||||
|
||||
map.put(
|
||||
DEPRECATED_ANNOTATION,
|
||||
"Parcelize annotations from package 'kotlinx.android.parcel' are deprecated. Change package to 'kotlinx.parcelize'"
|
||||
"Parcelize annotations from package 'kotlinx.android.parcel' are deprecated. Change package to 'kotlinx.parcelize'."
|
||||
)
|
||||
|
||||
map.put(
|
||||
DEPRECATED_PARCELER,
|
||||
"'kotlinx.android.parcel.Parceler' is deprecated. Use 'kotlinx.parcelize.Parceler' instead"
|
||||
"'kotlinx.android.parcel.Parceler' is deprecated. Use 'kotlinx.parcelize.Parceler' instead."
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user