Update testdata according to change compiler version to 1.4

This commit is contained in:
Dmitriy Novozhilov
2020-01-15 22:13:52 +03:00
parent 5bfb92661e
commit 76b3964e96
39 changed files with 109 additions and 244 deletions
+17 -17
View File
@@ -1,56 +1,56 @@
fun Int?.optint() : Unit {}
val Int?.optval : Unit get() = Unit
fun <T: Any, E> T.foo(<warning>x</warning> : E, y : A) : T {
fun <T: Any, E> T.foo(<warning descr="[UNUSED_PARAMETER] Parameter 'x' is never used">x</warning> : E, y : A) : T {
y.plus(1)
y plus 1
y + 1.0
this<warning>?.</warning>minus<T>(this)
this<warning descr="[UNNECESSARY_SAFE_CALL] Unnecessary safe call on a non-null receiver of type T">?.</warning>minus<T>(this)
return this
}
class A
infix operator fun A.plus(<warning>a</warning> : Any) {
infix operator fun A.plus(<warning descr="[UNUSED_PARAMETER] Parameter 'a' is never used">a</warning> : Any) {
1.foo()
true.<error>foo</error>(<error><error>)</error></error>
true.<error descr="[NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER] Not enough information to infer type variable E">foo</error>(<error descr="[NO_VALUE_FOR_PARAMETER] No value passed for parameter 'x'"><error descr="[NO_VALUE_FOR_PARAMETER] No value passed for parameter 'y'">)</error></error>
<warning>1</warning>
<warning descr="[UNUSED_EXPRESSION] The expression is unused">1</warning>
}
infix operator fun A.plus(<warning>a</warning> : Int) {
<warning>1</warning>
infix operator fun A.plus(<warning descr="[UNUSED_PARAMETER] Parameter 'a' is never used">a</warning> : Int) {
<warning descr="[UNUSED_EXPRESSION] The expression is unused">1</warning>
}
fun <T> T.minus(<warning>t</warning> : T) : Int = 1
fun <T> T.minus(<warning descr="[UNUSED_PARAMETER] Parameter 't' is never used">t</warning> : T) : Int = 1
fun test() {
val <warning>y</warning> = 1.abs
val <warning descr="[UNUSED_VARIABLE] Variable 'y' is never used">y</warning> = 1.abs
}
val Int.abs : Int
get() = if (this > 0) this else -this;
<error>val <T> T.foo : T</error>
<error descr="[EXTENSION_PROPERTY_MUST_HAVE_ACCESSORS_OR_BE_ABSTRACT] Extension property must have accessors or be abstract">val <T> T.foo : T</error>
fun Int.foo() = this
// FILE: b.kt
//package null_safety
fun parse(<warning>cmd</warning>: String): Command? { return null }
fun parse(<warning descr="[UNUSED_PARAMETER] Parameter 'cmd' is never used">cmd</warning>: String): Command? { return null }
class Command() {
// fun equals(other : Any?) : Boolean
val foo : Int = 0
}
<error>operator</error> fun Any.<warning>equals</warning>(<warning>other</warning> : Any?) : Boolean = true
fun Any?.equals1(<warning>other</warning> : Any?) : Boolean = true
fun Any.equals2(<warning>other</warning> : Any?) : Boolean = true
<error descr="[INAPPLICABLE_OPERATOR_MODIFIER] 'operator' modifier is inapplicable on this function: must be a member function">operator</error> fun Any.<warning descr="[EXTENSION_SHADOWED_BY_MEMBER] Extension is shadowed by a member: public open operator fun equals(other: Any?): Boolean">equals</warning>(<warning descr="[UNUSED_PARAMETER] Parameter 'other' is never used">other</warning> : Any?) : Boolean = true
fun Any?.equals1(<warning descr="[UNUSED_PARAMETER] Parameter 'other' is never used">other</warning> : Any?) : Boolean = true
fun Any.equals2(<warning descr="[UNUSED_PARAMETER] Parameter 'other' is never used">other</warning> : Any?) : Boolean = true
fun main(args: Array<String>) {
fun main(<warning descr="[UNUSED_PARAMETER] Parameter 'args' is never used">args</warning>: Array<String>) {
System.out.print(1)
@@ -64,7 +64,7 @@ fun Int.foo() = this
command?.equals1(null)
val c = Command()
c<warning>?.</warning>equals2(null)
c<warning descr="[UNNECESSARY_SAFE_CALL] Unnecessary safe call on a non-null receiver of type Command">?.</warning>equals2(null)
if (command == null) <warning>1</warning>
if (command == null) <warning descr="[UNUSED_EXPRESSION] The expression is unused">1</warning>
}
@@ -6,8 +6,8 @@ fun test(r: Runnable) {
ForceSam.compare(r, r)
ForceSam.compare({}, {})
ForceSam.compare(r, <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is () -> Unit but Runnable was expected">{}</error>)
ForceSam.compare(<error descr="[TYPE_MISMATCH] Type mismatch: inferred type is () -> Unit but Runnable was expected">{}</error>, r)
ForceSam.compare(r, {})
ForceSam.compare({}, r)
}
// Check that new inference is enabled
+1 -1
View File
@@ -4,7 +4,7 @@ package test2
<info descr="null">enum</info> class En { A, B, С }
fun main(args: Array<String>) {
fun main(<warning descr="[UNUSED_PARAMETER] Parameter 'args' is never used">args</warning>: Array<String>) {
val en2: Any? = En.A
if (en2 is En) {
when (<info descr="Smart cast to test2.En">en2</info>) {
+1 -1
View File
@@ -1,3 +1,3 @@
fun main(args: Array<String>) {
fun main(<warning descr="[UNUSED_PARAMETER] Parameter 'args' is never used">args</warning>: Array<String>) {
println("Hello World")
}
+1 -1
View File
@@ -1,6 +1,6 @@
// FIR_COMPARISON
fun main(args: Array<String>) {
fun main(<warning descr="[UNUSED_PARAMETER] Parameter 'args' is never used">args</warning>: Array<String>) {
String.class<EOLError descr="Name expected"></EOLError>
}
+3 -3
View File
@@ -11,7 +11,7 @@ fun takeFirst(expr: StringBuilder): Char {
fun evaluateArg(expr: CharSequence, numbers: ArrayList<Int>): Int {
if (expr.length == 0) throw Exception("Syntax error: Character expected");
val c = takeFirst(<error>expr</error>)
val c = takeFirst(<error descr="[TYPE_MISMATCH] Type mismatch: inferred type is CharSequence but kotlin.text.StringBuilder /* = java.lang.StringBuilder */ was expected">expr</error>)
if (c >= '0' && c <= '9') {
val n = c - '0'
if (!numbers.contains(n)) throw Exception("You used incorrect number: " + n)
@@ -32,13 +32,13 @@ fun evaluateAdd(expr: StringBuilder, numbers: ArrayList<Int>): Int {
fun evaluate(expr: StringBuilder, numbers: ArrayList<Int>): Int {
val lhs = evaluateAdd(expr, numbers)
if (expr.length > 0) {
val <warning>c</warning> = expr.get(0)
val <warning descr="[UNUSED_VARIABLE] Variable 'c' is never used">c</warning> = expr.get(0)
expr.deleteCharAt(0)
}
return lhs
}
fun main(args: Array<String>) {
fun main(<warning descr="[UNUSED_PARAMETER] Parameter 'args' is never used">args</warning>: Array<String>) {
System.out.println("24 game")
val numbers = ArrayList<Int>(4)
val rnd = Random();
+4 -4
View File
@@ -2,11 +2,11 @@
class Command() {}
fun parse(<warning>cmd</warning>: String): Command? { return null }
fun parse(<warning descr="[UNUSED_PARAMETER] Parameter 'cmd' is never used">cmd</warning>: String): Command? { return null }
fun Any.<warning>equals</warning>(other : Any?) : Boolean = this === other
fun Any.<warning descr="[EXTENSION_SHADOWED_BY_MEMBER] Extension is shadowed by a member: public open operator fun equals(other: Any?): Boolean">equals</warning>(other : Any?) : Boolean = this === other
fun main(args: Array<String>) {
fun main(<warning descr="[UNUSED_PARAMETER] Parameter 'args' is never used">args</warning>: Array<String>) {
val command = parse("")
if (command == null) <warning>1</warning> // error on this line, but must be OK
if (command == null) <warning descr="[UNUSED_EXPRESSION] The expression is unused">1</warning> // error on this line, but must be OK
}
+3 -3
View File
@@ -1,11 +1,11 @@
// FIR_COMPARISON
fun Any.<warning>equals</warning>(<warning>other</warning> : Any?) : Boolean = true
fun Any.<warning descr="[EXTENSION_SHADOWED_BY_MEMBER] Extension is shadowed by a member: public open operator fun equals(other: Any?): Boolean">equals</warning>(<warning descr="[UNUSED_PARAMETER] Parameter 'other' is never used">other</warning> : Any?) : Boolean = true
fun main(args: Array<String>) {
fun main(<warning descr="[UNUSED_PARAMETER] Parameter 'args' is never used">args</warning>: Array<String>) {
val command : Any = 1
command<warning>?.</warning>equals(null)
command<warning descr="[UNNECESSARY_SAFE_CALL] Unnecessary safe call on a non-null receiver of type Any">?.</warning>equals(null)
command.equals(null)
}
+1 -1
View File
@@ -1,5 +1,5 @@
// !DIAGNOSTICS_NUMBER: 2
// !DIAGNOSTICS: INCOMPATIBLE_ENUM_COMPARISON
// !DIAGNOSTICS: INCOMPATIBLE_ENUM_COMPARISON_ERROR
// !MESSAGE_TYPE: TEXT
enum class E1 {
@@ -1,5 +1,5 @@
// "Surround with *arrayOf(...)" "true"
// COMPILER_ARGUMENTS: -XXLanguage:+ProhibitAssigningSingleElementsToVarargsInNamedForm
// COMPILER_ARGUMENTS: -XXLanguage:+ProhibitAssigningSingleElementsToVarargsInNamedForm -XXLanguage:-AllowAssigningArrayElementsToVarargsInNamedFormForFunctions
// DISABLE-ERRORS
fun anyFoo(vararg a: Any) {}
@@ -1,5 +1,5 @@
// "Surround with *arrayOf(...)" "true"
// COMPILER_ARGUMENTS: -XXLanguage:+ProhibitAssigningSingleElementsToVarargsInNamedForm
// COMPILER_ARGUMENTS: -XXLanguage:+ProhibitAssigningSingleElementsToVarargsInNamedForm -XXLanguage:-AllowAssigningArrayElementsToVarargsInNamedFormForFunctions
// DISABLE-ERRORS
fun anyFoo(vararg a: Any) {}