[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,14 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
import kotlin.reflect.KProperty
class A(val map: MutableMap<String, CharSequence>) {
var a: String by map.withDefault1 { "foo" }
}
operator fun <G> MutableMap<in String, in G>.getValue(thisRef: Any?, property: KProperty<*>): G = throw Exception()
operator fun <S> MutableMap<in String, in S>.setValue(thisRef: Any?, property: KProperty<*>, value: S) {}
fun <K, V> MutableMap<K, V>.withDefault1(default: (key: K) -> V): MutableMap<K, V> = this
@@ -0,0 +1,22 @@
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER
class B {
class Builder
}
typealias ApplyRestrictions = B.Builder.() -> B.Builder
fun applyRestrictions1(): ApplyRestrictions = TODO()
fun applyRestrictions2() = applyRestrictions1()
fun <K> applyRestrictions3(e: K) = applyRestrictions1()
fun buildB() {
val a1 = applyRestrictions1()
val a2 = applyRestrictions2()
val a3 = applyRestrictions3("foo")
B.Builder().<!UNRESOLVED_REFERENCE!>a1<!>()
B.Builder().<!UNRESOLVED_REFERENCE!>a2<!>()
B.Builder().<!UNRESOLVED_REFERENCE!>a3<!>()
}
@@ -0,0 +1,22 @@
// !LANGUAGE: -NewInference
// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER
class B {
class Builder
}
typealias ApplyRestrictions = B.Builder.() -> B.Builder
fun applyRestrictions1(): ApplyRestrictions = TODO()
fun applyRestrictions2() = applyRestrictions1()
fun <K> applyRestrictions3(e: K) = applyRestrictions1()
fun buildB() {
val a1 = applyRestrictions1()
val a2 = applyRestrictions2()
val a3 = applyRestrictions3("foo")
B.Builder().<!UNRESOLVED_REFERENCE!>a1<!>()
B.Builder().<!UNRESOLVED_REFERENCE!>a2<!>()
B.Builder().<!UNRESOLVED_REFERENCE!>a3<!>()
}
@@ -0,0 +1,14 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
//KT-6081 Chained generic method calls: wrong type inference
class Bar<T>
fun <T> bar(): Bar<T> = null!!
class Foo {
fun <R> add(bar: Bar<R>): Foo {return this}
}
fun doesNotWork(bi: Bar<Int>, bs: Bar<String>) {
Foo().add(bi).add(bs)
}
@@ -0,0 +1,10 @@
class A<T> {
fun useT(t: T) = t
fun <U> newA(): A<U> = A()
}
fun test1() {
A<Int>().newA<String>().useT("")
A<Int>().newA<String>().<!INAPPLICABLE_CANDIDATE!>useT<!>(1)
}
@@ -0,0 +1,25 @@
class Test {
private fun <T : Any> T.self() = object {
fun bar(): T {
return this@self
}
}
fun test() {
1.self().bar() <!INAPPLICABLE_CANDIDATE!>+<!> 1
}
}
class Foo<R> {
private fun <T> bar() = object {
fun baz(): Foo<R> {
return this@Foo
}
}
fun getR(r: R) = r
fun test() {
Foo<Int>().bar<String>().baz().getR(1)
Foo<Int>().bar<String>().baz().<!INAPPLICABLE_CANDIDATE!>getR<!>("")
}
}
@@ -0,0 +1,22 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class Outer<T> {
inner class Inner<I> {
fun getOuter(): Outer<T> = this@Outer
fun <R> genericFun(r: R): Outer<T> = this@Outer
}
fun useOuterParam(t: T) {}
}
fun test1() {
Outer<Int>().Inner<String>().getOuter().useOuterParam(22)
Outer<Int>().Inner<String>().getOuter().<!INAPPLICABLE_CANDIDATE!>useOuterParam<!>("")
}
class A
class B
fun test1(a: A, b: B) {
Outer<Int>().Inner<String>().genericFun(a).Inner<Double>().genericFun(b)
}