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:
+11
@@ -0,0 +1,11 @@
|
||||
fun notNullValues(collection: MutableCollection<String>) {
|
||||
collection.<caret>removeIf { it.length > 5 }
|
||||
}
|
||||
|
||||
fun <E : CharSequence> nullableValues(collection: MutableCollection<E?>) {
|
||||
collection.<caret>removeIf { it != null && it.length > 5 }
|
||||
}
|
||||
|
||||
fun <E : CharSequence?> nullableValues2(collection: MutableCollection<E>) {
|
||||
collection.<caret>removeIf { it == null }
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
fun notNullValues(collection: MutableCollection<String>) {
|
||||
collection.removeIf { it.length > 5 }
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun removeIf((E) -> Boolean): Boolean defined in kotlin.collections.MutableCollection
|
||||
// SUBSTITUTED: fun removeIf((String) -> Boolean): Boolean defined in kotlin.collections.MutableCollection
|
||||
}
|
||||
|
||||
fun <E : CharSequence> nullableValues(collection: MutableCollection<E?>) {
|
||||
collection.removeIf { it != null && it.length > 5 }
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun removeIf((E) -> Boolean): Boolean defined in kotlin.collections.MutableCollection
|
||||
// SUBSTITUTED: fun removeIf((E?) -> Boolean): Boolean defined in kotlin.collections.MutableCollection
|
||||
}
|
||||
|
||||
fun <E : CharSequence?> nullableValues2(collection: MutableCollection<E>) {
|
||||
collection.removeIf { it == null }
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun removeIf((E) -> Boolean): Boolean defined in kotlin.collections.MutableCollection
|
||||
// SUBSTITUTED: fun removeIf((E) -> Boolean): Boolean defined in kotlin.collections.MutableCollection
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// TODO: Fix platform types
|
||||
fun <E : CharSequence> notNullValues(collection: Collection<E>) {
|
||||
collection.<caret>spliterator()
|
||||
}
|
||||
|
||||
fun <E : CharSequence> nullableValues(collection: Collection<E?>) {
|
||||
collection.<caret>spliterator()
|
||||
}
|
||||
|
||||
fun <E : CharSequence?> nullableValues2(collection: Collection<E>) {
|
||||
collection.<caret>spliterator()
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// TODO: Fix platform types
|
||||
fun <E : CharSequence> notNullValues(collection: Collection<E>) {
|
||||
collection.spliterator()
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun spliterator(): Spliterator<E!> defined in kotlin.collections.Collection
|
||||
// SUBSTITUTED: fun spliterator(): Spliterator<E!> defined in kotlin.collections.Collection
|
||||
}
|
||||
|
||||
fun <E : CharSequence> nullableValues(collection: Collection<E?>) {
|
||||
collection.spliterator()
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun spliterator(): Spliterator<E!> defined in kotlin.collections.Collection
|
||||
// SUBSTITUTED: fun spliterator(): Spliterator<E?> defined in kotlin.collections.Collection
|
||||
}
|
||||
|
||||
fun <E : CharSequence?> nullableValues2(collection: Collection<E>) {
|
||||
collection.spliterator()
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun spliterator(): Spliterator<E!> defined in kotlin.collections.Collection
|
||||
// SUBSTITUTED: fun spliterator(): Spliterator<E!> defined in kotlin.collections.Collection
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
fun <E : CharSequence> notNullValues(collection: Collection<E>) {
|
||||
collection.<caret>stream()
|
||||
collection.<caret>parallelStream()
|
||||
}
|
||||
|
||||
fun <E : CharSequence> nullableValues(collection: Collection<E?>) {
|
||||
collection.<caret>stream()
|
||||
collection.<caret>parallelStream()
|
||||
}
|
||||
|
||||
fun <E : CharSequence?> nullableValues2(collection: Collection<E>) {
|
||||
collection.<caret>stream()
|
||||
collection.<caret>parallelStream()
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
fun <E : CharSequence> notNullValues(collection: Collection<E>) {
|
||||
collection.stream()
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun stream(): Stream<E> defined in kotlin.collections.Collection
|
||||
// SUBSTITUTED: fun stream(): Stream<E> defined in kotlin.collections.Collection
|
||||
collection.parallelStream()
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun parallelStream(): Stream<E> defined in kotlin.collections.Collection
|
||||
// SUBSTITUTED: fun parallelStream(): Stream<E> defined in kotlin.collections.Collection
|
||||
}
|
||||
|
||||
fun <E : CharSequence> nullableValues(collection: Collection<E?>) {
|
||||
collection.stream()
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun stream(): Stream<E> defined in kotlin.collections.Collection
|
||||
// SUBSTITUTED: fun stream(): Stream<E?> defined in kotlin.collections.Collection
|
||||
collection.parallelStream()
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun parallelStream(): Stream<E> defined in kotlin.collections.Collection
|
||||
// SUBSTITUTED: fun parallelStream(): Stream<E?> defined in kotlin.collections.Collection
|
||||
}
|
||||
|
||||
fun <E : CharSequence?> nullableValues2(collection: Collection<E>) {
|
||||
collection.stream()
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun stream(): Stream<E> defined in kotlin.collections.Collection
|
||||
// SUBSTITUTED: fun stream(): Stream<E> defined in kotlin.collections.Collection
|
||||
collection.parallelStream()
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun parallelStream(): Stream<E> defined in kotlin.collections.Collection
|
||||
// SUBSTITUTED: fun parallelStream(): Stream<E> defined in kotlin.collections.Collection
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
fun <E : CharSequence> notNullValues(collection: Iterable<E>) {
|
||||
collection.<caret>spliterator()
|
||||
}
|
||||
|
||||
fun <E : CharSequence> nullableValues(collection: Iterable<E?>) {
|
||||
collection.<caret>spliterator()
|
||||
}
|
||||
|
||||
fun <E : CharSequence?> nullableValues2(collection: Iterable<E>) {
|
||||
collection.<caret>spliterator()
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
fun <E : CharSequence> notNullValues(collection: Iterable<E>) {
|
||||
collection.spliterator()
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun spliterator(): Spliterator<T> defined in kotlin.collections.Iterable
|
||||
// SUBSTITUTED: fun spliterator(): Spliterator<E> defined in kotlin.collections.Iterable
|
||||
}
|
||||
|
||||
fun <E : CharSequence> nullableValues(collection: Iterable<E?>) {
|
||||
collection.spliterator()
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun spliterator(): Spliterator<T> defined in kotlin.collections.Iterable
|
||||
// SUBSTITUTED: fun spliterator(): Spliterator<E?> defined in kotlin.collections.Iterable
|
||||
}
|
||||
|
||||
fun <E : CharSequence?> nullableValues2(collection: Iterable<E>) {
|
||||
collection.spliterator()
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun spliterator(): Spliterator<T> defined in kotlin.collections.Iterable
|
||||
// SUBSTITUTED: fun spliterator(): Spliterator<E> defined in kotlin.collections.Iterable
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
fun notNullValues(it: Iterator<String>) {
|
||||
it.<caret>forEachRemaining { e -> }
|
||||
}
|
||||
|
||||
fun mutableNullableValues(it: MutableIterator<String?>) {
|
||||
it.<caret>forEachRemaining { e -> }
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
fun notNullValues(it: Iterator<String>) {
|
||||
it.forEachRemaining { e -> }
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun forEachRemaining((T) -> Unit): Unit defined in kotlin.collections.Iterator
|
||||
// SUBSTITUTED: fun forEachRemaining((String) -> Unit): Unit defined in kotlin.collections.Iterator
|
||||
}
|
||||
|
||||
fun mutableNullableValues(it: MutableIterator<String?>) {
|
||||
it.forEachRemaining { e -> }
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun forEachRemaining((T) -> Unit): Unit defined in kotlin.collections.MutableIterator
|
||||
// SUBSTITUTED: fun forEachRemaining((String?) -> Unit): Unit defined in kotlin.collections.MutableIterator
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fun notNullValues(list: MutableList<String>) {
|
||||
// TODO: Fix platform types
|
||||
list.<caret>replaceAll { it.length.toString() }
|
||||
}
|
||||
|
||||
fun nullableValues(list: MutableList<String?>) {
|
||||
// TODO: Fix platform types
|
||||
list.<caret>replaceAll { it?.run { length.toString() } }
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
fun notNullValues(list: MutableList<String>) {
|
||||
// TODO: Fix platform types
|
||||
list.replaceAll { it.length.toString() }
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun replaceAll((E!) -> E!): Unit defined in kotlin.collections.MutableList
|
||||
// SUBSTITUTED: fun replaceAll((String!) -> String!): Unit defined in kotlin.collections.MutableList
|
||||
}
|
||||
|
||||
fun nullableValues(list: MutableList<String?>) {
|
||||
// TODO: Fix platform types
|
||||
list.replaceAll { it?.run { length.toString() } }
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun replaceAll((E!) -> E!): Unit defined in kotlin.collections.MutableList
|
||||
// SUBSTITUTED: fun replaceAll((String?) -> String?): Unit defined in kotlin.collections.MutableList
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
fun <E : CharSequence> notNullValues(collection: List<E>) {
|
||||
collection.<caret>stream()
|
||||
collection.<caret>parallelStream()
|
||||
}
|
||||
|
||||
fun <E : CharSequence> nullableValues(collection: List<E?>) {
|
||||
collection.<caret>stream()
|
||||
collection.<caret>parallelStream()
|
||||
}
|
||||
|
||||
fun <E : CharSequence?> nullableValues2(collection: List<E>) {
|
||||
collection.<caret>stream()
|
||||
collection.<caret>parallelStream()
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
fun <E : CharSequence> notNullValues(collection: List<E>) {
|
||||
collection.stream()
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun stream(): Stream<E> defined in kotlin.collections.List
|
||||
// SUBSTITUTED: fun stream(): Stream<E> defined in kotlin.collections.List
|
||||
collection.parallelStream()
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun parallelStream(): Stream<E> defined in kotlin.collections.List
|
||||
// SUBSTITUTED: fun parallelStream(): Stream<E> defined in kotlin.collections.List
|
||||
}
|
||||
|
||||
fun <E : CharSequence> nullableValues(collection: List<E?>) {
|
||||
collection.stream()
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun stream(): Stream<E> defined in kotlin.collections.List
|
||||
// SUBSTITUTED: fun stream(): Stream<E?> defined in kotlin.collections.List
|
||||
collection.parallelStream()
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun parallelStream(): Stream<E> defined in kotlin.collections.List
|
||||
// SUBSTITUTED: fun parallelStream(): Stream<E?> defined in kotlin.collections.List
|
||||
}
|
||||
|
||||
fun <E : CharSequence?> nullableValues2(collection: List<E>) {
|
||||
collection.stream()
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun stream(): Stream<E> defined in kotlin.collections.List
|
||||
// SUBSTITUTED: fun stream(): Stream<E> defined in kotlin.collections.List
|
||||
collection.parallelStream()
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun parallelStream(): Stream<E> defined in kotlin.collections.List
|
||||
// SUBSTITUTED: fun parallelStream(): Stream<E> defined in kotlin.collections.List
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
import java.util.*
|
||||
|
||||
fun use() {
|
||||
Optional.<caret>empty<String>()
|
||||
Optional.<caret>empty<String?>()
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
import java.util.*
|
||||
|
||||
fun use() {
|
||||
Optional.empty<String>()
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun <T : Any!> empty(): Optional<T> defined in java.util.Optional
|
||||
// SUBSTITUTED: fun <T : Any!> empty(): Optional<String> defined in java.util.Optional
|
||||
Optional.empty<String?>()
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun <T : Any!> empty(): Optional<T> defined in java.util.Optional
|
||||
// SUBSTITUTED: fun <T : Any!> empty(): Optional<String> defined in java.util.Optional
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
import java.util.*
|
||||
|
||||
fun use(v: Optional<String>) {
|
||||
v.<caret>get()
|
||||
}
|
||||
|
||||
fun use2(v: Optional<String?>) {
|
||||
v.<caret>get()
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import java.util.*
|
||||
|
||||
fun use(v: Optional<String>) {
|
||||
v.get()
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun get(): T defined in java.util.Optional
|
||||
// SUBSTITUTED: fun get(): String defined in java.util.Optional
|
||||
}
|
||||
|
||||
fun use2(v: Optional<String?>) {
|
||||
v.get()
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun get(): T defined in java.util.Optional
|
||||
// SUBSTITUTED: fun get(): String defined in java.util.Optional
|
||||
}
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
import java.util.*
|
||||
|
||||
fun use(v: Optional<String>) {
|
||||
v.<caret>ifPresent { value -> }
|
||||
}
|
||||
|
||||
fun use2(v: Optional<String?>) {
|
||||
v.<caret>ifPresent { value -> }
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
import java.util.*
|
||||
|
||||
fun use(v: Optional<String>) {
|
||||
v.ifPresent { value -> }
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun ifPresent((T) -> Unit): Unit defined in java.util.Optional
|
||||
// SUBSTITUTED: fun ifPresent((String) -> Unit): Unit defined in java.util.Optional
|
||||
}
|
||||
|
||||
fun use2(v: Optional<String?>) {
|
||||
v.ifPresent { value -> }
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun ifPresent((T) -> Unit): Unit defined in java.util.Optional
|
||||
// SUBSTITUTED: fun ifPresent((String) -> Unit): Unit defined in java.util.Optional
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
import java.util.*
|
||||
|
||||
fun use() {
|
||||
val x: String? = "x"
|
||||
Optional.<caret>of(x)
|
||||
|
||||
Optional.<caret>of(x!!)
|
||||
Optional.<caret>ofNullable(x)
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import java.util.*
|
||||
|
||||
fun use() {
|
||||
val x: String? = "x"
|
||||
Optional.of(x)
|
||||
// OTHER_ERROR
|
||||
// ORIGINAL: fun <T : Any!> of(T): Optional<T> defined in java.util.Optional
|
||||
// SUBSTITUTED: fun <T : Any!> of(String): Optional<String> defined in java.util.Optional
|
||||
|
||||
Optional.of(x!!)
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun <T : Any!> of(T): Optional<T> defined in java.util.Optional
|
||||
// SUBSTITUTED: fun <T : Any!> of(String): Optional<String> defined in java.util.Optional
|
||||
Optional.ofNullable(x)
|
||||
// SUCCESS
|
||||
// ORIGINAL: fun <T : Any!> ofNullable(T?): Optional<T> defined in java.util.Optional
|
||||
// SUBSTITUTED: fun <T : Any!> ofNullable(String?): Optional<String> defined in java.util.Optional
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user