Add tests for enhanced java signatures based on AbstractResolvedCallsTest.
Refactor AbstractResolvedCallsTest to support multiple carets (multiple methods being tested for resolve) in testdata file.
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
fun valuesNotNull(map: MutableMap<Int, String>) {
|
||||
map.<caret>compute(1) { k, v -> null }
|
||||
}
|
||||
|
||||
fun valuesNullable(map: MutableMap<Int, String?>) {
|
||||
map.<caret>compute(1) { k, v -> v?.let { it + k } }
|
||||
}
|
||||
|
||||
fun <T> valuesT(map: MutableMap<Int, T>, newValue: T) {
|
||||
map.<caret>compute(1) { k, v -> null }
|
||||
}
|
||||
|
||||
fun <T : Any> valuesTNotNull(map: MutableMap<Int, T>, newValue: T) {
|
||||
map.<caret>compute(1) { k, v -> null }
|
||||
}
|
||||
|
||||
fun <T : Any> valuesTNullable(map: MutableMap<Int, T?>, newValue: T?) {
|
||||
map.<caret>compute(1) { k, v -> null }
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
fun valuesNotNull(map: MutableMap<Int, String>) {
|
||||
map.compute(1) { k, v -> null }
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun compute(K, (K, V?) -> V?): V? defined in kotlin.collections.MutableMap
|
||||
// SUBSTITUTED: fun compute(Int, (Int, String?) -> String?): String? defined in kotlin.collections.MutableMap
|
||||
}
|
||||
|
||||
fun valuesNullable(map: MutableMap<Int, String?>) {
|
||||
map.compute(1) { k, v -> v?.let { it + k } }
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun compute(K, (K, V?) -> V?): V? defined in kotlin.collections.MutableMap
|
||||
// SUBSTITUTED: fun compute(Int, (Int, String?) -> String?): String? defined in kotlin.collections.MutableMap
|
||||
}
|
||||
|
||||
fun <T> valuesT(map: MutableMap<Int, T>, newValue: T) {
|
||||
map.compute(1) { k, v -> null }
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun compute(K, (K, V?) -> V?): V? defined in kotlin.collections.MutableMap
|
||||
// SUBSTITUTED: fun compute(Int, (Int, T?) -> T?): T? defined in kotlin.collections.MutableMap
|
||||
}
|
||||
|
||||
fun <T : Any> valuesTNotNull(map: MutableMap<Int, T>, newValue: T) {
|
||||
map.compute(1) { k, v -> null }
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun compute(K, (K, V?) -> V?): V? defined in kotlin.collections.MutableMap
|
||||
// SUBSTITUTED: fun compute(Int, (Int, T?) -> T?): T? defined in kotlin.collections.MutableMap
|
||||
}
|
||||
|
||||
fun <T : Any> valuesTNullable(map: MutableMap<Int, T?>, newValue: T?) {
|
||||
map.compute(1) { k, v -> null }
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun compute(K, (K, V?) -> V?): V? defined in kotlin.collections.MutableMap
|
||||
// SUBSTITUTED: fun compute(Int, (Int, T?) -> T?): T? defined in kotlin.collections.MutableMap
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fun valuesNotNull(map: MutableMap<Int, String>) {
|
||||
map.<caret>computeIfAbsent(1) { k -> "new value" }
|
||||
}
|
||||
|
||||
fun valuesNullable(map: MutableMap<Int, String?>) {
|
||||
map.<caret>computeIfAbsent(1) { k -> null }
|
||||
}
|
||||
|
||||
fun <T> valuesT(map: MutableMap<Int, T>, newValue: T) {
|
||||
map.<caret>computeIfAbsent(1) { k -> newValue }
|
||||
}
|
||||
|
||||
fun <T : Any> valuesTNotNull(map: MutableMap<Int, T>, newValue: T) {
|
||||
map.<caret>computeIfAbsent(1) { k -> newValue }
|
||||
}
|
||||
|
||||
fun <T : Any> valuesTNullable(map: MutableMap<Int, T?>, newValue: T?) {
|
||||
map.<caret>computeIfAbsent(1) { k -> newValue }
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
fun valuesNotNull(map: MutableMap<Int, String>) {
|
||||
map.computeIfAbsent(1) { k -> "new value" }
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun computeIfAbsent(K, (K) -> V): V defined in kotlin.collections.MutableMap
|
||||
// SUBSTITUTED: fun computeIfAbsent(Int, (Int) -> String): String defined in kotlin.collections.MutableMap
|
||||
}
|
||||
|
||||
fun valuesNullable(map: MutableMap<Int, String?>) {
|
||||
map.computeIfAbsent(1) { k -> null }
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun computeIfAbsent(K, (K) -> V): V defined in kotlin.collections.MutableMap
|
||||
// SUBSTITUTED: fun computeIfAbsent(Int, (Int) -> String?): String? defined in kotlin.collections.MutableMap
|
||||
}
|
||||
|
||||
fun <T> valuesT(map: MutableMap<Int, T>, newValue: T) {
|
||||
map.computeIfAbsent(1) { k -> newValue }
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun computeIfAbsent(K, (K) -> V): V defined in kotlin.collections.MutableMap
|
||||
// SUBSTITUTED: fun computeIfAbsent(Int, (Int) -> T): T defined in kotlin.collections.MutableMap
|
||||
}
|
||||
|
||||
fun <T : Any> valuesTNotNull(map: MutableMap<Int, T>, newValue: T) {
|
||||
map.computeIfAbsent(1) { k -> newValue }
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun computeIfAbsent(K, (K) -> V): V defined in kotlin.collections.MutableMap
|
||||
// SUBSTITUTED: fun computeIfAbsent(Int, (Int) -> T): T defined in kotlin.collections.MutableMap
|
||||
}
|
||||
|
||||
fun <T : Any> valuesTNullable(map: MutableMap<Int, T?>, newValue: T?) {
|
||||
map.computeIfAbsent(1) { k -> newValue }
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun computeIfAbsent(K, (K) -> V): V defined in kotlin.collections.MutableMap
|
||||
// SUBSTITUTED: fun computeIfAbsent(Int, (Int) -> T?): T? defined in kotlin.collections.MutableMap
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
fun valuesNotNull(map: MutableMap<Int, String>) {
|
||||
map.<caret>computeIfPresent(1) { k, v -> v.length.toString() ?: null }
|
||||
}
|
||||
|
||||
fun valuesNullable(map: MutableMap<Int, String?>) {
|
||||
map.<caret>computeIfPresent(1) { k, v -> v?.length?.toString() }
|
||||
}
|
||||
|
||||
fun <T : String?> valuesT(map: MutableMap<Int, T>, newValue: T) {
|
||||
map.<caret>computeIfPresent(1) { k, v -> v?.length.toString() ?: null }
|
||||
}
|
||||
|
||||
fun <T : Any> valuesTNotNull(map: MutableMap<Int, T>, newValue: T) {
|
||||
map.<caret>computeIfPresent(1) { k, v -> null }
|
||||
}
|
||||
|
||||
fun <T : Any> valuesTNullable(map: MutableMap<Int, T?>, newValue: T?) {
|
||||
map.<caret>computeIfPresent(1) { k, v -> null }
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
fun valuesNotNull(map: MutableMap<Int, String>) {
|
||||
map.computeIfPresent(1) { k, v -> v.length.toString() ?: null }
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun computeIfPresent(K, (K, V) -> V?): V? defined in kotlin.collections.MutableMap
|
||||
// SUBSTITUTED: fun computeIfPresent(Int, (Int, String) -> String?): String? defined in kotlin.collections.MutableMap
|
||||
}
|
||||
|
||||
fun valuesNullable(map: MutableMap<Int, String?>) {
|
||||
map.computeIfPresent(1) { k, v -> v?.length?.toString() }
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun computeIfPresent(K, (K, V) -> V?): V? defined in kotlin.collections.MutableMap
|
||||
// SUBSTITUTED: fun computeIfPresent(Int, (Int, String) -> String?): String? defined in kotlin.collections.MutableMap
|
||||
}
|
||||
|
||||
fun <T : String?> valuesT(map: MutableMap<Int, T>, newValue: T) {
|
||||
map.computeIfPresent(1) { k, v -> v?.length.toString() ?: null }
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun computeIfPresent(K, (K, V) -> V?): V? defined in kotlin.collections.MutableMap
|
||||
// SUBSTITUTED: fun computeIfPresent(Int, (Int, T) -> T?): T? defined in kotlin.collections.MutableMap
|
||||
}
|
||||
|
||||
fun <T : Any> valuesTNotNull(map: MutableMap<Int, T>, newValue: T) {
|
||||
map.computeIfPresent(1) { k, v -> null }
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun computeIfPresent(K, (K, V) -> V?): V? defined in kotlin.collections.MutableMap
|
||||
// SUBSTITUTED: fun computeIfPresent(Int, (Int, T) -> T?): T? defined in kotlin.collections.MutableMap
|
||||
}
|
||||
|
||||
fun <T : Any> valuesTNullable(map: MutableMap<Int, T?>, newValue: T?) {
|
||||
map.computeIfPresent(1) { k, v -> null }
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun computeIfPresent(K, (K, V) -> V?): V? defined in kotlin.collections.MutableMap
|
||||
// SUBSTITUTED: fun computeIfPresent(Int, (Int, T) -> T?): T? defined in kotlin.collections.MutableMap
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fun valuesNotNull(map: MutableMap<Int, String>) {
|
||||
map.<caret>forEach { k, v -> }
|
||||
}
|
||||
|
||||
fun <T> valuesT(map: MutableMap<Int, T>, newValue: T) {
|
||||
map.<caret>forEach { k, v -> }
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
fun valuesNotNull(map: MutableMap<Int, String>) {
|
||||
map.forEach { k, v -> }
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun forEach((K, V) -> Unit): Unit defined in kotlin.collections.MutableMap
|
||||
// SUBSTITUTED: fun forEach((Int, String) -> Unit): Unit defined in kotlin.collections.MutableMap
|
||||
}
|
||||
|
||||
fun <T> valuesT(map: MutableMap<Int, T>, newValue: T) {
|
||||
map.forEach { k, v -> }
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun forEach((K, V) -> Unit): Unit defined in kotlin.collections.MutableMap
|
||||
// SUBSTITUTED: fun forEach((Int, T) -> Unit): Unit defined in kotlin.collections.MutableMap
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
fun valuesNotNull(map: MutableMap<Int, String>) {
|
||||
map.<caret>merge(1, "x") { old, new -> old + new }
|
||||
}
|
||||
|
||||
fun valuesNullable(map: MutableMap<Int, String?>) {
|
||||
map.<caret>merge(1, "x") { old, new -> old + new }
|
||||
map.<caret>merge(1, null) { old, new -> old + new }
|
||||
}
|
||||
|
||||
fun <T> valuesT(map: MutableMap<Int, T>, newValue: T) {
|
||||
map.<caret>merge(1, newValue) { old, new -> null }
|
||||
}
|
||||
|
||||
fun <T : Any> valuesTNotNull(map: MutableMap<Int, T>, newValue: T) {
|
||||
map.<caret>merge(1, newValue) { old, new -> null }
|
||||
}
|
||||
|
||||
fun <T : Any> valuesTNullable(map: MutableMap<Int, T?>, newValue: T?) {
|
||||
map.<caret>merge(1, newValue) { old, new -> new }
|
||||
map.<caret>merge(1, newValue!!) { old, new -> new }
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
fun valuesNotNull(map: MutableMap<Int, String>) {
|
||||
map.merge(1, "x") { old, new -> old + new }
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun merge(K, V, (V, V) -> V?): V? defined in kotlin.collections.MutableMap
|
||||
// SUBSTITUTED: fun merge(Int, String, (String, String) -> String?): String? defined in kotlin.collections.MutableMap
|
||||
}
|
||||
|
||||
fun valuesNullable(map: MutableMap<Int, String?>) {
|
||||
map.merge(1, "x") { old, new -> old + new }
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun merge(K, V, (V, V) -> V?): V? defined in kotlin.collections.MutableMap
|
||||
// SUBSTITUTED: fun merge(Int, String, (String, String) -> String?): String? defined in kotlin.collections.MutableMap
|
||||
map.merge(1, null) { old, new -> old + new }
|
||||
// OTHER_ERROR
|
||||
// ORIGINAL: fun merge(K, V, BiFunction<in V, in V, out V?>): V? defined in kotlin.collections.MutableMap
|
||||
// SUBSTITUTED: fun merge(Int, String, BiFunction<in String, in String, out String?>): String? defined in kotlin.collections.MutableMap
|
||||
}
|
||||
|
||||
fun <T> valuesT(map: MutableMap<Int, T>, newValue: T) {
|
||||
map.merge(1, newValue) { old, new -> null }
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun merge(K, V, (V, V) -> V?): V? defined in kotlin.collections.MutableMap
|
||||
// SUBSTITUTED: fun merge(Int, T, (T, T) -> T?): T? defined in kotlin.collections.MutableMap
|
||||
}
|
||||
|
||||
fun <T : Any> valuesTNotNull(map: MutableMap<Int, T>, newValue: T) {
|
||||
map.merge(1, newValue) { old, new -> null }
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun merge(K, V, (V, V) -> V?): V? defined in kotlin.collections.MutableMap
|
||||
// SUBSTITUTED: fun merge(Int, T, (T, T) -> T?): T? defined in kotlin.collections.MutableMap
|
||||
}
|
||||
|
||||
fun <T : Any> valuesTNullable(map: MutableMap<Int, T?>, newValue: T?) {
|
||||
map.merge(1, newValue) { old, new -> new }
|
||||
// OTHER_ERROR
|
||||
// ORIGINAL: fun merge(K, V, BiFunction<in V, in V, out V?>): V? defined in kotlin.collections.MutableMap
|
||||
// SUBSTITUTED: fun merge(Int, T, BiFunction<in T, in T, out T?>): T? defined in kotlin.collections.MutableMap
|
||||
map.merge(1, newValue!!) { old, new -> new }
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun merge(K, V, (V, V) -> V?): V? defined in kotlin.collections.MutableMap
|
||||
// SUBSTITUTED: fun merge(Int, T, (T, T) -> T?): T? defined in kotlin.collections.MutableMap
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fun valuesNotNull(map: MutableMap<Int, String>) {
|
||||
map.<caret>putIfAbsent(1, "")
|
||||
}
|
||||
|
||||
fun valuesNullable(map: MutableMap<Int, String?>) {
|
||||
map.<caret>putIfAbsent(1, null)
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
fun valuesNotNull(map: MutableMap<Int, String>) {
|
||||
map.putIfAbsent(1, "")
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun putIfAbsent(K, V): V? defined in kotlin.collections.MutableMap
|
||||
// SUBSTITUTED: fun putIfAbsent(Int, String): String? defined in kotlin.collections.MutableMap
|
||||
}
|
||||
|
||||
fun valuesNullable(map: MutableMap<Int, String?>) {
|
||||
map.putIfAbsent(1, null)
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun putIfAbsent(K, V): V? defined in kotlin.collections.MutableMap
|
||||
// SUBSTITUTED: fun putIfAbsent(Int, String?): String? defined in kotlin.collections.MutableMap
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
fun valuesNotNull(map: MutableMap<Int, String>) {
|
||||
map.<caret>replace(1, "x")
|
||||
map.<caret>replace(1, "x", "y")
|
||||
|
||||
map.<caret>replaceAll { k, v -> "$k to ${v.length}" }
|
||||
}
|
||||
|
||||
fun valuesNullable(map: MutableMap<Int, String?>) {
|
||||
map.<caret>replace(1, null)
|
||||
map.<caret>replace(1, null, "x")
|
||||
|
||||
map.<caret>replaceAll { k, v -> "$k to $v" }
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
fun valuesNotNull(map: MutableMap<Int, String>) {
|
||||
map.replace(1, "x")
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun replace(K, V): V? defined in kotlin.collections.MutableMap
|
||||
// SUBSTITUTED: fun replace(Int, String): String? defined in kotlin.collections.MutableMap
|
||||
map.replace(1, "x", "y")
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun replace(K, V, V): Boolean defined in kotlin.collections.MutableMap
|
||||
// SUBSTITUTED: fun replace(Int, String, String): Boolean defined in kotlin.collections.MutableMap
|
||||
|
||||
map.replaceAll { k, v -> "$k to ${v.length}" }
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun replaceAll((K, V) -> V): Unit defined in kotlin.collections.MutableMap
|
||||
// SUBSTITUTED: fun replaceAll((Int, String) -> String): Unit defined in kotlin.collections.MutableMap
|
||||
}
|
||||
|
||||
fun valuesNullable(map: MutableMap<Int, String?>) {
|
||||
map.replace(1, null)
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun replace(K, V): V? defined in kotlin.collections.MutableMap
|
||||
// SUBSTITUTED: fun replace(Int, String?): String? defined in kotlin.collections.MutableMap
|
||||
map.replace(1, null, "x")
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun replace(K, V, V): Boolean defined in kotlin.collections.MutableMap
|
||||
// SUBSTITUTED: fun replace(Int, String?, String?): Boolean defined in kotlin.collections.MutableMap
|
||||
|
||||
map.replaceAll { k, v -> "$k to $v" }
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun replaceAll((K, V) -> V): Unit defined in kotlin.collections.MutableMap
|
||||
// SUBSTITUTED: fun replaceAll((Int, String?) -> String?): Unit defined in kotlin.collections.MutableMap
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user