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:
+6
-6
@@ -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> {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+3
-3
@@ -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
@@ -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
@@ -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>) {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user