[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,18 @@
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
class A
class B {
fun foo() = this
}
fun test(foo: A.() -> Int) {
with(A()) {
<!INAPPLICABLE_CANDIDATE!>foo<!>() <!INAPPLICABLE_CANDIDATE!>checkType<!> { <!INAPPLICABLE_CANDIDATE!>_<!><Int>() }
with(B()) {
foo() checkType { _<B>() }
this.foo() checkType { _<B>() }
}
}
}
@@ -0,0 +1,13 @@
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
class A {
fun foo() = this
}
fun test(foo: A.() -> Int) {
with(A()) {
foo() checkType { _<A>() }
this.foo() checkType { _<A>() }
}
}
@@ -0,0 +1,22 @@
// FILE: Calendar.java
public class Calendar {
public void setTimeInMillis(long millis) {}
public long getTimeInMillis() { return 1; }
}
// FILE: 1.kt
class A
var A.timeInMillis: String
get() = ""
set(v) {}
fun a(c: Calendar) {
A().apply {
c.apply {
timeInMillis = 5 // synthesized variable for get|setTimeInMillis
timeInMillis = ""
}
timeInMillis = ""
}
}
@@ -0,0 +1,13 @@
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
class ClassA {
fun method1() = this
fun String.method2() {
method1() checkType { <!INAPPLICABLE_CANDIDATE!>_<!><String>() }
this.method1() checkType { <!INAPPLICABLE_CANDIDATE!>_<!><String>() }
}
}
fun String.method1() = this
@@ -0,0 +1,12 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
// KT-9810 Local variable vs property from implicit receiver
class A {
val foo = 2
}
fun test(foo: String) {
with(A()) {
val g: String = foo // locals win
}
}
@@ -0,0 +1,20 @@
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
enum class Foo {
FOO;
companion object {
fun valueOf(something: String) = 2
fun values() = 1
}
}
fun test() {
Foo.values() checkType { <!UNRESOLVED_REFERENCE!>_<!><Array<Foo>>() }
Foo.Companion.values() checkType { <!UNRESOLVED_REFERENCE!>_<!><Int>() }
Foo.valueOf("") checkType { <!UNRESOLVED_REFERENCE!>_<!><Foo>() }
Foo.Companion.valueOf("") checkType { <!UNRESOLVED_REFERENCE!>_<!><Int>() }
}
@@ -0,0 +1,16 @@
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
class A
fun A.foo() = this
fun test(a: A) {
fun A.foo() = 3
a.foo() checkType { <!UNRESOLVED_REFERENCE!>_<!><Int>() }
with(a) {
foo() checkType { _<Int>() }
}
}
@@ -0,0 +1,18 @@
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
class A {
fun foo() = this
}
fun test(a: A) {
fun A.foo() = 4
a.foo() checkType { <!UNRESOLVED_REFERENCE!>_<!><A>() }
with(a) {
foo() checkType { _<A>() }
this.foo() checkType { _<A>() }
}
}
@@ -0,0 +1,19 @@
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
// FILE: A.java
public class A {
public static void foo() {}
}
// FILE: 1.kt
class C {
fun foo() = this
inner class B : A() {
fun test() {
foo() checkType { <!INAPPLICABLE_CANDIDATE!>_<!><Unit>() }
}
}
}
@@ -0,0 +1,10 @@
// !CHECK_TYPE
data class A(val foo: Int)
operator fun A.component1(): String = ""
fun test(a: A) {
val (b) = a
b checkType { <!UNRESOLVED_REFERENCE!>_<!><Int>() }
}
@@ -0,0 +1,29 @@
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
// FILE: A.java
public class A {
public A getFoo() { return 3; }
}
// FILE: 1.kt
private val A.foo: Int get() = 4
fun test(a: A) {
a.foo checkType { <!UNRESOLVED_REFERENCE!>_<!><A>() }
with(a) {
foo checkType { _<A>() }
}
}
class B {
private val A.foo: B get() = this@B
fun test(a: A) {
a.foo checkType { <!INAPPLICABLE_CANDIDATE!>_<!><A>() }
with(a) {
foo checkType { _<A>() }
}
}
}
@@ -0,0 +1,36 @@
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
// FILE: A.java
public class A {
public A getFoo() { return 3; }
}
// FILE: B.java
public class B {
public B getFoo() { return ""; }
}
// FILE: 1.kt
class C(val foo: C)
fun test(a: A, b: B, c: C) {
with(a) {
with(b) {
foo checkType { _<B>() }
}
foo checkType { _<A>() }
}
with(a) {
with(c) {
foo checkType { _<C>() }
}
}
with(c) {
with(a) {
foo checkType { _<A>() }
}
}
}