Fix double quotes in diagnostic messages

For diagnostics without any parameters, the given text is simply rendered as a
String, so no symbols should be escaped.

For diagnostics with parameters, the format in java.text.MessageFormat is used,
so one single quote is erased and two single quotes become one single quote in
the rendered text.
This commit is contained in:
Alexander Udalov
2016-03-29 14:13:59 +03:00
parent 484167e9d9
commit 8316953259
41 changed files with 103 additions and 103 deletions
@@ -49,7 +49,7 @@ public class DefaultErrorMessagesJvm implements DefaultErrorMessages.Extension {
}
};
public static final DiagnosticFactoryToRendererMap MAP = new DiagnosticFactoryToRendererMap("JVM");
private static final DiagnosticFactoryToRendererMap MAP = new DiagnosticFactoryToRendererMap("JVM");
static {
MAP.put(ErrorsJvm.CONFLICTING_JVM_DECLARATIONS, "Platform declaration clash: {0}", CONFLICTING_JVM_DECLARATIONS_DATA);
MAP.put(ErrorsJvm.ACCIDENTAL_OVERRIDE, "Accidental override: {0}", CONFLICTING_JVM_DECLARATIONS_DATA);
@@ -57,17 +57,17 @@ public class DefaultErrorMessagesJvm implements DefaultErrorMessages.Extension {
MAP.put(ErrorsJvm.MISSING_DEPENDENCY_CLASS, "Cannot access class ''{0}''. Check your module classpath for missing or conflicting dependencies", Renderers.TO_STRING);
MAP.put(ErrorsJvm.JVM_STATIC_NOT_IN_OBJECT, "Only functions in named objects and companion objects of classes can be annotated with ''@JvmStatic''");
MAP.put(ErrorsJvm.JVM_STATIC_ON_CONST_OR_JVM_FIELD, "''@JvmStatic'' annotation is useless for const or ''@JvmField'' properties");
MAP.put(ErrorsJvm.OVERRIDE_CANNOT_BE_STATIC, "Override member cannot be ''@JvmStatic'' in object");
MAP.put(ErrorsJvm.OVERLOADS_WITHOUT_DEFAULT_ARGUMENTS, "''@JvmOverloads'' annotation has no effect for methods without default arguments");
MAP.put(ErrorsJvm.OVERLOADS_ABSTRACT, "''@JvmOverloads'' annotation cannot be used on abstract methods");
MAP.put(ErrorsJvm.OVERLOADS_PRIVATE, "''@JvmOverloads'' annotation has no effect on private and local declarations");
MAP.put(ErrorsJvm.INAPPLICABLE_JVM_NAME, "''@JvmName'' annotation is not applicable to this declaration");
MAP.put(ErrorsJvm.JVM_STATIC_NOT_IN_OBJECT, "Only functions in named objects and companion objects of classes can be annotated with '@JvmStatic'");
MAP.put(ErrorsJvm.JVM_STATIC_ON_CONST_OR_JVM_FIELD, "'@JvmStatic' annotation is useless for const or '@JvmField' properties");
MAP.put(ErrorsJvm.OVERRIDE_CANNOT_BE_STATIC, "Override member cannot be '@JvmStatic' in object");
MAP.put(ErrorsJvm.OVERLOADS_WITHOUT_DEFAULT_ARGUMENTS, "'@JvmOverloads' annotation has no effect for methods without default arguments");
MAP.put(ErrorsJvm.OVERLOADS_ABSTRACT, "'@JvmOverloads' annotation cannot be used on abstract methods");
MAP.put(ErrorsJvm.OVERLOADS_PRIVATE, "'@JvmOverloads' annotation has no effect on private and local declarations");
MAP.put(ErrorsJvm.INAPPLICABLE_JVM_NAME, "'@JvmName' annotation is not applicable to this declaration");
MAP.put(ErrorsJvm.ILLEGAL_JVM_NAME, "Illegal JVM name");
MAP.put(ErrorsJvm.VOLATILE_ON_VALUE, "''@Volatile'' annotation cannot be used on immutable properties");
MAP.put(ErrorsJvm.VOLATILE_ON_DELEGATE, "''@Volatile'' annotation cannot be used on delegated properties");
MAP.put(ErrorsJvm.SYNCHRONIZED_ON_ABSTRACT, "''@Synchronized'' annotation cannot be used on abstract functions");
MAP.put(ErrorsJvm.VOLATILE_ON_VALUE, "'@Volatile' annotation cannot be used on immutable properties");
MAP.put(ErrorsJvm.VOLATILE_ON_DELEGATE, "'@Volatile' annotation cannot be used on delegated properties");
MAP.put(ErrorsJvm.SYNCHRONIZED_ON_ABSTRACT, "'@Synchronized' annotation cannot be used on abstract functions");
MAP.put(ErrorsJvm.EXTERNAL_DECLARATION_CANNOT_BE_ABSTRACT, "External declaration can not be abstract");
MAP.put(ErrorsJvm.EXTERNAL_DECLARATION_CANNOT_HAVE_BODY, "External declaration can not have a body");
MAP.put(ErrorsJvm.EXTERNAL_DECLARATION_IN_INTERFACE, "Members of interfaces can not be external");
@@ -101,9 +101,9 @@ public class DefaultErrorMessagesJvm implements DefaultErrorMessages.Extension {
MAP.put(ErrorsJvm.INAPPLICABLE_JVM_FIELD, "{0}", Renderers.TO_STRING);
MAP.put(ErrorsJvm.JVM_SYNTHETIC_ON_DELEGATE, "''@JvmSynthetic'' annotation cannot be used on delegated properties");
MAP.put(ErrorsJvm.JVM_SYNTHETIC_ON_DELEGATE, "'@JvmSynthetic' annotation cannot be used on delegated properties");
MAP.put(ErrorsJvm.STRICTFP_ON_CLASS, "''@Strictfp'' annotation on classes is unsupported yet");
MAP.put(ErrorsJvm.STRICTFP_ON_CLASS, "'@Strictfp' annotation on classes is unsupported yet");
MAP.put(ErrorsJvm.SUPER_CALL_WITH_DEFAULT_PARAMETERS, "Super-calls with default arguments are not allowed. Please specify all arguments of ''super.{0}'' explicitly", Renderers.TO_STRING);
}
@@ -146,14 +146,14 @@ public class DefaultErrorMessages {
MAP.put(INAPPLICABLE_TARGET_ON_PROPERTY, "''@{0}:'' annotations could be applied only to property declarations", TO_STRING);
MAP.put(INAPPLICABLE_TARGET_PROPERTY_IMMUTABLE, "''@{0}:'' annotations could be applied only to mutable properties", TO_STRING);
MAP.put(INAPPLICABLE_TARGET_PROPERTY_HAS_NO_DELEGATE, "''@delegate:'' annotations could be applied only to delegated properties");
MAP.put(INAPPLICABLE_TARGET_PROPERTY_HAS_NO_BACKING_FIELD, "''@field:'' annotations could be applied only to properties with backing fields");
MAP.put(INAPPLICABLE_RECEIVER_TARGET, "''@receiver:'' annotations could be applied only to extension function or extension property declarations");
MAP.put(INAPPLICABLE_PARAM_TARGET, "''@param:'' annotations could be applied only to primary constructor parameters");
MAP.put(INAPPLICABLE_TARGET_PROPERTY_HAS_NO_DELEGATE, "'@delegate:' annotations could be applied only to delegated properties");
MAP.put(INAPPLICABLE_TARGET_PROPERTY_HAS_NO_BACKING_FIELD, "'@field:' annotations could be applied only to properties with backing fields");
MAP.put(INAPPLICABLE_RECEIVER_TARGET, "'@receiver:' annotations could be applied only to extension function or extension property declarations");
MAP.put(INAPPLICABLE_PARAM_TARGET, "'@param:' annotations could be applied only to primary constructor parameters");
MAP.put(REDUNDANT_ANNOTATION_TARGET, "Redundant annotation target ''{0}''", STRING);
MAP.put(REDUNDANT_MODIFIER, "Modifier ''{0}'' is redundant because ''{1}'' is present", TO_STRING, TO_STRING);
MAP.put(ABSTRACT_MODIFIER_IN_INTERFACE, "Modifier ''abstract'' is redundant in interface");
MAP.put(ABSTRACT_MODIFIER_IN_INTERFACE, "Modifier 'abstract' is redundant in interface");
MAP.put(REDUNDANT_MODIFIER_IN_GETTER, "Visibility modifiers are redundant in getter");
MAP.put(TYPE_PARAMETERS_IN_ENUM, "Enum class cannot have type parameters");
MAP.put(TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM,
@@ -236,8 +236,8 @@ public class DefaultErrorMessages {
MAP.put(NON_MEMBER_FUNCTION_NO_BODY, "Function ''{0}'' must have a body", NAME);
MAP.put(FUNCTION_DECLARATION_WITH_NO_NAME, "Function declaration must have a name");
MAP.put(ANONYMOUS_FUNCTION_WITH_NAME, "Anonymous functions with names are prohibited");
MAP.put(NON_FINAL_MEMBER_IN_FINAL_CLASS, "\"open\" has no effect in a final class");
MAP.put(NON_FINAL_MEMBER_IN_OBJECT, "\"open\" has no effect in an object");
MAP.put(NON_FINAL_MEMBER_IN_FINAL_CLASS, "'open' has no effect in a final class");
MAP.put(NON_FINAL_MEMBER_IN_OBJECT, "'open' has no effect in an object");
MAP.put(ANONYMOUS_FUNCTION_PARAMETER_WITH_DEFAULT_VALUE, "An anonymous function is not allowed to specify default values for its parameters");
MAP.put(USELESS_VARARG_ON_PARAMETER, "Vararg on this parameter is useless");
@@ -270,7 +270,7 @@ public class DefaultErrorMessages {
MAP.put(VAL_REASSIGNMENT, "Val cannot be reassigned", NAME);
MAP.put(CAPTURED_VAL_INITIALIZATION, "Captured values initialization is forbidden due to possible reassignment", NAME);
MAP.put(SETTER_PROJECTED_OUT, "Setter for ''{0}'' is removed by type projection", NAME);
MAP.put(INVISIBLE_SETTER, "Cannot assign to ''{0}'': the setter is ''{1}'' in {2}", NAME, TO_STRING, NAME_OF_PARENT_OR_FILE);
MAP.put(INVISIBLE_SETTER, "Cannot assign to ''{0}'': the setter is {1} in {2}", NAME, TO_STRING, NAME_OF_PARENT_OR_FILE);
MAP.put(INITIALIZATION_BEFORE_DECLARATION, "Variable cannot be initialized before declaration", NAME);
MAP.put(VARIABLE_EXPECTED, "Variable expected");
@@ -315,7 +315,7 @@ public class DefaultErrorMessages {
MAP.put(EQUALS_MISSING, "No method 'equals(Any?): Boolean' available");
MAP.put(ASSIGNMENT_IN_EXPRESSION_CONTEXT, "Assignments are not expressions, and only expressions are allowed in this context");
MAP.put(SUPER_IS_NOT_AN_EXPRESSION, "''{0}'' is not an expression, it can only be used on the left-hand side of a dot ('.')", STRING);
MAP.put(SUPER_IS_NOT_AN_EXPRESSION, "''{0}'' is not an expression, it can only be used on the left-hand side of a dot (''.'')", STRING);
MAP.put(SUPER_CANT_BE_EXTENSION_RECEIVER, "''{0}'' is not an expression, it can not be used as a receiver for extension functions", STRING);
MAP.put(DECLARATION_IN_ILLEGAL_CONTEXT, "Declarations are not allowed in this position");
MAP.put(SETTER_PARAMETER_WITH_DEFAULT_VALUE, "Setter parameters cannot have default values");
@@ -350,12 +350,12 @@ public class DefaultErrorMessages {
MAP.put(HAS_NEXT_FUNCTION_NONE_APPLICABLE, "None of the hasNext() functions is applicable for iterator() of type ''{0}''", RENDER_TYPE);
MAP.put(HAS_NEXT_FUNCTION_TYPE_MISMATCH, "The ''iterator().hasNext()'' function of the loop range must return Boolean, but returns {0}", RENDER_TYPE);
MAP.put(NEXT_MISSING, "next() cannot be called on iterator() of type ''{0}''", RENDER_TYPE);
MAP.put(NEXT_AMBIGUITY, "next() is ambiguous for iterator() of type ''{0}''", RENDER_TYPE);
MAP.put(NEXT_NONE_APPLICABLE, "None of the next() functions is applicable for iterator() of type ''{0}''", RENDER_TYPE);
MAP.put(NEXT_MISSING, "''next()'' cannot be called on ''iterator()'' of type ''{0}''", RENDER_TYPE);
MAP.put(NEXT_AMBIGUITY, "''next()'' is ambiguous for ''iterator()'' of type ''{0}''", RENDER_TYPE);
MAP.put(NEXT_NONE_APPLICABLE, "None of the ''next()'' functions is applicable for ''iterator()'' of type ''{0}''", RENDER_TYPE);
MAP.put(ITERATOR_MISSING, "For-loop range must have an iterator() method");
MAP.put(ITERATOR_ON_NULLABLE, "Not nullable value required to call an iterator() method on for-loop range");
MAP.put(ITERATOR_MISSING, "For-loop range must have an 'iterator()' method");
MAP.put(ITERATOR_ON_NULLABLE, "Not nullable value required to call an 'iterator()' method on for-loop range");
MAP.put(ITERATOR_AMBIGUITY, "Method ''iterator()'' is ambiguous for this expression: {0}", AMBIGUOUS_CALLS);
MAP.put(DELEGATE_SPECIAL_FUNCTION_MISSING, "Missing ''{0}'' method on delegate of type ''{1}''", STRING, RENDER_TYPE);
@@ -372,11 +372,11 @@ public class DefaultErrorMessages {
MAP.put(UNDERSCORE_IS_RESERVED, "Names _, __, ___, ..., are reserved in Kotlin");
MAP.put(INVALID_CHARACTERS, "Name {0}", STRING);
MAP.put(INAPPLICABLE_OPERATOR_MODIFIER, "'operator' modifier is inapplicable on this function: {0}", STRING);
MAP.put(INAPPLICABLE_OPERATOR_MODIFIER, "''operator'' modifier is inapplicable on this function: {0}", STRING);
MAP.put(INAPPLICABLE_INFIX_MODIFIER, "'infix' modifier is inapplicable on this function");
MAP.put(OPERATOR_MODIFIER_REQUIRED, "'operator' modifier is required on ''{0}'' in ''{1}''", NAME, STRING);
MAP.put(INFIX_MODIFIER_REQUIRED, "'infix' modifier is required on ''{0}'' in ''{1}''", NAME, STRING);
MAP.put(OPERATOR_MODIFIER_REQUIRED, "''operator'' modifier is required on ''{0}'' in ''{1}''", NAME, STRING);
MAP.put(INFIX_MODIFIER_REQUIRED, "''infix'' modifier is required on ''{0}'' in ''{1}''", NAME, STRING);
MAP.put(RETURN_IN_FUNCTION_WITH_EXPRESSION_BODY,
"Returns are not allowed for functions with expression body. Use block body in '{...}'");
@@ -429,8 +429,8 @@ public class DefaultErrorMessages {
MAP.put(ELSE_MISPLACED_IN_WHEN, "'else' entry must be the last one in a when-expression");
MAP.put(COMMA_IN_WHEN_CONDITION_WITHOUT_ARGUMENT, "Deprecated syntax. Use '||' instead of commas in when-condition for 'when' without argument");
MAP.put(NO_ELSE_IN_WHEN, "'when' expression must be exhaustive, add necessary {0}", RENDER_WHEN_MISSING_CASES);
MAP.put(NON_EXHAUSTIVE_WHEN, "'when' expression on enum is recommended to be exhaustive, add {0}", RENDER_WHEN_MISSING_CASES);
MAP.put(NO_ELSE_IN_WHEN, "''when'' expression must be exhaustive, add necessary {0}", RENDER_WHEN_MISSING_CASES);
MAP.put(NON_EXHAUSTIVE_WHEN, "''when'' expression on enum is recommended to be exhaustive, add {0}", RENDER_WHEN_MISSING_CASES);
MAP.put(TYPE_MISMATCH_IN_RANGE, "Type mismatch: incompatible types of range and element checked in it");
MAP.put(CYCLIC_INHERITANCE_HIERARCHY, "There's a cycle in the inheritance hierarchy for this type");
@@ -479,7 +479,7 @@ public class DefaultErrorMessages {
MAP.put(DYNAMIC_SUPERTYPE, "A supertype cannot be dynamic");
MAP.put(REDUNDANT_NULLABLE, "Redundant '?'");
MAP.put(UNSAFE_CALL, "Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type {0}", RENDER_TYPE);
MAP.put(UNSAFE_IMPLICIT_INVOKE_CALL, "Reference has a nullable type {0}, use explicit '?.invoke()' to make function-like call instead", RENDER_TYPE);
MAP.put(UNSAFE_IMPLICIT_INVOKE_CALL, "Reference has a nullable type ''{0}'', use explicit ''?.invoke()'' to make a function-like call instead", RENDER_TYPE);
MAP.put(AMBIGUOUS_LABEL, "Ambiguous label");
MAP.put(UNSUPPORTED, "Unsupported [{0}]", STRING);
MAP.put(EXCEPTION_FROM_ANALYZER, "Internal Error occurred while analyzing this expression:\n{0}", THROWABLE);
@@ -539,8 +539,8 @@ public class DefaultErrorMessages {
RENDER_TYPE);
MAP.put(TYPE_MISMATCH_IN_CONDITION, "Condition must be of type Boolean, but is of type {0}", RENDER_TYPE);
MAP.put(INCOMPATIBLE_TYPES, "Incompatible types: {0} and {1}", RENDER_TYPE, RENDER_TYPE);
MAP.put(IMPLICIT_NOTHING_RETURN_TYPE, "''Nothing'' return type needs to be specified explicitly");
MAP.put(IMPLICIT_NOTHING_PROPERTY_TYPE, "''Nothing'' property type needs to be specified explicitly");
MAP.put(IMPLICIT_NOTHING_RETURN_TYPE, "'Nothing' return type needs to be specified explicitly");
MAP.put(IMPLICIT_NOTHING_PROPERTY_TYPE, "'Nothing' property type needs to be specified explicitly");
MAP.put(IMPLICIT_INTERSECTION_TYPE, "Inferred type {0} is an intersection, please specify the required type explicitly", RENDER_TYPE);
MAP.put(EXPECTED_CONDITION, "Expected condition of type Boolean");
@@ -584,7 +584,7 @@ public class DefaultErrorMessages {
MAP.put(OVERRIDING_FINAL_MEMBER_BY_DELEGATION, "''{0}'' implicitly overrides a final member ''{1}'' by delegation",
SHORT_NAMES_IN_TYPES, SHORT_NAMES_IN_TYPES);
MAP.put(VAR_OVERRIDDEN_BY_VAL_BY_DELEGATION, "val-property ''{0}'' implicitly overrides a var-property ''{1}'' by delegation",
MAP.put(VAR_OVERRIDDEN_BY_VAL_BY_DELEGATION, "Val-property ''{0}'' implicitly overrides a var-property ''{1}'' by delegation",
SHORT_NAMES_IN_TYPES, SHORT_NAMES_IN_TYPES);
MAP.put(VAR_OVERRIDDEN_BY_VAL, "Var-property {0} cannot be overridden by val-property {1}", FQ_NAMES_IN_TYPES, FQ_NAMES_IN_TYPES);
@@ -604,7 +604,7 @@ public class DefaultErrorMessages {
DECLARATION_NAME_WITH_KIND);
MAP.put(FUNCTION_EXPECTED, "Expression ''{0}''{1} cannot be invoked as a function. " +
"The function '" + OperatorNameConventions.INVOKE.asString() + "()' is not found",
"The function ''" + OperatorNameConventions.INVOKE.asString() + "()'' is not found",
ELEMENT_TEXT, new DiagnosticParameterRenderer<KotlinType>() {
@NotNull
@Override
@@ -626,7 +626,7 @@ public class DefaultErrorMessages {
MAP.put(RESULT_TYPE_MISMATCH, "{0} must return {1} but returns {2}", STRING, RENDER_TYPE, RENDER_TYPE);
MAP.put(UNSAFE_INFIX_CALL,
"Infix call corresponds to a dot-qualified call ''{0}.{1}({2})'' which is not allowed on a nullable receiver ''{0}''. " +
"Use '?.'-qualified call instead",
"Use ''?.''-qualified call instead",
STRING, STRING, STRING);
MAP.put(OVERLOAD_RESOLUTION_AMBIGUITY, "Overload resolution ambiguity: {0}", AMBIGUOUS_CALLS);
@@ -681,7 +681,7 @@ public class DefaultErrorMessages {
MAP.put(CONST_VAL_NOT_TOP_LEVEL_OR_OBJECT, "Const 'val' are only allowed on top level or in objects");
MAP.put(CONST_VAL_WITH_DELEGATE, "Const 'val' should not have a delegate");
MAP.put(CONST_VAL_WITH_GETTER, "Const 'val' should not have a getter");
MAP.put(TYPE_CANT_BE_USED_FOR_CONST_VAL, "Const 'val' has type ''{0}''. Only primitives and String are allowed", RENDER_TYPE);
MAP.put(TYPE_CANT_BE_USED_FOR_CONST_VAL, "Const ''val'' has type ''{0}''. Only primitives and String are allowed", RENDER_TYPE);
MAP.put(CONST_VAL_WITHOUT_INITIALIZER, "Const 'val' should have an initializer");
MAP.put(CONST_VAL_WITH_NON_CONST_INITIALIZER, "Const 'val' initializer should be a constant value");
MAP.put(NON_CONST_VAL_USED_IN_CONSTANT_EXPRESSION, "Only 'const val' can be used in constant expressions");
@@ -725,7 +725,7 @@ public class DefaultErrorMessages {
MAP.put(NON_PUBLIC_CALL_FROM_PUBLIC_INLINE, "Public-API inline function cannot access non-public-API ''{0}''", SHORT_NAMES_IN_TYPES, SHORT_NAMES_IN_TYPES);
MAP.put(PRIVATE_CLASS_MEMBER_FROM_INLINE, "Non-private inline function cannot access members of private classes: ''{0}''", SHORT_NAMES_IN_TYPES, SHORT_NAMES_IN_TYPES);
MAP.put(NOT_YET_SUPPORTED_IN_INLINE, "''{0}'' construction is not yet supported in inline functions", ELEMENT_TEXT, SHORT_NAMES_IN_TYPES);
MAP.put(DECLARATION_CANT_BE_INLINED, "''inline'' modifier is not allowed on virtual members. Only private or final members can be inlined");
MAP.put(DECLARATION_CANT_BE_INLINED, "'inline' modifier is not allowed on virtual members. Only private or final members can be inlined");
MAP.put(NOTHING_TO_INLINE, "Expected performance impact of inlining ''{0}'' can be insignificant. Inlining works best for functions with lambda parameters", SHORT_NAMES_IN_TYPES);
MAP.put(USAGE_IS_NOT_INLINABLE, "Illegal usage of inline-parameter ''{0}'' in ''{1}''. Add ''noinline'' modifier to the parameter declaration", ELEMENT_TEXT, SHORT_NAMES_IN_TYPES);
MAP.put(NULLABLE_INLINE_PARAMETER, "Inline-parameter ''{0}'' of ''{1}'' must not be nullable. Add ''noinline'' modifier to the parameter declaration or make its type not nullable", ELEMENT_TEXT, SHORT_NAMES_IN_TYPES);
+6 -6
View File
@@ -16,13 +16,13 @@ class A {
fun test() {
val <warning descr="[UNUSED_VARIABLE] Variable 's' is never used">s</warning> = object {
<error descr="[JVM_STATIC_NOT_IN_OBJECT] Only functions in named objects and companion objects of classes can be annotated with ''@JvmStatic''">@JvmStatic fun a3()</error> {
<error descr="[JVM_STATIC_NOT_IN_OBJECT] Only functions in named objects and companion objects of classes can be annotated with '@JvmStatic'">@JvmStatic fun a3()</error> {
}
}
}
<error descr="[JVM_STATIC_NOT_IN_OBJECT] Only functions in named objects and companion objects of classes can be annotated with ''@JvmStatic''">@JvmStatic fun a4()</error> {
<error descr="[JVM_STATIC_NOT_IN_OBJECT] Only functions in named objects and companion objects of classes can be annotated with '@JvmStatic'">@JvmStatic fun a4()</error> {
}
}
@@ -30,7 +30,7 @@ class A {
<error descr="[WRONG_ANNOTATION_TARGET] This annotation is not applicable to target 'interface'">@JvmStatic</error>
interface B {
companion object {
<error descr="[JVM_STATIC_NOT_IN_OBJECT] Only functions in named objects and companion objects of classes can be annotated with ''@JvmStatic''">@JvmStatic fun a1()</error> {
<error descr="[JVM_STATIC_NOT_IN_OBJECT] Only functions in named objects and companion objects of classes can be annotated with '@JvmStatic'">@JvmStatic fun a1()</error> {
}
}
@@ -43,13 +43,13 @@ interface B {
fun test() {
val <warning descr="[UNUSED_VARIABLE] Variable 's' is never used">s</warning> = object {
<error descr="[JVM_STATIC_NOT_IN_OBJECT] Only functions in named objects and companion objects of classes can be annotated with ''@JvmStatic''">@JvmStatic fun a3()</error> {
<error descr="[JVM_STATIC_NOT_IN_OBJECT] Only functions in named objects and companion objects of classes can be annotated with '@JvmStatic'">@JvmStatic fun a3()</error> {
}
}
}
<error descr="[JVM_STATIC_NOT_IN_OBJECT] Only functions in named objects and companion objects of classes can be annotated with ''@JvmStatic''">@JvmStatic fun a4()</error> {
<error descr="[JVM_STATIC_NOT_IN_OBJECT] Only functions in named objects and companion objects of classes can be annotated with '@JvmStatic'">@JvmStatic fun a4()</error> {
}
}
}
+3 -3
View File
@@ -2,7 +2,7 @@ class Rule(val apply: () -> Unit)
fun foo() {
val rule: Rule? = Rule { }
rule?.<error descr="[UNSAFE_IMPLICIT_INVOKE_CALL] Reference has a nullable type (() -> Unit)?, use explicit ?.invoke() to make function-like call instead">apply</error>()
rule?.<error descr="[UNSAFE_IMPLICIT_INVOKE_CALL] Reference has a nullable type '(() -> Unit)?', use explicit '?.invoke()' to make a function-like call instead">apply</error>()
val apply = rule?.apply
<error descr="[UNSAFE_IMPLICIT_INVOKE_CALL] Reference has a nullable type (() -> Unit)?, use explicit ?.invoke() to make function-like call instead">apply</error>()
}
<error descr="[UNSAFE_IMPLICIT_INVOKE_CALL] Reference has a nullable type '(() -> Unit)?', use explicit '?.invoke()' to make a function-like call instead">apply</error>()
}
+11 -11
View File
@@ -1,12 +1,12 @@
fun nonExhaustiveInt(x: Int) = <error descr="[NO_ELSE_IN_WHEN] when expression must be exhaustive, add necessary 'else' branch">when</error>(x) {
fun nonExhaustiveInt(x: Int) = <error descr="[NO_ELSE_IN_WHEN] 'when' expression must be exhaustive, add necessary 'else' branch">when</error>(x) {
0 -> false
}
fun nonExhaustiveBoolean(b: Boolean) = <error descr="[NO_ELSE_IN_WHEN] when expression must be exhaustive, add necessary 'true' branch or 'else' branch instead">when</error>(b) {
fun nonExhaustiveBoolean(b: Boolean) = <error descr="[NO_ELSE_IN_WHEN] 'when' expression must be exhaustive, add necessary 'true' branch or 'else' branch instead">when</error>(b) {
false -> 0
}
fun nonExhaustiveNullableBoolean(b: Boolean?) = <error descr="[NO_ELSE_IN_WHEN] when expression must be exhaustive, add necessary 'null' branch or 'else' branch instead">when</error>(b) {
fun nonExhaustiveNullableBoolean(b: Boolean?) = <error descr="[NO_ELSE_IN_WHEN] 'when' expression must be exhaustive, add necessary 'null' branch or 'else' branch instead">when</error>(b) {
false -> 0
true -> 1
}
@@ -17,17 +17,17 @@ enum class Color {
BLUE
}
fun nonExhaustiveEnum(c: Color) = <error descr="[NO_ELSE_IN_WHEN] when expression must be exhaustive, add necessary 'RED', 'BLUE' branches or 'else' branch instead">when</error>(c) {
fun nonExhaustiveEnum(c: Color) = <error descr="[NO_ELSE_IN_WHEN] 'when' expression must be exhaustive, add necessary 'RED', 'BLUE' branches or 'else' branch instead">when</error>(c) {
Color.GREEN -> 0xff00
}
fun nonExhaustiveNullable(c: Color?) = <error descr="[NO_ELSE_IN_WHEN] when expression must be exhaustive, add necessary 'GREEN', 'null' branches or 'else' branch instead">when</error>(c) {
fun nonExhaustiveNullable(c: Color?) = <error descr="[NO_ELSE_IN_WHEN] 'when' expression must be exhaustive, add necessary 'GREEN', 'null' branches or 'else' branch instead">when</error>(c) {
Color.RED -> 0xff
Color.BLUE -> 0xff0000
}
fun whenOnEnum(c: Color) {
<warning descr="[NON_EXHAUSTIVE_WHEN] when expression on enum is recommended to be exhaustive, add 'RED' branch or 'else' branch instead">when</warning>(c) {
<warning descr="[NON_EXHAUSTIVE_WHEN] 'when' expression on enum is recommended to be exhaustive, add 'RED' branch or 'else' branch instead">when</warning>(c) {
Color.BLUE -> {}
Color.GREEN -> {}
}
@@ -37,7 +37,7 @@ enum class EnumInt {
A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11, A12, A13, A14, A15
}
fun whenOnLongEnum(i: EnumInt) = <error descr="[NO_ELSE_IN_WHEN] when expression must be exhaustive, add necessary 'A0', 'A1', 'A2', 'A3', 'A4', 'A5', 'A6', ... branches or 'else' branch instead">when</error> (i) {
fun whenOnLongEnum(i: EnumInt) = <error descr="[NO_ELSE_IN_WHEN] 'when' expression must be exhaustive, add necessary 'A0', 'A1', 'A2', 'A3', 'A4', 'A5', 'A6', ... branches or 'else' branch instead">when</error> (i) {
EnumInt.A7 -> 7
}
@@ -49,17 +49,17 @@ sealed class Variant {
object Another : Variant()
}
fun nonExhaustiveSealed(v: Variant) = <error descr="[NO_ELSE_IN_WHEN] when expression must be exhaustive, add necessary 'is Something', 'Another' branches or 'else' branch instead">when</error>(v) {
fun nonExhaustiveSealed(v: Variant) = <error descr="[NO_ELSE_IN_WHEN] 'when' expression must be exhaustive, add necessary 'is Something', 'Another' branches or 'else' branch instead">when</error>(v) {
Variant.Singleton -> false
}
fun nonExhaustiveNullableSealed(v: Variant?) = <error descr="[NO_ELSE_IN_WHEN] when expression must be exhaustive, add necessary 'Another', 'null' branches or 'else' branch instead">when</error>(v) {
fun nonExhaustiveNullableSealed(v: Variant?) = <error descr="[NO_ELSE_IN_WHEN] 'when' expression must be exhaustive, add necessary 'Another', 'null' branches or 'else' branch instead">when</error>(v) {
Variant.Singleton -> false
is Variant.Something -> true
}
sealed class Empty
fun nonExhaustiveEmpty(e: Empty) = <error descr="[NO_ELSE_IN_WHEN] when expression must be exhaustive, add necessary 'else' branch">when</error>(<warning>e</warning>) {}
fun nonExhaustiveEmpty(e: Empty) = <error descr="[NO_ELSE_IN_WHEN] 'when' expression must be exhaustive, add necessary 'else' branch">when</error>(<warning>e</warning>) {}
fun nonExhaustiveNullableEmpty(e: Empty?) = <error descr="[NO_ELSE_IN_WHEN] when expression must be exhaustive, add necessary 'else' branch">when</error>(<warning>e</warning>) {}
fun nonExhaustiveNullableEmpty(e: Empty?) = <error descr="[NO_ELSE_IN_WHEN] 'when' expression must be exhaustive, add necessary 'else' branch">when</error>(<warning>e</warning>) {}
+1 -1
View File
@@ -264,5 +264,5 @@ fun inForLoop(x: Any?) {
if (x is Array<*>) {
for (i in <info descr="Smart cast to kotlin.Array<*>">x</info>) {}
}
for (i in <error descr="[ITERATOR_MISSING] For-loop range must have an iterator() method">x</error>) {}
for (i in <error descr="[ITERATOR_MISSING] For-loop range must have an 'iterator()' method">x</error>) {}
}
@@ -1,4 +1,4 @@
// ERROR: Expression 'staticField' of type 'Int' cannot be invoked as a function. The function invoke() is not found
// ERROR: Expression 'staticField' of type 'Int' cannot be invoked as a function. The function 'invoke()' is not found
package to
import a.JavaF
@@ -2,7 +2,7 @@
// IS_APPLICABLE: false
// ERROR: Type mismatch: inferred type is Int but Boolean was expected
// ERROR: Condition must be of type Boolean, but is of type Int
// ERROR: Infix call corresponds to a dot-qualified call 'foo.times(10)' which is not allowed on a nullable receiver 'foo'. Use ?.-qualified call instead
// ERROR: Infix call corresponds to a dot-qualified call 'foo.times(10)' which is not allowed on a nullable receiver 'foo'. Use '?.'-qualified call instead
fun String?.times(a: Int): Boolean = a == 0
@@ -1,7 +1,7 @@
// IS_APPLICABLE: false
// ERROR: Type mismatch: inferred type is Int but Boolean was expected
// ERROR: Condition must be of type Boolean, but is of type Int
// ERROR: Infix call corresponds to a dot-qualified call 'foo.times(10)' which is not allowed on a nullable receiver 'foo'. Use ?.-qualified call instead
// ERROR: Infix call corresponds to a dot-qualified call 'foo.times(10)' which is not allowed on a nullable receiver 'foo'. Use '?.'-qualified call instead
fun main(args: Array<String>) {
val foo: Int? = 4
@@ -1,5 +1,5 @@
// IS_APPLICABLE: false
// ERROR: operator modifier is inapplicable on this function: must have a single value parameter
// ERROR: 'operator' modifier is inapplicable on this function: must have a single value parameter
fun test() {
class Test{
operator fun plus(a: Int=1, b: Int=2) : Int = 0
@@ -1,5 +1,5 @@
// IS_APPLICABLE: false
// ERROR: operator modifier is inapplicable on this function: must have a single value parameter
// ERROR: 'operator' modifier is inapplicable on this function: must have a single value parameter
fun test() {
class Test {
operator fun plus(a: Int, b: Int): Test = Test()
@@ -1,5 +1,5 @@
// IS_APPLICABLE: false
// ERROR: operator modifier is inapplicable on this function: must have a single value parameter
// ERROR: 'operator' modifier is inapplicable on this function: must have a single value parameter
fun test() {
class Test{
operator fun plus(vararg b: Int, c: Int = 0): Int = 0
@@ -1,5 +1,5 @@
// IS_APPLICABLE: false
// ERROR: operator modifier is inapplicable on this function: must have a single value parameter
// ERROR: 'operator' modifier is inapplicable on this function: must have a single value parameter
fun test() {
class Test{
operator fun plus(vararg b: Int, c: Int = 0): Int = 0
@@ -1,5 +1,5 @@
// IS_APPLICABLE: false
// ERROR: operator modifier is inapplicable on this function: must have no value parameters
// ERROR: 'operator' modifier is inapplicable on this function: must have no value parameters
fun test() {
class Test {
operator fun unaryPlus(fn: () -> Unit): Test = Test()
@@ -1,5 +1,5 @@
// IS_APPLICABLE: false
// ERROR: operator modifier is inapplicable on this function: must have no value parameters
// ERROR: 'operator' modifier is inapplicable on this function: must have no value parameters
fun test() {
class Test {
operator fun unaryPlus(a: Int): Test = Test()
@@ -1,5 +1,5 @@
// IS_APPLICABLE: false
// ERROR: operator modifier is inapplicable on this function: must have no value parameters
// ERROR: 'operator' modifier is inapplicable on this function: must have no value parameters
fun test() {
class Test {
operator fun unaryPlus(vararg a: Int): Test = Test()
@@ -1,5 +1,5 @@
// IS_APPLICABLE: false
// ERROR: operator modifier is inapplicable on this function: must have no value parameters
// ERROR: 'operator' modifier is inapplicable on this function: must have no value parameters
fun test() {
class Test {
operator fun unaryPlus(a: Int): Test = Test()
@@ -1,6 +1,6 @@
// IS_APPLICABLE: false
// ERROR: Cannot find a parameter with this name: c
// ERROR: operator modifier is inapplicable on this function: must have a single value parameter
// ERROR: 'operator' modifier is inapplicable on this function: must have a single value parameter
fun test() {
class Test{
operator fun contains(a: Int=1, b: Int=2): Boolean = true
@@ -1,6 +1,6 @@
// IS_APPLICABLE: false
// ERROR: No value passed for parameter b
// ERROR: operator modifier is inapplicable on this function: must have a single value parameter
// ERROR: 'operator' modifier is inapplicable on this function: must have a single value parameter
fun test() {
class Test{
operator fun contains(a: Int, b: Int): Boolean = true
@@ -1,5 +1,5 @@
// IS_APPLICABLE: false
// ERROR: operator modifier is inapplicable on this function: must have a single value parameter
// ERROR: 'operator' modifier is inapplicable on this function: must have a single value parameter
fun test() {
class Test{
operator fun contains(a: Int=1, b: Int=2) : Boolean = true
@@ -1,5 +1,5 @@
// IS_APPLICABLE: false
// ERROR: operator modifier is inapplicable on this function: must have a single value parameter
// ERROR: 'operator' modifier is inapplicable on this function: must have a single value parameter
fun test() {
class Test{
operator fun contains(a: Int, b: Int) : Boolean = true
@@ -1,5 +1,5 @@
// IS_APPLICABLE: false
// ERROR: operator modifier is inapplicable on this function: must have a single value parameter
// ERROR: 'operator' modifier is inapplicable on this function: must have a single value parameter
fun test() {
class Test{
operator fun contains(vararg b: Int, c: Int = 0): Boolean = true
@@ -1,5 +1,5 @@
// IS_APPLICABLE: false
// ERROR: operator modifier is inapplicable on this function: must have a single value parameter
// ERROR: 'operator' modifier is inapplicable on this function: must have a single value parameter
fun test() {
class Test{
operator fun contains(vararg b: Int, c: Int = 0): Boolean = true
@@ -1,5 +1,5 @@
// IS_APPLICABLE: false
// ERROR: operator modifier is inapplicable on this function: must have at least 1 value parameter
// ERROR: 'operator' modifier is inapplicable on this function: must have at least 1 value parameter
fun test() {
class Test{
operator fun get() : Int = 0
@@ -1,5 +1,5 @@
// IS_APPLICABLE: false
// ERROR: operator modifier is inapplicable on this function: must have at least 2 value parameters
// ERROR: 'operator' modifier is inapplicable on this function: must have at least 2 value parameters
class C {
operator fun set(){}
@@ -1,5 +1,5 @@
// IS_APPLICABLE: false
// ERROR: operator modifier is inapplicable on this function: last parameter should not have a default value or be a vararg
// ERROR: 'operator' modifier is inapplicable on this function: last parameter should not have a default value or be a vararg
class C {
operator fun set(s: String, vararg value: Int): Boolean = true
@@ -1,5 +1,5 @@
// IS_APPLICABLE: false
// ERROR: operator modifier is inapplicable on this function: must be a member or an extension
// ERROR: 'operator' modifier is inapplicable on this function: must be a member or an extension
package p
+1 -1
View File
@@ -1,6 +1,6 @@
// IS_APPLICABLE: false
// ERROR: 'if' must have both main and 'else' branches if used as an expression
// ERROR: Expression 'if "test" is String' of type 'Unit' cannot be invoked as a function. The function invoke() is not found
// ERROR: Expression 'if "test" is String' of type 'Unit' cannot be invoked as a function. The function 'invoke()' is not found
fun <T> doSomething(a: T) {}
@@ -1,6 +1,6 @@
// FILE: first.before.kt
// "Import" "true"
// ERROR: operator modifier is required on 'get' in 'some.Some'
// ERROR: 'operator' modifier is required on 'get' in 'some.Some'
package testing
@@ -27,7 +27,7 @@ operator fun Some.get(s: String) {}
// FILE: first.after.kt
// "Import" "true"
// ERROR: operator modifier is required on 'get' in 'some.Some'
// ERROR: 'operator' modifier is required on 'get' in 'some.Some'
package testing
@@ -1,6 +1,6 @@
// FILE: first.before.kt
// "Import" "true"
// ERROR: operator modifier is required on 'set' in 'some.Some'
// ERROR: 'operator' modifier is required on 'set' in 'some.Some'
package testing
@@ -27,7 +27,7 @@ operator fun Some.set(s: String, i: Int) {}
// FILE: first.after.kt
// "Import" "true"
// ERROR: operator modifier is required on 'set' in 'some.Some'
// ERROR: 'operator' modifier is required on 'set' in 'some.Some'
package testing
+3 -3
View File
@@ -1,6 +1,6 @@
// FILE: first.before.kt
// "Import" "true"
// ERROR: Expression 'Some()' of type 'Some' cannot be invoked as a function. The function invoke() is not found
// ERROR: Expression 'Some()' of type 'Some' cannot be invoked as a function. The function 'invoke()' is not found
package testing
@@ -14,7 +14,7 @@ fun testing() {
// FILE: second.kt
// "Import" "true"
// ERROR: Expression 'Some()' of type 'Some' cannot be invoked as a function. The function invoke() is not found
// ERROR: Expression 'Some()' of type 'Some' cannot be invoked as a function. The function 'invoke()' is not found
package some
@@ -26,7 +26,7 @@ operator fun Some.invoke(s: String) {}
// FILE: first.after.kt
// "Import" "true"
// ERROR: Expression 'Some()' of type 'Some' cannot be invoked as a function. The function invoke() is not found
// ERROR: Expression 'Some()' of type 'Some' cannot be invoked as a function. The function 'invoke()' is not found
package testing
@@ -1,6 +1,6 @@
// FILE: first.before.kt
// "Import" "false"
// ERROR: Expression 'Some()' of type 'Some' cannot be invoked as a function. The function invoke() is not found
// ERROR: Expression 'Some()' of type 'Some' cannot be invoked as a function. The function 'invoke()' is not found
// ACTION: Create extension function 'invoke'
// ACTION: Create member function 'invoke'
@@ -17,7 +17,7 @@ fun testing() {
// FILE: second.kt
// "Import" "true"
// ERROR: Expression 'Some()' of type 'Some' cannot be invoked as a function. The function invoke() is not found
// ERROR: Expression 'Some()' of type 'Some' cannot be invoked as a function. The function 'invoke()' is not found
package some
@@ -29,7 +29,7 @@ fun Some.invoke(s: String) {}
// FILE: first.after.kt
// "Import" "true"
// ERROR: Expression 'Some()' of type 'Some' cannot be invoked as a function. The function invoke() is not found
// ERROR: Expression 'Some()' of type 'Some' cannot be invoked as a function. The function 'invoke()' is not found
// ACTION: Create extension function 'invoke'
// ACTION: Create member function 'invoke'
@@ -1,6 +1,6 @@
// "Add non-null asserted (!!) call" "false"
// ACTION: Replace with a 'forEach' function call
// ERROR: Not nullable value required to call an iterator() method on for-loop range
// ERROR: Not nullable value required to call an 'iterator()' method on for-loop range
class Some {
fun iterator(): Iterator<Int> = null!!
@@ -1,5 +1,5 @@
// "Add 'operator' modifier" "true"
// ERROR: operator modifier is required on 'component2' in 'A'
// ERROR: 'operator' modifier is required on 'component2' in 'A'
class A {
fun component1(): Int = 0
@@ -1,5 +1,5 @@
// "Add 'operator' modifier" "true"
// ERROR: operator modifier is required on 'component2' in 'A'
// ERROR: 'operator' modifier is required on 'component2' in 'A'
class A {
operator fun component1(): Int = 0
@@ -1,5 +1,5 @@
// "Make <set-prop> internal" "true"
// ERROR: Cannot assign to 'prop': the setter is 'private' in file
// ERROR: Cannot assign to 'prop': the setter is private in file
package test
@@ -1,5 +1,5 @@
// "Make <set-prop> internal" "true"
// ERROR: Cannot assign to 'prop': the setter is 'private' in file
// ERROR: Cannot assign to 'prop': the setter is private in file
package test
@@ -1,5 +1,5 @@
// "Change to property access" "false"
// ERROR: Expression 'fd' of type 'String' cannot be invoked as a function. The function invoke() is not found
// ERROR: Expression 'fd' of type 'String' cannot be invoked as a function. The function 'invoke()' is not found
class A(val fd: String)
fun x() {
@@ -26,7 +26,7 @@ End of files
Exit code: ABORT
------------------------------------------
COMPILATION FAILED
when expression must be exhaustive, add necessary 'C' branch or 'else' branch instead
'when' expression must be exhaustive, add necessary 'C' branch or 'else' branch instead
================ Step #2 =================
@@ -22,7 +22,7 @@ End of files
Exit code: ABORT
------------------------------------------
COMPILATION FAILED
when expression must be exhaustive, add necessary 'is C' branch or 'else' branch instead
'when' expression must be exhaustive, add necessary 'is C' branch or 'else' branch instead
================ Step #2 =================
@@ -27,8 +27,8 @@ private val DIAGNOSTIC_FACTORY_TO_RENDERER by lazy {
"Annotation ''{0}'' is allowed only on member functions of declaration annotated as ''kotlin.js.native'' or on toplevel extension functions", Renderers.RENDER_TYPE)
put(ErrorsJs.NATIVE_INDEXER_KEY_SHOULD_BE_STRING_OR_NUMBER, "Native {0}''s first parameter type should be ''kotlin.String'' or subtype of ''kotlin.Number''", Renderers.STRING)
put(ErrorsJs.NATIVE_INDEXER_CAN_NOT_HAVE_DEFAULT_ARGUMENTS, "Native {0}''s parameter can not have default value", Renderers.STRING)
put(ErrorsJs.NATIVE_GETTER_RETURN_TYPE_SHOULD_BE_NULLABLE, "Native getter''s return type should be nullable")
put(ErrorsJs.NATIVE_SETTER_WRONG_RETURN_TYPE, "Native setter''s return type should be ''Unit'' or a supertype of the second parameter''s type")
put(ErrorsJs.NATIVE_GETTER_RETURN_TYPE_SHOULD_BE_NULLABLE, "Native getter's return type should be nullable")
put(ErrorsJs.NATIVE_SETTER_WRONG_RETURN_TYPE, "Native setter's return type should be 'Unit' or a supertype of the second parameter's type")
put(ErrorsJs.NATIVE_INDEXER_WRONG_PARAMETER_COUNT, "Expected {0} parameters for native {1}", Renderers.TO_STRING, Renderers.STRING)
put(ErrorsJs.JSCODE_ERROR, "JavaScript: {0}", JsCallDataTextRenderer)
put(ErrorsJs.JSCODE_WARNING, "JavaScript: {0}", JsCallDataTextRenderer)