Wrap diagnostic parameters to double quotes and split by comma instead of semicolon

This commit is contained in:
victor.petukhov
2018-12-28 14:51:55 +03:00
parent 46bd5ba107
commit 30762a450a
55 changed files with 242 additions and 254 deletions
@@ -6,6 +6,6 @@ public @interface A {
}
// FILE: b.kt
@A(*<!NI;TYPE_MISMATCH, OI;TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>arrayOf(<!NI;CONSTANT_EXPECTED_TYPE_MISMATCH, NI;CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>, "b")<!>)
@A(*<!TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH("Array<out String>", "IGNORE")!>arrayOf(1, "b")<!>)
fun test() {
}
@@ -2,6 +2,6 @@
annotation class B(vararg val args: String)
@B(*<!NI;TYPE_MISMATCH, OI;TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH!>arrayOf(<!NI;CONSTANT_EXPECTED_TYPE_MISMATCH, NI;CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>, "b")<!>)
@B(*<!TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH("Array<out String>", "IGNORE")!>arrayOf(1, "b")<!>)
fun test() {
}
@@ -7,7 +7,7 @@ import kotlin.contracts.*
fun foo(b: Boolean): Boolean {
contract {
// pointless, can be reduced to just "b"
returns(true) implies (<!ERROR_IN_CONTRACT_DESCRIPTION(only equality comparisons with 'null' allowed)!>b == true<!>)
returns(true) implies (<!ERROR_IN_CONTRACT_DESCRIPTION("only equality comparisons with 'null' allowed")!>b == true<!>)
}
return b
@@ -16,7 +16,7 @@ fun foo(b: Boolean): Boolean {
fun bar(b: Boolean?): Boolean {
contract {
// not pointless, but not supported yet
returns(true) implies (<!ERROR_IN_CONTRACT_DESCRIPTION(only equality comparisons with 'null' allowed)!>b == true<!>)
returns(true) implies (<!ERROR_IN_CONTRACT_DESCRIPTION("only equality comparisons with 'null' allowed")!>b == true<!>)
}
if (b == null) throw java.lang.IllegalArgumentException("")
return <!DEBUG_INFO_SMARTCAST!>b<!>
@@ -8,7 +8,7 @@ fun bar(x: Int): Boolean = x == 0
fun foo(x: Int): Boolean {
contract {
returns(true) implies (<!ERROR_IN_CONTRACT_DESCRIPTION(call-expressions are not supported yet)!>bar(x)<!>)
returns(true) implies (<!ERROR_IN_CONTRACT_DESCRIPTION("call-expressions are not supported yet")!>bar(x)<!>)
}
return x == 0
}
@@ -5,5 +5,5 @@
import kotlin.contracts.*
fun emptyContract() {
<!ERROR_IN_CONTRACT_DESCRIPTION(Error in contract description)!>contract<!> { }
<!ERROR_IN_CONTRACT_DESCRIPTION("Error in contract description")!>contract<!> { }
}
@@ -6,7 +6,7 @@ import kotlin.contracts.*
fun ifInContract(x: Any?, boolean: Boolean) {
contract {
<!ERROR_IN_CONTRACT_DESCRIPTION(unexpected construction in contract description)!>if (boolean) {
<!ERROR_IN_CONTRACT_DESCRIPTION("unexpected construction in contract description")!>if (boolean) {
returns() implies (x is String)
} else {
returns() implies (x is Int)
@@ -16,7 +16,7 @@ fun ifInContract(x: Any?, boolean: Boolean) {
fun whenInContract(x: Any?, boolean: Boolean) {
contract {
<!ERROR_IN_CONTRACT_DESCRIPTION(unexpected construction in contract description)!>when (boolean) {
<!ERROR_IN_CONTRACT_DESCRIPTION("unexpected construction in contract description")!>when (boolean) {
true -> returns() implies (x is String)
else -> returns() implies (x is Int)
}<!>
@@ -25,7 +25,7 @@ fun whenInContract(x: Any?, boolean: Boolean) {
fun forInContract(x: Any?) {
contract {
<!ERROR_IN_CONTRACT_DESCRIPTION(unexpected construction in contract description)!>for (i in 0..1) {
<!ERROR_IN_CONTRACT_DESCRIPTION("unexpected construction in contract description")!>for (i in 0..1) {
returns() implies (x is String)
}<!>
}
@@ -33,7 +33,7 @@ fun forInContract(x: Any?) {
fun whileInContract(x: Any?) {
contract {
<!ERROR_IN_CONTRACT_DESCRIPTION(unexpected construction in contract description)!>while (false) {
<!ERROR_IN_CONTRACT_DESCRIPTION("unexpected construction in contract description")!>while (false) {
returns() implies (x is String)
}<!>
}
@@ -41,7 +41,7 @@ fun whileInContract(x: Any?) {
fun doWhileInContract(x: Any?) {
contract {
<!ERROR_IN_CONTRACT_DESCRIPTION(unexpected construction in contract description)!>do {
<!ERROR_IN_CONTRACT_DESCRIPTION("unexpected construction in contract description")!>do {
returns() implies (x is String)
} while (false)<!>
}
@@ -49,7 +49,7 @@ fun doWhileInContract(x: Any?) {
fun localValInContract(x: Any?) {
contract {
<!ERROR_IN_CONTRACT_DESCRIPTION(unexpected construction in contract description)!>val y: Int = 42<!>
<!ERROR_IN_CONTRACT_DESCRIPTION("unexpected construction in contract description")!>val y: Int = 42<!>
returns() implies (x is String)
}
}
@@ -6,25 +6,25 @@ import kotlin.contracts.*
fun equalsWithVariables(x: Any?, y: Any?) {
contract {
returns() implies (<!ERROR_IN_CONTRACT_DESCRIPTION(only equality comparisons with 'null' allowed)!>x == y<!>)
returns() implies (<!ERROR_IN_CONTRACT_DESCRIPTION("only equality comparisons with 'null' allowed")!>x == y<!>)
}
}
fun identityEqualsWithVariables(x: Any?, y: Any?) {
contract {
returns() implies (<!ERROR_IN_CONTRACT_DESCRIPTION(only equality comparisons with 'null' allowed)!>x === y<!>)
returns() implies (<!ERROR_IN_CONTRACT_DESCRIPTION("only equality comparisons with 'null' allowed")!>x === y<!>)
}
}
fun equalConstants() {
contract {
returns() implies (<!SENSELESS_COMPARISON, ERROR_IN_CONTRACT_DESCRIPTION(only equality comparisons with 'null' allowed)!>null == null<!>)
returns() implies (<!ERROR_IN_CONTRACT_DESCRIPTION("only equality comparisons with 'null' allowed"), SENSELESS_COMPARISON!>null == null<!>)
}
}
fun get(): Int? = null
fun equalNullWithCall() {
contract {
returns() implies (<!ERROR_IN_CONTRACT_DESCRIPTION(only references to parameters are allowed in contract description)!>get()<!> == null)
returns() implies (<!ERROR_IN_CONTRACT_DESCRIPTION("only references to parameters are allowed in contract description")!>get()<!> == null)
}
}
@@ -5,7 +5,7 @@
import kotlin.contracts.*
fun foo(boolean: Boolean) {
<!ERROR_IN_CONTRACT_DESCRIPTION(Error in contract description)!>contract<!> {
<!ERROR_IN_CONTRACT_DESCRIPTION("Error in contract description")!>contract<!> {
(returns() implies (boolean)) <!UNRESOLVED_REFERENCE!>implies<!> (!boolean)
}
}
@@ -5,11 +5,11 @@
import kotlin.contracts.*
fun passLambdaValue(l: ContractBuilder.() -> Unit) {
contract(<!ERROR_IN_CONTRACT_DESCRIPTION(first argument of 'contract'-call should be a lambda expression)!>l<!>)
contract(<!ERROR_IN_CONTRACT_DESCRIPTION("first argument of 'contract'-call should be a lambda expression")!>l<!>)
}
fun passAnonymousFunction(x: Boolean) {
contract(<!ERROR_IN_CONTRACT_DESCRIPTION(first argument of 'contract'-call should be a lambda expression)!>fun ContractBuilder.() {
contract(<!ERROR_IN_CONTRACT_DESCRIPTION("first argument of 'contract'-call should be a lambda expression")!>fun ContractBuilder.() {
returns() implies x
}<!>)
}
@@ -6,7 +6,7 @@ import kotlin.contracts.*
fun foo(y: Boolean) {
val <!UNUSED_VARIABLE!>x<!>: Int = 42
<!CONTRACT_NOT_ALLOWED(Contract should be the first statement)!>contract<!> {
<!CONTRACT_NOT_ALLOWED("Contract should be the first statement")!>contract<!> {
returns() implies y
}
}
@@ -6,20 +6,20 @@ import kotlin.contracts.*
inline fun <reified T> referToReifiedGeneric(x: Any?) {
contract {
returns() implies (x is <!ERROR_IN_CONTRACT_DESCRIPTION(references to type parameters are forbidden in contracts)!>T<!>)
returns() implies (x is <!ERROR_IN_CONTRACT_DESCRIPTION("references to type parameters are forbidden in contracts")!>T<!>)
}
}
class Generic<T> {
fun referToCaptured(x: Any?) {
<!CONTRACT_NOT_ALLOWED(Contracts are allowed only for top-level functions)!>contract<!> {
<!CONTRACT_NOT_ALLOWED("Contracts are allowed only for top-level functions")!>contract<!> {
returns() implies (x is <!CANNOT_CHECK_FOR_ERASED!>T<!>)
}
}
}
fun referToSubstituted(x: Any?) {
<!ERROR_IN_CONTRACT_DESCRIPTION(Error in contract description)!>contract<!> {
<!ERROR_IN_CONTRACT_DESCRIPTION("Error in contract description")!>contract<!> {
returns() implies (x is <!CANNOT_CHECK_FOR_ERASED!>Generic<String><!>)
}
}
@@ -35,13 +35,13 @@ typealias FunctionalType = () -> Unit
typealias SimpleType = Int
fun referToAliasedGeneric(x: Any?) {
<!ERROR_IN_CONTRACT_DESCRIPTION(Error in contract description)!>contract<!> {
<!ERROR_IN_CONTRACT_DESCRIPTION("Error in contract description")!>contract<!> {
returns() implies (x is <!CANNOT_CHECK_FOR_ERASED!>GenericString<!>)
}
}
fun referToAliasedFunctionType(x: Any?) {
<!ERROR_IN_CONTRACT_DESCRIPTION(Error in contract description)!>contract<!> {
<!ERROR_IN_CONTRACT_DESCRIPTION("Error in contract description")!>contract<!> {
returns() implies (x is <!CANNOT_CHECK_FOR_ERASED!>FunctionalType<!>)
}
}
@@ -6,7 +6,7 @@ import kotlin.contracts.*
fun Any?.foo(): Boolean {
contract {
returns(true) implies (<!SENSELESS_COMPARISON!><!ERROR_IN_CONTRACT_DESCRIPTION(only references to parameters are allowed. Did you miss label on <this>?)!>this<!> != null<!>)
returns(true) implies (<!SENSELESS_COMPARISON!><!ERROR_IN_CONTRACT_DESCRIPTION("only references to parameters are allowed. Did you miss label on <this>?")!>this<!> != null<!>)
}
return this != null
}
@@ -9,8 +9,8 @@ public class A {
// FILE: main.kt
class <!UNSUPPORTED(Inheritance of a Java member referencing 'kotlin.jvm.functions.FunctionN': fun foo\(w: FunctionN<*>!\): Unit defined in A)!>B<!> : A()
class <!UNSUPPORTED("Inheritance of a Java member referencing 'kotlin.jvm.functions.FunctionN': fun foo(w: FunctionN<*>!): Unit defined in A")!>B<!> : A()
fun foo() {
<!UNSUPPORTED(Inheritance of a Java member referencing 'kotlin.jvm.functions.FunctionN': fun foo\(w: FunctionN<*>!\): Unit defined in A)!>object<!> : A() {}
<!UNSUPPORTED("Inheritance of a Java member referencing 'kotlin.jvm.functions.FunctionN': fun foo(w: FunctionN<*>!): Unit defined in A")!>object<!> : A() {}
}