[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,10 @@
open class Base(x: String, y: Int)
fun test(x: Any, y: Int?) {
if (x !is String) return
if (y == null) return
class Local: Base(x, y) {
}
}
@@ -0,0 +1,8 @@
fun test(x: Any) {
if (x !is String) return
class Local(s: String = x) {
fun foo(s: String = x): String = s
}
}
@@ -0,0 +1,17 @@
import kotlin.reflect.KProperty
class Del {
operator fun getValue(_this: Any?, p: KProperty<*>): Int = 0
}
fun df(del: Del): Del = del
fun test(del: Any?) {
if (del !is Del) return
class Local {
val delegatedVal by <!INAPPLICABLE_CANDIDATE!>df<!>(del)
val delegatedVal1: Int by <!INAPPLICABLE_CANDIDATE!>df<!>(del)
}
}
@@ -0,0 +1,11 @@
interface D {
fun foo() {}
}
fun test(d: Any?) {
if (d !is D) return
class Local : D by d {
}
}
@@ -0,0 +1,18 @@
interface D {
fun foo(): String = ""
}
fun test(d: Any?) {
if (d !is D) return
class Local {
fun f() {
d.foo()
}
fun f1() = d.foo()
fun f2(): String = d.foo()
}
}
@@ -0,0 +1,15 @@
fun test(x: Any) {
if (x !is String) return
class LocalOuter {
fun foo(y: Any) {
if (y !is String) return
class Local {
init {
x.<!UNRESOLVED_REFERENCE!>length<!>
y.<!UNRESOLVED_REFERENCE!>length<!>
}
}
}
}
}
@@ -0,0 +1,16 @@
// KT-338 Support.smartcasts in nested declarations
fun f(a: Any?) {
if (a is B) {
class C : X(a) {
init {
a.<!UNRESOLVED_REFERENCE!>foo<!>()
}
}
}
}
interface B {
fun foo() {}
}
open class X(b: B)
@@ -0,0 +1,12 @@
fun test(x: Any?) {
if (x !is String) return
class C {
val v = x.<!UNRESOLVED_REFERENCE!>length<!>
val vGet: Int
get() = x.<!UNRESOLVED_REFERENCE!>length<!>
val s: String = x
}
}
@@ -0,0 +1,9 @@
fun foo(x: Any?) {
if (x is String) {
object : Base(x) {
fun bar() = x.length
}
}
}
open class Base(s: String)
@@ -0,0 +1,15 @@
// KT-2225 Object expression delegation parameter should be checked with data flow info
interface A {
fun foo() : Int
}
class B : A {
override fun foo() = 10
}
fun foo(b: B?) : Int {
if (b == null) return 0
val o = object : A by b { //no info about b not null check
}
return o.foo()
}
@@ -0,0 +1,11 @@
fun test(x: Any) {
if (x !is String) return
class LocalOuter {
inner class Local {
init {
x.<!UNRESOLVED_REFERENCE!>length<!>
}
}
}
}
@@ -0,0 +1,8 @@
open class X(val s: String)
fun f(a: String?) {
if (a != null) {
object : X(a) { // Type mismatch: inferred type is kotlin.String? but kotlin.String was expected
}
}
}