[FIR-TEST] Add new testdata generated after changes in previous commit

This commit is contained in:
Dmitriy Novozhilov
2019-12-11 16:16:22 +03:00
parent e9c02a1cca
commit 2536fa0cd5
4578 changed files with 104067 additions and 1 deletions
@@ -0,0 +1,79 @@
// !WITH_NEW_INFERENCE
// FULL_JDK
class A : java.util.concurrent.ConcurrentHashMap<String, Int>() {
operator fun contains(x: Char): Boolean = true
}
class B : java.util.concurrent.ConcurrentHashMap<String, Int>() {
override fun contains(value: Any?): Boolean {
return super.contains(value)
}
}
class C : java.util.concurrent.ConcurrentHashMap<String, Int>() {
operator override fun contains(value: Any?): Boolean {
return super.contains(value)
}
}
fun main() {
val hm = java.util.concurrent.<!UNRESOLVED_REFERENCE!>ConcurrentHashMap<!><String, Int>()
"" in hm
"" !in hm
1 <!AMBIGUITY, UNRESOLVED_REFERENCE!>!in<!> hm
2 <!AMBIGUITY!>in<!> hm
hm.contains("")
hm.<!AMBIGUITY!>contains<!>(1)
"" in (hm as Map<String, Int>)
"" !in (hm as Map<String, Int>)
1 in (hm as Map<String, Int>)
1 !in (hm as Map<String, Int>)
val a = A()
"" in a
"" !in a
1 !in a
2 in a
' ' in a
' ' !in a
a.contains("")
a.contains(1)
"" in (a as Map<String, Int>)
"" !in (a as Map<String, Int>)
1 in (a as Map<String, Int>)
1 !in (a as Map<String, Int>)
val b = B()
"" in b
"" !in b
1 !in b
2 in b
b.contains("")
b.contains(1)
"" in (b as Map<String, Int>)
"" !in (b as Map<String, Int>)
1 in (b as Map<String, Int>)
1 !in (b as Map<String, Int>)
// Actually, we could've allow calls here because the owner explicitly declared as operator, but semantics is still weird
val c = C()
"" in c
"" !in c
1 !in c
2 in c
c.contains("")
c.contains(1)
"" in (c as Map<String, Int>)
"" !in (c as Map<String, Int>)
1 in (c as Map<String, Int>)
1 !in (c as Map<String, Int>)
}
@@ -0,0 +1,80 @@
// !LANGUAGE: +ProhibitConcurrentHashMapContains
// !WITH_NEW_INFERENCE
// FULL_JDK
class A : java.util.concurrent.ConcurrentHashMap<String, Int>() {
operator fun contains(x: Char): Boolean = true
}
class B : java.util.concurrent.ConcurrentHashMap<String, Int>() {
override fun contains(value: Any?): Boolean {
return super.contains(value)
}
}
class C : java.util.concurrent.ConcurrentHashMap<String, Int>() {
operator override fun contains(value: Any?): Boolean {
return super.contains(value)
}
}
fun main() {
val hm = java.util.concurrent.<!UNRESOLVED_REFERENCE!>ConcurrentHashMap<!><String, Int>()
"" in hm
"" !in hm
1 <!AMBIGUITY, UNRESOLVED_REFERENCE!>!in<!> hm
2 <!AMBIGUITY!>in<!> hm
hm.contains("")
hm.<!AMBIGUITY!>contains<!>(1)
"" in (hm as Map<String, Int>)
"" !in (hm as Map<String, Int>)
1 in (hm as Map<String, Int>)
1 !in (hm as Map<String, Int>)
val a = A()
"" in a
"" !in a
1 !in a
2 in a
' ' in a
' ' !in a
a.contains("")
a.contains(1)
"" in (a as Map<String, Int>)
"" !in (a as Map<String, Int>)
1 in (a as Map<String, Int>)
1 !in (a as Map<String, Int>)
val b = B()
"" in b
"" !in b
1 !in b
2 in b
b.contains("")
b.contains(1)
"" in (b as Map<String, Int>)
"" !in (b as Map<String, Int>)
1 in (b as Map<String, Int>)
1 !in (b as Map<String, Int>)
// Actually, we could've allow calls here because the owner explicitly declared as operator, but semantics is still weird
val c = C()
"" in c
"" !in c
1 !in c
2 in c
c.contains("")
c.contains(1)
"" in (c as Map<String, Int>)
"" !in (c as Map<String, Int>)
1 in (c as Map<String, Int>)
1 !in (c as Map<String, Int>)
}
@@ -0,0 +1,58 @@
// !DIAGNOSTICS: -UNUSED_ANONYMOUS_PARAMETER
// FILE: KI.kt
interface KI {
fun manyParams(x: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String) -> Unit)
}
// FILE: A.java
import kotlin.jvm.functions.FunctionN;
public class A implements KI {
public FunctionN<?> field;
public A(FunctionN<?> w) {}
public void foo(FunctionN<String> x) {
}
public FunctionN<?> bar() {
return null;
}
public void baz(java.util.List<FunctionN<?>> z) {
}
public void manyParams(FunctionN<Unit> x) {
}
}
// FILE: main.kt
fun <T> any(): T = null!!
fun main() {
val a: A = A(null)
a.field.hashCode();
a.field = null;
a.foo(null)
a.bar()
a.baz(listOf())
a.<!AMBIGUITY!>manyParams<!>(null)
a.manyParams(any<kotlin.jvm.functions.FunctionN<Unit>>())
// Potentially, this would have better to forbid calling manyParams, too.
// But it might be complicated because we need to match that it is an override
// Seems to be fine because `A::manyParams` is anyway an override in JVM and can be called with (a as K)
a.manyParams {
x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21, x22, x23, x24, x25, x26, x27, x28, x29, x30, x31, x32 ->
}
}
@@ -0,0 +1,16 @@
// FILE: A.java
import kotlin.jvm.functions.FunctionN;
public class A {
public void foo(FunctionN<?> w) { }
}
// FILE: main.kt
class B : A()
fun foo() {
object : A() {}
}
@@ -0,0 +1,8 @@
// FULL_JDK
// SKIP_TXT
import java.util.regex.Pattern
val strs: List<String> = listOf("regex1", "regex2")
val patterns: List<Pattern> = strs.map(Pattern::compile)