[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,24 @@
class A : Double.() -> Unit {
override fun invoke(p1: Double) {}
}
class B : Int.(Double) -> Unit {
override fun invoke(p1: Int, p2: Double) {}
}
open class C {}
abstract class A0 : C.() -> Int
abstract class A1 : C.(Int) -> Int
abstract class A2 : C.(Int, String) -> Int
open class D<T> {}
abstract class B0<T> : D<T>.() -> Int
abstract class B1<T> : D<T>.(C) -> Int
abstract class B2<T> : D<T>.(T, C) -> T
interface E<T> {}
abstract class C0: C(), Int.() -> Double
abstract class C1<T>: C(), E<T>, Int.(C) -> Double
@@ -0,0 +1,10 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE
interface X<T>
interface A: X<String>
interface B : A, X<Int>
fun foo(x: B) {
// Checks that when checking subtypes we search closes corresponding constructor (e.g. with BFS)
val y: X<Int> = x
}
@@ -0,0 +1,45 @@
class A : () -> Unit {
override fun invoke() {}
}
class AA : Function0<Unit> {
override fun invoke() {}
}
class B : (Double) -> Unit {
override fun invoke(p1: Double) {}
}
class BB : Function1<Double, Unit> {
override fun invoke(p1: Double) {}
}
open class C {}
abstract class A0 : (C) -> Int
abstract class A1 : Function1<C, Int>
abstract class A2 : (C, Int) -> Int
abstract class A3 : Function2<C, Int, Int>
abstract class A4 : (Int, C, String) -> Int
abstract class A5 : Function3<Int, C, String, Int>
open class D<T> {}
abstract class B0<T> : (D<T>) -> Int
abstract class B1<T> : Function1<D<T>, Int>
abstract class B2<T> : (D<T>, C) -> Int
abstract class B3<T> : Function2<D<T>, C, Int>
abstract class B4<T> : (D<T>, C) -> T
abstract class B5<T> : Function2<D<T>, C, T>
interface E<T> {}
abstract class C0: C(), (Int) -> Double
abstract class C1: C(), Function1<Int, Double>
abstract class C2<T>: C(), E<T>, (Int, C) -> Double
abstract class C3<T>: C(), E<T>, Function2<Int, C, Double>
@@ -0,0 +1,18 @@
import java.io.Serializable
class A<T> where T : Cloneable, T : Serializable
interface CS1 : Cloneable, Serializable
interface CS2 : CS1
interface I1 {
fun foo(): A<in CS2>
}
interface I2 : I1 {
override fun foo(): A<CS1>
}
interface I3 : I1 {
override fun foo(): A<in CS1>
}
@@ -0,0 +1,42 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// FILE: A.java
public interface A<T> {
}
// FILE: B.java
public class B implements A<String> {
}
// FILE: 1.kt
class C: B()
class D: B(), A<String>
class E: B(), A<String?>
fun eatAString(a: A<String>) {}
fun eatAStringN(a: A<String?>) {}
fun test(b: B, c: C, d: D, e: E) {
eatAString(b)
eatAString(c)
eatAString(d)
eatAString(e)
<!INAPPLICABLE_CANDIDATE!>eatAStringN<!>(b)
<!INAPPLICABLE_CANDIDATE!>eatAStringN<!>(c)
<!INAPPLICABLE_CANDIDATE!>eatAStringN<!>(d)
<!INAPPLICABLE_CANDIDATE!>eatAStringN<!>(e)
}
// FILE: 3.kt
interface X : A<String>
interface Y: X
interface Z: X
class W: B(), Z
fun test2(w: W) {
eatAString(w)
<!INAPPLICABLE_CANDIDATE!>eatAStringN<!>(w)
}
@@ -0,0 +1,12 @@
// !CHECK_TYPE
// JAVAC_EXPECTED_FILE
import java.util.ArrayList
class Pair<A, B>(val a: A, val b: B)
class MyListOfPairs<T> : ArrayList<Pair<T, T>>() { }
fun test() {
checkSubtype<ArrayList<Pair<Int, Int>>>(MyListOfPairs<Int>())
}
@@ -0,0 +1,14 @@
//KT-2069 Cannot call super method when superclass has type parameters
package kt2069
interface T1 {
fun foo() {}
}
class T : T1 {
fun bar() {
super<T1>.foo()
}
companion object {}
}
@@ -0,0 +1,3 @@
class X : S
fun f(l: List<X>) {}
@@ -0,0 +1,7 @@
//KT-304: Resolve supertype reference to class anyway
open class Foo() : Bar() {
}
open class Bar<T>() {
}
@@ -0,0 +1,9 @@
interface Super {
var v: CharSequence
val v2: CharSequence
}
class Sub: Super {
override var v: String = "fail"
override val v2: String = "ok"
}
@@ -0,0 +1,5 @@
// !DIAGNOSTICS: -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE
fun test() {
var x = object {}
x = object {}
}
@@ -0,0 +1,19 @@
// !WITH_NEW_INFERENCE
// !DIAGNOSTICS: -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER
package p
private fun foo(a: Int) = run {
class A
A()
}
private fun foo() = run {
class A
A()
}
fun test() {
var x = foo(1)
x = foo()
}
@@ -0,0 +1,6 @@
class Test {
private var x = object {};
init {
x = object {}
}
}
@@ -0,0 +1,23 @@
// !WITH_NEW_INFERENCE
// !DIAGNOSTICS: -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER
package p
private fun foo(a: Int) = run {
object {
inner class A
fun foo() = A()
}.foo()
}
private fun foo() = run {
object {
inner class A
fun foo() = A()
}.foo()
}
fun test() {
var x = foo(1)
x = foo()
}
@@ -0,0 +1,23 @@
// !WITH_NEW_INFERENCE
// !DIAGNOSTICS: -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER
package p
private fun foo(a: Int) = run {
class A {
inner class B
}
A().B()
}
private fun foo() = run {
class A {
inner class B
}
A().B()
}
fun test() {
var x = foo(1)
x = foo()
}
@@ -0,0 +1,5 @@
private var x = object {}
fun test() {
x = object {}
}
@@ -0,0 +1,7 @@
interface A1 : B
interface A2 : B()
class A3 : B, B
enum class A4 : B