Introduce FIR_IDENTICAL for FIR vs old frontend tests #KT-36879 Fixed
This commit is contained in:
@@ -1,2 +0,0 @@
|
||||
|
||||
fun ff(c: MutableCollection<String>) = c as MutableList<String>
|
||||
@@ -1,2 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
|
||||
fun ff(c: MutableCollection<String>) = c as MutableList<String>
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
|
||||
fun ff(l: Any) = l as MutableList<*>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
|
||||
fun ff(l: Any) = l as MutableList<*>
|
||||
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
fun f(a: (Int) -> Unit) {
|
||||
a as Int.() -> Unit
|
||||
|
||||
f1(a as Int.() -> Unit)
|
||||
}
|
||||
|
||||
fun f1(a: Int.() -> Unit) {
|
||||
a as (Int) -> Unit
|
||||
f(a as (Int) -> Unit)
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
fun f(a: (Int) -> Unit) {
|
||||
a as Int.() -> Unit
|
||||
|
||||
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
open class BaseTwo<A, B>
|
||||
open class DerivedWithOne<D>: BaseTwo<D, String>()
|
||||
|
||||
// a is BaseTwo<T, U> => if (a is DerivedWithOne<?>) a is DerivedWithOne<T>
|
||||
fun <T, U> testing(a: BaseTwo<T, U>) = a is DerivedWithOne<T>
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
open class BaseTwo<A, B>
|
||||
open class DerivedWithOne<D>: BaseTwo<D, String>()
|
||||
|
||||
|
||||
Vendored
-8
@@ -1,8 +0,0 @@
|
||||
open class A
|
||||
open class B: A()
|
||||
|
||||
open class Base<out T>
|
||||
open class SubBase<T> : Base<T>()
|
||||
|
||||
// l is Base<+B> => if (l is SubBase<?>) l is SubBase<+B> => l is SubBase<+A>
|
||||
fun ff(l: Base<B>) = l is SubBase<out A>
|
||||
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
open class A
|
||||
open class B: A()
|
||||
|
||||
|
||||
Vendored
-6
@@ -1,6 +0,0 @@
|
||||
open class BaseMulti<out A, B>
|
||||
class SomeMultiDerived<out D>: BaseMulti<D, Any>()
|
||||
|
||||
// t is BaseMulti<+String, String> => if (t is SomeMultiDerived<?>) => t is SomeMultiDerived<+String> =>
|
||||
// => (String <: Any, SomeMultiDerived<Covariant D>) t is SomeMultiDerived<+Any>
|
||||
fun someDerived(t: BaseMulti<String, String>) = t is SomeMultiDerived<Any>
|
||||
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
open class BaseMulti<out A, B>
|
||||
class SomeMultiDerived<out D>: BaseMulti<D, Any>()
|
||||
|
||||
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
open class Base<A>
|
||||
class Some: Base<Int>()
|
||||
|
||||
// No erased types in check
|
||||
fun <A> f(a: Base<A>) = a is Some
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
open class Base<A>
|
||||
class Some: Base<Int>()
|
||||
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
|
||||
open class A
|
||||
|
||||
class B : A()
|
||||
|
||||
fun ff(l: MutableCollection<B>) = l is MutableList<out A>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
|
||||
open class A
|
||||
|
||||
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
|
||||
fun ff(l: MutableCollection<String>) = l is MutableList<String>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
|
||||
fun ff(l: MutableCollection<String>) = l is MutableList<String>
|
||||
|
||||
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
|
||||
fun <T> ff(l: MutableCollection<T>) = l is MutableList<T>
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
|
||||
fun <T> ff(l: MutableCollection<T>) = l is MutableList<T>
|
||||
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
interface A
|
||||
interface B
|
||||
fun testing(a: A) = a as B
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
interface A
|
||||
interface B
|
||||
fun testing(a: A) = a as B
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
fun <T: Any> testing(a: T?) = a is T
|
||||
@@ -1 +1,2 @@
|
||||
// FIR_IDENTICAL
|
||||
fun <T: Any> testing(a: T?) = a is T
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
|
||||
fun ff(l: Any) = l is MutableList<*>
|
||||
@@ -1,2 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
|
||||
fun ff(l: Any) = l is MutableList<*>
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
interface Aaa
|
||||
interface Bbb
|
||||
|
||||
fun f(a: Aaa) = a is Bbb
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
interface Aaa
|
||||
interface Bbb
|
||||
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
// check that there is no SOE on checking for instance
|
||||
interface Visitor<T>
|
||||
interface Acceptor<T>
|
||||
|
||||
class Word : Acceptor<Visitor<Word>>
|
||||
|
||||
class V : Visitor<Word>
|
||||
|
||||
class S<T : Acceptor<U>, U : Visitor<T>>(val visitor: U, val acceptor: T) {
|
||||
fun test() {
|
||||
visitor is V
|
||||
acceptor is Word
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// check that there is no SOE on checking for instance
|
||||
interface Visitor<T>
|
||||
interface Acceptor<T>
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
// From KT-13324: always succeeds
|
||||
val x = null as String?
|
||||
// From KT-260: sometimes succeeds
|
||||
fun foo(a: String?): Int? {
|
||||
val c = a as? Int?
|
||||
return c
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// From KT-13324: always succeeds
|
||||
val x = null as String?
|
||||
// From KT-260: sometimes succeeds
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
interface I1
|
||||
interface I2
|
||||
|
||||
fun foo(i: I1) {}
|
||||
fun foo(i: I2) {}
|
||||
|
||||
fun bar(i: I1) {
|
||||
if (i is I2) {
|
||||
foo(i as I1)
|
||||
foo(i as I2)
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
interface I1
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
class List<out T>(val size : Int) {
|
||||
companion object {
|
||||
val Nil = List<Nothing>(0)
|
||||
}
|
||||
}
|
||||
|
||||
fun List<String>.join() =
|
||||
when (this) {
|
||||
List.Nil -> "[]" // CANNOT_CHECK_FOR_ERASED was reported
|
||||
else -> ""
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
class List<out T>(val size : Int) {
|
||||
companion object {
|
||||
val Nil = List<Nothing>(0)
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
// !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:
|
||||
checkSubtype<G<String>>(v!!)
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !CHECK_TYPE
|
||||
|
||||
interface Tr<T>
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
// !CHECK_TYPE
|
||||
|
||||
interface Tr<T>
|
||||
interface G<T> : Tr<T>
|
||||
|
||||
fun test(tr: Tr<String>?) {
|
||||
val v = tr as G
|
||||
checkSubtype<G<String>>(v)
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !CHECK_TYPE
|
||||
|
||||
interface Tr<T>
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
// !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:
|
||||
checkSubtype<G<String>>(v!!)
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
// !CHECK_TYPE
|
||||
|
||||
interface Tr<T>
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
class G<T>
|
||||
|
||||
fun f(q: Any) = q is G<*>
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
class G<T>
|
||||
|
||||
fun f(q: Any) = q is G<*>
|
||||
@@ -1,3 +0,0 @@
|
||||
class G<T>
|
||||
|
||||
fun <Q> f(q: Q) = q is G<*>
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
class G<T>
|
||||
|
||||
fun <Q> f(q: Q) = q is G<*>
|
||||
@@ -1,4 +0,0 @@
|
||||
class G<T>
|
||||
interface Tr
|
||||
|
||||
fun f(q: Tr) = q is G<*>
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
class G<T>
|
||||
interface Tr
|
||||
|
||||
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
open class A {
|
||||
fun foo() {}
|
||||
}
|
||||
class B : A()
|
||||
|
||||
fun test(b: B?) {
|
||||
(b as A).foo()
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
open class A {
|
||||
fun foo() {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user