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
@@ -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) {}