[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
}
@@ -3575,6 +3575,11 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest {
runTest("idea/testData/inspectionsLocal/liftOut/ifToAssignment/typeMismatch2.kt");
}
@TestMetadata("typeMismatch2_ni.kt")
public void testTypeMismatch2_ni() throws Exception {
runTest("idea/testData/inspectionsLocal/liftOut/ifToAssignment/typeMismatch2_ni.kt");
}
@TestMetadata("typeMismatch3.kt")
public void testTypeMismatch3() throws Exception {
runTest("idea/testData/inspectionsLocal/liftOut/ifToAssignment/typeMismatch3.kt");
@@ -3589,6 +3594,11 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest {
public void testTypeMismatchMutableList2() throws Exception {
runTest("idea/testData/inspectionsLocal/liftOut/ifToAssignment/typeMismatchMutableList2.kt");
}
@TestMetadata("typeMismatchMutableList2_ni.kt")
public void testTypeMismatchMutableList2_ni() throws Exception {
runTest("idea/testData/inspectionsLocal/liftOut/ifToAssignment/typeMismatchMutableList2_ni.kt");
}
}
@TestMetadata("idea/testData/inspectionsLocal/liftOut/ifToReturn")
@@ -5418,6 +5428,16 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest {
runTest("idea/testData/inspectionsLocal/redundantLambdaArrow/notApplicableVararg2.kt");
}
@TestMetadata("notApplicableVararg2_ni.kt")
public void testNotApplicableVararg2_ni() throws Exception {
runTest("idea/testData/inspectionsLocal/redundantLambdaArrow/notApplicableVararg2_ni.kt");
}
@TestMetadata("notApplicableVararg_ni.kt")
public void testNotApplicableVararg_ni() throws Exception {
runTest("idea/testData/inspectionsLocal/redundantLambdaArrow/notApplicableVararg_ni.kt");
}
@TestMetadata("overload4.kt")
public void testOverload4() throws Exception {
runTest("idea/testData/inspectionsLocal/redundantLambdaArrow/overload4.kt");
@@ -5438,11 +5458,21 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest {
runTest("idea/testData/inspectionsLocal/redundantLambdaArrow/typeParameter2.kt");
}
@TestMetadata("typeParameter2_ni.kt")
public void testTypeParameter2_ni() throws Exception {
runTest("idea/testData/inspectionsLocal/redundantLambdaArrow/typeParameter2_ni.kt");
}
@TestMetadata("typeParameter3.kt")
public void testTypeParameter3() throws Exception {
runTest("idea/testData/inspectionsLocal/redundantLambdaArrow/typeParameter3.kt");
}
@TestMetadata("typeParameter3_ni.kt")
public void testTypeParameter3_ni() throws Exception {
runTest("idea/testData/inspectionsLocal/redundantLambdaArrow/typeParameter3_ni.kt");
}
@TestMetadata("underscore.kt")
public void testUnderscore() throws Exception {
runTest("idea/testData/inspectionsLocal/redundantLambdaArrow/underscore.kt");
@@ -8934,6 +8964,11 @@ public class LocalInspectionTestGenerated extends AbstractLocalInspectionTest {
runTest("idea/testData/inspectionsLocal/suspiciousCollectionReassignment/hasError.kt");
}
@TestMetadata("hasError_ni.kt")
public void testHasError_ni() throws Exception {
runTest("idea/testData/inspectionsLocal/suspiciousCollectionReassignment/hasError_ni.kt");
}
@TestMetadata("int.kt")
public void testInt() throws Exception {
runTest("idea/testData/inspectionsLocal/suspiciousCollectionReassignment/int.kt");