[IDE-NI-MIGRATE] [BAD] Migrate testdata of LocalInspection tests

This commit is contained in:
Dmitriy Novozhilov
2019-04-22 18:49:50 +03:00
committed by Mikhail Zarechenskiy
parent 17df843bf1
commit 05aa36a858
20 changed files with 186 additions and 0 deletions
@@ -1,3 +1,4 @@
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
// PROBLEM: none
// ERROR: Type mismatch: inferred type is Long? but Long was expected
fun test(b: Boolean, x: Long, y: Long?) {
@@ -0,0 +1,12 @@
// COMPILER_ARGUMENTS: -XXLanguage:+NewInference
// PROBLEM: Assignment should be lifted out of 'if'
// ERROR: None of the following functions can be called with the arguments supplied: <br>public final operator fun plus(other: Byte): Long defined in kotlin.Long<br>public final operator fun plus(other: Double): Double defined in kotlin.Long<br>public final operator fun plus(other: Float): Float defined in kotlin.Long<br>public final operator fun plus(other: Int): Long defined in kotlin.Long<br>public final operator fun plus(other: Long): Long defined in kotlin.Long<br>public final operator fun plus(other: Short): Long defined in kotlin.Long
fun test(b: Boolean, x: Long, y: Long?) {
var num: Long = 0L
<caret>if (b) {
num += x
} else {
num += y
}
}
@@ -0,0 +1,12 @@
// COMPILER_ARGUMENTS: -XXLanguage:+NewInference
// PROBLEM: Assignment should be lifted out of 'if'
// ERROR: None of the following functions can be called with the arguments supplied: <br>public final operator fun plus(other: Byte): Long defined in kotlin.Long<br>public final operator fun plus(other: Double): Double defined in kotlin.Long<br>public final operator fun plus(other: Float): Float defined in kotlin.Long<br>public final operator fun plus(other: Int): Long defined in kotlin.Long<br>public final operator fun plus(other: Long): Long defined in kotlin.Long<br>public final operator fun plus(other: Short): Long defined in kotlin.Long
fun test(b: Boolean, x: Long, y: Long?) {
var num: Long = 0L
num += if (b) {
x
} else {
y
}
}
@@ -1,3 +1,4 @@
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
// PROBLEM: none
// ERROR: Type mismatch: inferred type is List<Any> but MutableList<Int> was expected
// ERROR: Val cannot be reassigned
@@ -0,0 +1,14 @@
// COMPILER_ARGUMENTS: -XXLanguage:+NewInference
// PROBLEM: none
// ERROR: Type mismatch: inferred type is List<{Comparable<{Int & Long}> & Number}> but MutableList<Int> was expected
// ERROR: Val cannot be reassigned
// WITH_RUNTIME
fun test(b: Boolean) {
val list = mutableListOf<Int>()
<caret>if (b) {
list += mutableListOf(1)
} else {
list += mutableListOf(2L)
}
}
@@ -1,3 +1,4 @@
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
// PROBLEM: none
// WITH_RUNTIME
@@ -1,3 +1,4 @@
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
// PROBLEM: none
// WITH_RUNTIME
@@ -0,0 +1,14 @@
// COMPILER_ARGUMENTS: -XXLanguage:+NewInference
// PROBLEM: Redundant lambda arrow
// WITH_RUNTIME
fun main() {
registerHandler(handlers = *arrayOf(
{ _ -> },
{ it<caret> -> }
))
}
fun registerHandler(vararg handlers: (String) -> Unit) {
handlers.forEach { it.invoke("hello") }
}
@@ -0,0 +1,14 @@
// COMPILER_ARGUMENTS: -XXLanguage:+NewInference
// PROBLEM: Redundant lambda arrow
// WITH_RUNTIME
fun main() {
registerHandler(handlers = *arrayOf(
{ _ -> },
{ }
))
}
fun registerHandler(vararg handlers: (String) -> Unit) {
handlers.forEach { it.invoke("hello") }
}
@@ -0,0 +1,14 @@
// COMPILER_ARGUMENTS: -XXLanguage:+NewInference
// PROBLEM: Redundant lambda arrow
// WITH_RUNTIME
fun main() {
registerHandler(handlers = *arrayOf(
{ _<caret> -> },
{ it -> }
))
}
fun registerHandler(vararg handlers: (String) -> Unit) {
handlers.forEach { it.invoke("hello") }
}
@@ -0,0 +1,14 @@
// COMPILER_ARGUMENTS: -XXLanguage:+NewInference
// PROBLEM: Redundant lambda arrow
// WITH_RUNTIME
fun main() {
registerHandler(handlers = *arrayOf(
{ },
{ it -> }
))
}
fun registerHandler(vararg handlers: (String) -> Unit) {
handlers.forEach { it.invoke("hello") }
}
@@ -1,3 +1,4 @@
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
// PROBLEM: none
class Foo<T>(val t: T)
@@ -0,0 +1,9 @@
// COMPILER_ARGUMENTS: -XXLanguage:+NewInference
// PROBLEM: Redundant lambda arrow
class Foo<T>(val t: T)
fun bar(foo: Foo<(Boolean) -> String>) {}
fun test() {
bar(Foo({ <caret>_ -> "" }))
}
@@ -0,0 +1,9 @@
// COMPILER_ARGUMENTS: -XXLanguage:+NewInference
// PROBLEM: Redundant lambda arrow
class Foo<T>(val t: T)
fun bar(foo: Foo<(Boolean) -> String>) {}
fun test() {
bar(Foo({ "" }))
}
@@ -1,3 +1,4 @@
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
// PROBLEM: none
// WITH_RUNTIME
@@ -0,0 +1,11 @@
// COMPILER_ARGUMENTS: -XXLanguage:+NewInference
// PROBLEM: Redundant lambda arrow
// WITH_RUNTIME
fun f(cbs: List<(Boolean) -> Unit>) {
cbs[0](true)
}
fun main() {
f(listOf({ <caret>_ -> println("hello") }))
}
@@ -0,0 +1,11 @@
// COMPILER_ARGUMENTS: -XXLanguage:+NewInference
// PROBLEM: Redundant lambda arrow
// WITH_RUNTIME
fun f(cbs: List<(Boolean) -> Unit>) {
cbs[0](true)
}
fun main() {
f(listOf({ println("hello") }))
}
@@ -1,6 +1,8 @@
// PROBLEM: none
// WITH_RUNTIME
// ERROR: Type mismatch: inferred type is List<Any> but List<String> was expected
// COMPILER_ARGUMENTS: -XXLanguage:-NewInference
fun test() {
var list = listOf("")
list <caret>+= 1
@@ -0,0 +1,9 @@
// PROBLEM: none
// WITH_RUNTIME
// ERROR: Type mismatch: inferred type is List<{Comparable<{Int & String}> & java.io.Serializable}> but List<String> was expected
// COMPILER_ARGUMENTS: -XXLanguage:+NewInference
fun test() {
var list = listOf("")
list <caret>+= 1
}