[FIR-TEST] Add new testdata generated after changes in previous commit
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
interface Tr
|
||||
interface G<T>
|
||||
|
||||
fun test(tr: Tr): Any {
|
||||
return tr as G<G>
|
||||
}
|
||||
|
||||
fun test1(tr: Tr): Any {
|
||||
return tr as G.(G) -> G
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// !CHECK_TYPE
|
||||
|
||||
interface Tr<T>
|
||||
interface G<T> : Tr<T>
|
||||
|
||||
fun test(tr: Tr<String>) {
|
||||
val v = tr as G?
|
||||
// If v is not nullable, there will be a warning on this line:
|
||||
<!INAPPLICABLE_CANDIDATE!>checkSubtype<!><G<String>>(v!!)
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// !CHECK_TYPE
|
||||
|
||||
interface Tr
|
||||
interface G<T>
|
||||
|
||||
fun test(tr: Tr) {
|
||||
val v = tr as G?
|
||||
// If v is not nullable, there will be a warning on this line:
|
||||
checkSubtype<G<*>>(v!!)
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// !CHECK_TYPE
|
||||
|
||||
interface Either<out A, out B>
|
||||
interface Left<out A>: Either<A, Nothing>
|
||||
interface Right<out B>: Either<Nothing, B>
|
||||
|
||||
class C1(val v1: Int)
|
||||
class C2(val v2: Int)
|
||||
|
||||
fun _as_left(e: Either<C1, C2>): Any {
|
||||
val v = e as Left
|
||||
return <!INAPPLICABLE_CANDIDATE!>checkSubtype<!><Left<C1>>(v)
|
||||
}
|
||||
|
||||
fun _as_right(e: Either<C1, C2>): Any {
|
||||
val v = e as Right
|
||||
return <!INAPPLICABLE_CANDIDATE!>checkSubtype<!><Right<C2>>(v)
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// !DIAGNOSTICS: -DEBUG_INFO_SMARTCAST
|
||||
interface Either<out A, out B>
|
||||
interface Left<out A>: Either<A, Nothing> {
|
||||
val value: A
|
||||
}
|
||||
interface Right<out B>: Either<Nothing, B> {
|
||||
val value: B
|
||||
}
|
||||
|
||||
class C1(val v1: Int)
|
||||
class C2(val v2: Int)
|
||||
|
||||
fun _is_l(e: Either<C1, C2>): Any {
|
||||
if (e is Left) {
|
||||
return e.value.<!UNRESOLVED_REFERENCE!>v1<!>
|
||||
}
|
||||
return e
|
||||
}
|
||||
|
||||
fun _is_r(e: Either<C1, C2>): Any {
|
||||
if (e is Right) {
|
||||
return e.value.<!UNRESOLVED_REFERENCE!>v2<!>
|
||||
}
|
||||
return e
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// !DIAGNOSTICS: -DEBUG_INFO_SMARTCAST
|
||||
interface Either<out A, out B>
|
||||
interface Left<out A>: Either<A, Nothing> {
|
||||
val value: A
|
||||
}
|
||||
interface Right<out B>: Either<Nothing, B> {
|
||||
val value: B
|
||||
}
|
||||
|
||||
class C1(val v1: Int)
|
||||
class C2(val v2: Int)
|
||||
|
||||
fun _is_l(e: Either<C1, C2>): Any {
|
||||
if (e !is Left) {
|
||||
return e
|
||||
}
|
||||
return e.value.<!UNRESOLVED_REFERENCE!>v1<!>
|
||||
}
|
||||
|
||||
fun _is_r(e: Either<C1, C2>): Any {
|
||||
if (e !is Right) {
|
||||
return e
|
||||
}
|
||||
return e.value.<!UNRESOLVED_REFERENCE!>v2<!>
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// !CHECK_TYPE
|
||||
|
||||
interface Either<out A, out B>
|
||||
interface Left<out A>: Either<A, Nothing>
|
||||
interface Right<out B>: Either<Nothing, B>
|
||||
|
||||
class C1(val v1: Int)
|
||||
class C2(val v2: Int)
|
||||
|
||||
fun _as_left(e: Either<C1, C2>): Any? {
|
||||
val v = e as? Left
|
||||
return <!INAPPLICABLE_CANDIDATE!>checkSubtype<!><Left<C1>?>(v)
|
||||
}
|
||||
|
||||
fun _as_right(e: Either<C1, C2>): Any? {
|
||||
val v = e as? Right
|
||||
return <!INAPPLICABLE_CANDIDATE!>checkSubtype<!><Right<C2>?>(v)
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
// !DIAGNOSTICS: -DEBUG_INFO_SMARTCAST
|
||||
interface Either<out A, out B>
|
||||
interface Left<out A>: Either<A, Nothing> {
|
||||
val value: A
|
||||
}
|
||||
interface Right<out B>: Either<Nothing, B> {
|
||||
val value: B
|
||||
}
|
||||
|
||||
class C1(val v1: Int)
|
||||
class C2(val v2: Int)
|
||||
|
||||
fun _when(e: Either<C1, C2>): Any {
|
||||
return when (e) {
|
||||
is Left -> e.value.<!UNRESOLVED_REFERENCE!>v1<!>
|
||||
is Right -> e.value.<!UNRESOLVED_REFERENCE!>v2<!>
|
||||
else -> e
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// !CHECK_TYPE
|
||||
|
||||
interface B<T>
|
||||
interface G<T>: B<T>
|
||||
|
||||
fun f(p: B<Foo>): Any {
|
||||
val v = p as G
|
||||
return checkSubtype<G<*>>(v)
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// !CHECK_TYPE
|
||||
|
||||
class G<T>
|
||||
|
||||
fun foo(p: P) {
|
||||
val v = p as G?
|
||||
checkSubtype<G<*>>(v!!)
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// !CHECK_TYPE
|
||||
|
||||
interface Tr<T>
|
||||
interface G<T> : Tr<T>
|
||||
|
||||
fun test(tr: Tr<String>?) {
|
||||
val v = tr as G
|
||||
<!INAPPLICABLE_CANDIDATE!>checkSubtype<!><G<String>>(v)
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// !CHECK_TYPE
|
||||
|
||||
interface Tr
|
||||
interface G<T>
|
||||
|
||||
fun test(tr: Tr?) {
|
||||
val v = tr as G
|
||||
checkSubtype<G<*>>(v)
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// !CHECK_TYPE
|
||||
|
||||
interface Tr<T>
|
||||
interface G<T> : Tr<T>
|
||||
|
||||
fun test(tr: Tr<String>?) {
|
||||
val v = tr as G?
|
||||
// If v is not nullable, there will be a warning on this line:
|
||||
<!INAPPLICABLE_CANDIDATE!>checkSubtype<!><G<String>>(v!!)
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// !CHECK_TYPE
|
||||
|
||||
interface Tr
|
||||
interface G<T>
|
||||
|
||||
fun test(tr: Tr?) {
|
||||
val v = tr as G?
|
||||
checkSubtype<G<*>>(v!!)
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
interface B<T>
|
||||
class G<T>: B<T>
|
||||
|
||||
fun f(b: B<String>?) = b is G??
|
||||
@@ -0,0 +1,6 @@
|
||||
class P
|
||||
|
||||
fun foo(p: P): Any {
|
||||
val v = p as G
|
||||
return v
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// !CHECK_TYPE
|
||||
|
||||
interface Tr
|
||||
interface G<T>
|
||||
|
||||
fun test(tr: Tr) {
|
||||
val v = tr as G
|
||||
checkSubtype<G<*>>(v)
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// !CHECK_TYPE
|
||||
// NI_EXPECTED_FILE
|
||||
|
||||
interface Tr
|
||||
interface G<T>
|
||||
|
||||
fun test(tr: Tr) = <!INAPPLICABLE_CANDIDATE!>checkSubtype<!><G>(tr)
|
||||
@@ -0,0 +1,4 @@
|
||||
interface Tr
|
||||
interface G<T>
|
||||
|
||||
fun test(tr: Tr) = tr is G
|
||||
Reference in New Issue
Block a user