[FIR-TEST] Add new testdata generated after changes in previous commit
This commit is contained in:
+18
@@ -0,0 +1,18 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -PLATFORM_CLASS_MAPPED_TO_KOTLIN
|
||||
|
||||
abstract class Test1 : Map<String, String> {
|
||||
fun containsKey(key: String): Boolean = TODO()
|
||||
|
||||
fun getOrDefault(key: String, defaultValue: String): String = TODO()
|
||||
}
|
||||
|
||||
abstract class Test2 : MutableMap<String, String> {
|
||||
fun replace(key: String, value: String): String? = TODO()
|
||||
}
|
||||
|
||||
abstract class Test3 : java.util.AbstractMap<String, String>() {
|
||||
fun containsKey(key: String): Boolean = TODO()
|
||||
|
||||
fun replace(key: String, value: String): String? = TODO()
|
||||
}
|
||||
|
||||
Vendored
+32
@@ -0,0 +1,32 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -PLATFORM_CLASS_MAPPED_TO_KOTLIN
|
||||
|
||||
|
||||
// Default methods from Java interfaces are NOT overridden by delegation.
|
||||
// So, in the example below 'TestNoDelegationToDefaultMethods#replace' implicitly overrides a method from 'java.util.Map' (which is ok),
|
||||
// but not a method from 'WithDelegation' (would be an error).
|
||||
open class WithDelegation(val m: Map<String, String>) : Map<String, String> by m
|
||||
|
||||
class TestNoDelegationToDefaultMethods(m: Map<String, String>): WithDelegation(m) {
|
||||
fun containsKey(key: String): Boolean = TODO()
|
||||
|
||||
fun getOrDefault(key: String, defaultValue: String): String = TODO()
|
||||
|
||||
fun replace(key: String, value: String): String? = TODO()
|
||||
}
|
||||
|
||||
|
||||
|
||||
interface IBaseWithKotlinDeclaration : Map<String, String> {
|
||||
fun replace(key: String, value: String): String?
|
||||
}
|
||||
|
||||
abstract class WithDelegation2(val m: Map<String, String>) : Map<String, String> by m, IBaseWithKotlinDeclaration
|
||||
|
||||
abstract class TestNoDelegationToDefaultMethods2(m: Map<String, String>): WithDelegation2(m) {
|
||||
fun containsKey(key: String): Boolean = TODO()
|
||||
|
||||
fun getOrDefault(key: String, defaultValue: String): String = TODO()
|
||||
|
||||
// VIRTUAL_MEMBER_HIDDEN: hides member declaration inherited from a Kotlin interface
|
||||
fun replace(key: String, value: String): String? = TODO()
|
||||
}
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -PLATFORM_CLASS_MAPPED_TO_KOTLIN
|
||||
|
||||
interface IBase : Map<String, String>
|
||||
|
||||
interface TestDerivedInterfaceHiding : IBase {
|
||||
fun replace(key: String, value: String): String?
|
||||
}
|
||||
|
||||
interface TestDerivedInterfaceDefault : IBase {
|
||||
fun replace(key: String, value: String): String? = TODO()
|
||||
}
|
||||
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -PLATFORM_CLASS_MAPPED_TO_KOTLIN
|
||||
|
||||
interface IBaseWithKotlinDeclaration : Map<String, String> {
|
||||
fun replace(key: String, value: String): String?
|
||||
}
|
||||
|
||||
interface TestDerivedInterfaceHidingWithKotlinDeclaration : IBaseWithKotlinDeclaration {
|
||||
// VIRTUAL_MEMBER_HIDDEN: hides member declaration inherited from a Kotlin interface
|
||||
fun replace(key: String, value: String): String?
|
||||
}
|
||||
|
||||
interface TestDerivedInterfaceDefaultWithKotlinDeclaration : IBaseWithKotlinDeclaration {
|
||||
// VIRTUAL_MEMBER_HIDDEN: hides member declaration inherited from a Kotlin interface
|
||||
fun replace(key: String, value: String): String? = TODO()
|
||||
}
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
// JAVAC_EXPECTED_FILE
|
||||
class ControlFlowException : Exception("") {
|
||||
fun fillInStackTrace() = this
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
enum class TestEnum {
|
||||
ENTRY;
|
||||
|
||||
fun getDeclaringClass() {}
|
||||
fun finalize() {}
|
||||
}
|
||||
|
||||
class TestFinalize {
|
||||
fun finalize() {}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -PLATFORM_CLASS_MAPPED_TO_KOTLIN
|
||||
// JAVAC_EXPECTED_FILE
|
||||
|
||||
class MyHashMap : java.util.HashMap<String, String>() {
|
||||
fun getOrDefault(key: String, defaultValue: String): String = TODO()
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
// FULL_JDK
|
||||
|
||||
import java.util.concurrent.*
|
||||
|
||||
val concurrent: ConcurrentMap<String, Int> = null!!
|
||||
val concurrentHash: ConcurrentHashMap<String, Int> = null!!
|
||||
|
||||
fun foo() {
|
||||
concurrent.remove("", 1)
|
||||
concurrent.remove("", "")
|
||||
concurrentHash.remove("", 1)
|
||||
concurrentHash.remove("", "")
|
||||
|
||||
// Flexible types
|
||||
concurrent.remove(null, 1)
|
||||
concurrent.remove(null, null)
|
||||
|
||||
// @PurelyImplements
|
||||
concurrentHash.remove(null, 1)
|
||||
concurrentHash.remove(null, null)
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
// FULL_JDK
|
||||
|
||||
import java.util.function.Consumer
|
||||
|
||||
abstract class MyIt1<out T> : Iterator<T> {
|
||||
override fun forEachRemaining(x: Consumer<in T>) {}
|
||||
}
|
||||
|
||||
abstract class MyIt2<out T> : Iterator<T> {
|
||||
override fun forEachRemaining(x: Consumer<in T?>) {}
|
||||
}
|
||||
|
||||
abstract class MyIt3<out T> : Iterator<T> {
|
||||
override fun forEachRemaining(x: Consumer<in T>?) {}
|
||||
}
|
||||
|
||||
abstract class MyIt4 : Iterator<String?> {
|
||||
override fun forEachRemaining(x: Consumer<in String?>) {}
|
||||
}
|
||||
|
||||
abstract class MyIt5 : Iterator<String> {
|
||||
override fun forEachRemaining(x: Consumer<in String>) {}
|
||||
}
|
||||
|
||||
abstract class MyIt6 : Iterator<String?> {
|
||||
override fun forEachRemaining(x: Consumer<in String>) {}
|
||||
}
|
||||
|
||||
abstract class MyIt7 : Iterator<String> {
|
||||
override fun forEachRemaining(x: Consumer<in String?>) {}
|
||||
}
|
||||
|
||||
|
||||
fun foo(x: Iterator<String>, y: Iterator<String?>) {
|
||||
x.forEachRemaining(null)
|
||||
|
||||
x.forEachRemaining { it -> it.length }
|
||||
x.forEachRemaining { it -> it?.length }
|
||||
y.forEachRemaining { it -> it.<!INAPPLICABLE_CANDIDATE!>length<!> }
|
||||
y.forEachRemaining { it -> it?.length }
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// FULL_JDK
|
||||
|
||||
abstract class A : Map<Int, String>
|
||||
|
||||
fun foo(x: Map<Int, String>, a: A, b: java.util.HashMap<Int, String>) {
|
||||
x.getOrDefault(1, "")
|
||||
x.<!INAPPLICABLE_CANDIDATE!>getOrDefault<!>("", "")
|
||||
x.<!INAPPLICABLE_CANDIDATE!>getOrDefault<!>(1, 2)
|
||||
x.<!INAPPLICABLE_CANDIDATE!>getOrDefault<!>("", 2)
|
||||
|
||||
a.getOrDefault(1, "")
|
||||
a.<!INAPPLICABLE_CANDIDATE!>getOrDefault<!>("", "")
|
||||
a.<!INAPPLICABLE_CANDIDATE!>getOrDefault<!>(1, 2)
|
||||
a.<!INAPPLICABLE_CANDIDATE!>getOrDefault<!>("", 2)
|
||||
|
||||
b.getOrDefault(1, "")
|
||||
b.getOrDefault("", "")
|
||||
b.<!INAPPLICABLE_CANDIDATE!>getOrDefault<!>(1, 2)
|
||||
b.<!INAPPLICABLE_CANDIDATE!>getOrDefault<!>("", 2)
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -PARAMETER_NAME_CHANGED_ON_OVERRIDE
|
||||
// !WITH_NEW_INFERENCE
|
||||
// FULL_JDK
|
||||
|
||||
class KotlinMap1<K, V> : java.util.AbstractMap<K, V>() {
|
||||
override val entries: MutableSet<MutableMap.MutableEntry<K, V>>
|
||||
get() = throw UnsupportedOperationException()
|
||||
|
||||
override fun remove(x: K, y: V) = true
|
||||
}
|
||||
|
||||
class KotlinMap2 : java.util.AbstractMap<String, Int>() {
|
||||
override val entries: MutableSet<MutableMap.MutableEntry<String, Int>>
|
||||
get() = throw UnsupportedOperationException()
|
||||
|
||||
override fun remove(x: String, y: Int) = true
|
||||
}
|
||||
|
||||
fun foo(x: MutableMap<String, Int>, y: java.util.HashMap<String, Int>, z: java.util.AbstractMap<String, Int>) {
|
||||
x.remove("", 1)
|
||||
x.<!INAPPLICABLE_CANDIDATE!>remove<!>("", "")
|
||||
x.remove("", null)
|
||||
|
||||
y.remove("", 1)
|
||||
y.remove("", "")
|
||||
y.remove("", null)
|
||||
|
||||
z.remove("", 1)
|
||||
z.<!INAPPLICABLE_CANDIDATE!>remove<!>("", "")
|
||||
z.remove("", null)
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// FULL_JDK
|
||||
|
||||
import java.util.stream.*
|
||||
|
||||
interface A : MutableCollection<String> {
|
||||
override fun removeIf(x: java.util.function.Predicate<in String>) = false
|
||||
}
|
||||
|
||||
fun foo(x: MutableList<String>, y: A) {
|
||||
x.<!UNRESOLVED_REFERENCE!>removeIf<!> { <!UNRESOLVED_REFERENCE!>it<!>.<!UNRESOLVED_REFERENCE!>length<!> > 0 }
|
||||
y.removeIf { it.length > 0 }
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// !WITH_NEW_INFERENCE
|
||||
// FULL_JDK
|
||||
|
||||
import java.util.stream.*
|
||||
|
||||
interface A : Collection<String> {
|
||||
override fun stream(): Stream<String> = Stream.of()
|
||||
}
|
||||
|
||||
fun foo(x: List<String>, y: A) {
|
||||
x.stream().filter { it.length > 0 }.<!INAPPLICABLE_CANDIDATE!>collect<!>(Collectors.toList())
|
||||
y.stream().filter { it.length > 0 }
|
||||
}
|
||||
Reference in New Issue
Block a user