[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,30 @@
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_PARAMETER
class X {
abstract class Y<T : Any>
fun <T : Any> foo(y: Y<T>, t: T) {
}
}
fun testStar(y: X.Y<*>, t: Any) {
X().<!INAPPLICABLE_CANDIDATE!>foo<!>(y, t)
}
fun testOut(y: X.Y<out Any>, t: Any) {
X().<!INAPPLICABLE_CANDIDATE!>foo<!>(y, t)
}
fun testIn(y: X.Y<in Any>, t: Any) {
X().foo(y, t)
}
fun <T : Any> testWithParameter(y: X.Y<T>, t: Any) {
X().<!INAPPLICABLE_CANDIDATE!>foo<!>(y, t)
}
fun <T : Any> testWithCapturedParameter(y: X.Y<out T>, t: Any) {
X().<!INAPPLICABLE_CANDIDATE!>foo<!>(y, t)
}
@@ -0,0 +1,35 @@
// !WITH_NEW_INFERENCE
// !CHECK_TYPE
// NI_EXPECTED_FILE
private class Outer<E> {
private inner class Inner<out F> {
private fun <G> foo() = {
fun baz() = {
class Local {
val e: E = magic()
val f: F = magic()
val g: G = magic()
}
Local()
}
baz()()
}
private var doubleCharSequenceInt = Outer<Double>().Inner<CharSequence>().foo<Int>()()
private var doubleStringNumber = Outer<Double>().Inner<String>().foo<Number>()()
private var doubleStringInt = Outer<Double>().Inner<String>().foo<Int>()()
private fun bar() {
doubleCharSequenceInt = doubleStringNumber
doubleCharSequenceInt = doubleStringInt
doubleStringInt = Outer<Double>().Inner<String>().foo<Int>()()
doubleStringInt.e.checkType { <!INAPPLICABLE_CANDIDATE!>_<!><Double>() }
doubleStringInt.f.checkType { <!INAPPLICABLE_CANDIDATE!>_<!><String>() }
doubleStringInt.g.checkType { <!INAPPLICABLE_CANDIDATE!>_<!><Int>() }
}
}
}
fun <T> magic(): T = null!!
@@ -0,0 +1,25 @@
// !WITH_NEW_INFERENCE
// !CHECK_TYPE
fun <T> magic(): T = null!!
class Q {
private fun <E> foo() = {
class C {
val prop: E = magic()
}
C()
}
private var x = foo<CharSequence>()()
private var y = foo<String>()()
fun bar() {
x = y
x = foo<CharSequence>()()
y = foo<String>()()
x.prop.checkType { <!INAPPLICABLE_CANDIDATE!>_<!><CharSequence>() }
y.prop.checkType { <!INAPPLICABLE_CANDIDATE!>_<!><String>() }
}
}
@@ -0,0 +1,22 @@
// !CHECK_TYPE
fun <T> magic(): T = null!!
class Q {
private fun <E, F> foo() = {
class C<G> {
val e: E = magic()
val f: F = magic()
val g: G = magic()
}
C<F>()
}
private var x = foo<CharSequence, Number>()()
fun bar() {
x.e.checkType { <!INAPPLICABLE_CANDIDATE!>_<!><CharSequence>() }
x.f.checkType { <!INAPPLICABLE_CANDIDATE!>_<!><Number>() }
x.g.checkType { _<Number>() }
}
}
@@ -0,0 +1,23 @@
// !WITH_NEW_INFERENCE
// !CHECK_TYPE
fun <T> magic(): T = null!!
class Q {
private fun <E> foo() =
object {
val prop: E = magic()
}
private var x = foo<CharSequence>()
private var y = foo<String>()
fun bar() {
x = y
x = foo<CharSequence>()
y = foo<String>()
x.prop.checkType { <!INAPPLICABLE_CANDIDATE!>_<!><CharSequence>() }
y.prop.checkType { <!INAPPLICABLE_CANDIDATE!>_<!><String>() }
}
}
@@ -0,0 +1,37 @@
fun <E> foo(x: Any, y: Any) : Any {
class C
// without E?
if(x is C) {
return x
}
if (1 == 2) {
x as C
}
if (2 == 3) {
x as? C
}
class Outer<F> {
inner class Inner
}
// bare type
if (y is Outer.Inner) {
return y
}
y as Outer<*>.Inner
return C()
}
fun noTypeParameters(x: Any) : Any {
class C
if(x is C) {
return x
}
return C()
}