Drop all tests that disable features for language version less than 3

This commit is contained in:
Ivan Kylchik
2021-12-27 15:54:18 +03:00
parent 549ea1a3b9
commit 6fc56477bf
151 changed files with 0 additions and 5673 deletions
@@ -1,36 +0,0 @@
// !LANGUAGE: -SafeCastCheckBoundSmartCasts
interface SomeClass {
val data: Any?
}
interface SomeSubClass : SomeClass {
val foo: Any?
}
fun g(a: SomeClass?) {
if (a as? SomeSubClass != null) {
// 'a' can be cast to SomeSubClass
a.hashCode()
a.foo
(a as? SomeSubClass)<!UNSAFE_CALL!>.<!>foo
(a <!USELESS_CAST!>as SomeSubClass<!>).foo
}
val b = (a as? SomeSubClass)?.foo
if (b != null) {
// 'a' can be cast to SomeSubClass
a.hashCode()
a.foo
(a as? SomeSubClass)<!UNSAFE_CALL!>.<!>foo
(a <!USELESS_CAST!>as SomeSubClass<!>).foo
}
val c = a as? SomeSubClass
if (c != null) {
// 'a' and 'c' can be cast to SomeSubClass
a.hashCode()
a.foo
(a as? SomeSubClass)<!UNSAFE_CALL!>.<!>foo
c.hashCode()
c.foo
}
}
@@ -1,36 +0,0 @@
// !LANGUAGE: -SafeCastCheckBoundSmartCasts
interface SomeClass {
val data: Any?
}
interface SomeSubClass : SomeClass {
val foo: Any?
}
fun g(a: SomeClass?) {
if (a as? SomeSubClass != null) {
// 'a' can be cast to SomeSubClass
a<!UNSAFE_CALL!>.<!>hashCode()
a.<!UNRESOLVED_REFERENCE!>foo<!>
(a as? SomeSubClass)<!UNSAFE_CALL!>.<!>foo
(a as SomeSubClass).foo
}
val b = (a as? SomeSubClass)?.foo
if (b != null) {
// 'a' can be cast to SomeSubClass
a<!UNSAFE_CALL!>.<!>hashCode()
a.<!UNRESOLVED_REFERENCE!>foo<!>
(a as? SomeSubClass)<!UNSAFE_CALL!>.<!>foo
(a as SomeSubClass).foo
}
val c = a as? SomeSubClass
if (c != null) {
// 'a' and 'c' can be cast to SomeSubClass
a<!UNSAFE_CALL!>.<!>hashCode()
a.<!UNRESOLVED_REFERENCE!>foo<!>
(a as? SomeSubClass)<!UNSAFE_CALL!>.<!>foo
<!DEBUG_INFO_SMARTCAST!>c<!>.hashCode()
<!DEBUG_INFO_SMARTCAST!>c<!>.foo
}
}
@@ -1,18 +0,0 @@
package
public fun g(/*0*/ a: SomeClass?): kotlin.Unit
public interface SomeClass {
public abstract val data: kotlin.Any?
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public interface SomeSubClass : SomeClass {
public abstract override /*1*/ /*fake_override*/ val data: kotlin.Any?
public abstract val foo: kotlin.Any?
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -1,52 +0,0 @@
// !LANGUAGE: -SafeCallBoundSmartCasts
fun foo(arg: Int?) {
val x = arg
if (x != null) {
arg.hashCode()
}
val y: Any? = arg
if (y != null) {
arg<!UNSAFE_CALL!>.<!>hashCode()
}
val yy: Any?
yy = arg
if (yy != null) {
arg.hashCode()
}
var z = arg
z = z?.let { 42 }
if (z != null) {
arg.hashCode()
}
}
fun kt6840_1(s: String?) {
val hash = s?.hashCode()
if (hash != null) {
s.length
}
}
fun kt6840_2(s: String?) {
if (s?.hashCode() != null) {
s.length
}
}
fun kt1635(s: String?) {
s?.hashCode()!!
s.hashCode()
}
fun kt2127() {
val s: String? = ""
if (s?.length != null) {
s.hashCode()
}
}
fun kt3356(s: String?): Int {
if (s?.length != 1) return 0
return s.length
}
@@ -1,52 +0,0 @@
// !LANGUAGE: -SafeCallBoundSmartCasts
fun foo(arg: Int?) {
val x = arg
if (x != null) {
arg<!UNSAFE_CALL!>.<!>hashCode()
}
val y: Any? = arg
if (y != null) {
arg<!UNSAFE_CALL!>.<!>hashCode()
}
val yy: Any?
yy = arg
if (yy != null) {
arg<!UNSAFE_CALL!>.<!>hashCode()
}
var z = arg
z = z?.let { 42 }
if (z != null) {
arg<!UNSAFE_CALL!>.<!>hashCode()
}
}
fun kt6840_1(s: String?) {
val hash = s?.hashCode()
if (hash != null) {
s<!UNSAFE_CALL!>.<!>length
}
}
fun kt6840_2(s: String?) {
if (s?.hashCode() != null) {
s<!UNSAFE_CALL!>.<!>length
}
}
fun kt1635(s: String?) {
s?.hashCode()!!
s<!UNSAFE_CALL!>.<!>hashCode()
}
fun kt2127() {
val s: String? = ""
if (s?.length != null) {
s<!UNSAFE_CALL!>.<!>hashCode()
}
}
fun kt3356(s: String?): Int {
if (s?.length != 1) return 0
return s<!UNSAFE_CALL!>.<!>length
}
@@ -1,8 +0,0 @@
package
public fun foo(/*0*/ arg: kotlin.Int?): kotlin.Unit
public fun kt1635(/*0*/ s: kotlin.String?): kotlin.Unit
public fun kt2127(): kotlin.Unit
public fun kt3356(/*0*/ s: kotlin.String?): kotlin.Int
public fun kt6840_1(/*0*/ s: kotlin.String?): kotlin.Unit
public fun kt6840_2(/*0*/ s: kotlin.String?): kotlin.Unit
@@ -1,153 +0,0 @@
// !LANGUAGE: -SafeCastCheckBoundSmartCasts -BooleanElvisBoundSmartCasts
// A set of examples for
// "If the result of a safe call is not null, understand that its receiver is not null"
// and some other improvements for nullability detection
fun kt6840_1(s: String?) {
val hash = s?.hashCode()
if (hash != null) {
s.length
}
}
fun kt6840_2(s: String?) {
if (s?.hashCode() != null) {
s.length
}
}
fun kt1635(s: String?) {
s?.hashCode()!!
s.hashCode()
}
fun kt2127() {
val s: String? = ""
if (s?.length != null) {
s.hashCode()
}
}
fun kt3356(s: String?): Int {
if (s?.length != 1) return 0
return s.length
}
open class SomeClass(val data: Any)
class SubClass(val extra: Any, data: Any) : SomeClass(data)
fun kt4565_1(a: SomeClass?) {
val data = a?.data
if (data != null) {
data.hashCode()
a.hashCode()
a.data.hashCode()
}
if (a?.data != null) {
// To be supported (?!)
data.hashCode()
a.hashCode()
a.data.hashCode()
}
if (a?.data is String) {
a.data.length
data.length
}
}
fun kt4565_2(a: SomeClass?) {
// To be supported
if (a as? SubClass != null) {
a.extra.hashCode()
}
val extra = (a as? SubClass)?.extra
if (extra != null) {
a.extra.hashCode()
}
}
inline fun <reified T : SomeClass> kt45345(a: SomeClass?) {
if (a?.data is T) {
a.data
}
}
inline fun <reified T : U, U : SomeClass> kt45345_2(a: SomeClass?) {
if (a?.data is T) {
a.data
}
}
inline fun <reified T : U, U : SomeClass?> kt45345_3(a: SomeClass?) {
if (a?.data is T) {
a<!UNSAFE_CALL!>.<!>data
}
}
class A(val y: Int)
fun kt7491_1() {
val x: A? = A(42)
val z = x?.y ?: return
x.y
}
fun getA(): A? = null
fun useA(a: A): Int = a.hashCode()
fun kt7491_2() {
val a = getA()
(a?.let { useA(a) } ?: a<!UNSAFE_CALL!>.<!>y ).toString()
}
fun String.correct() = true
fun kt8492(s: String?) {
if (s?.correct() ?: false) {
// To be supported
s<!UNSAFE_CALL!>.<!>length
}
}
fun kt11085(prop: String?) {
when (prop?.hashCode()) {
1 -> prop.length
}
}
class HttpExchange(val code: String)
fun kt11313(arg: HttpExchange?) {
when (arg?.code) {
"GET" -> handleGet(arg)
"POST" -> handlePost(arg)
}
}
fun handleGet(arg: HttpExchange) = arg
fun handlePost(arg: HttpExchange) = arg
class Wrapper {
fun unwrap(): String? = "Something not consistent"
}
fun falsePositive(w: Wrapper) {
if (w.unwrap() != null) {
// Here we should NOT have smart cast
w.unwrap()<!UNSAFE_CALL!>.<!>length
}
}
class Invokable(val x: String) {
operator fun invoke() = x
}
class InvokableProperty(val i: Invokable)
fun checkInvokable(ip: InvokableProperty?) {
if (ip?.i() == "Hello") {
ip.hashCode()
}
}
@@ -1,153 +0,0 @@
// !LANGUAGE: -SafeCastCheckBoundSmartCasts -BooleanElvisBoundSmartCasts
// A set of examples for
// "If the result of a safe call is not null, understand that its receiver is not null"
// and some other improvements for nullability detection
fun kt6840_1(s: String?) {
val hash = s?.hashCode()
if (hash != null) {
<!DEBUG_INFO_SMARTCAST!>s<!>.length
}
}
fun kt6840_2(s: String?) {
if (s?.hashCode() != null) {
<!DEBUG_INFO_SMARTCAST!>s<!>.length
}
}
fun kt1635(s: String?) {
s?.hashCode()!!
<!DEBUG_INFO_SMARTCAST!>s<!>.hashCode()
}
fun kt2127() {
val s: String? = ""
if (s?.length != null) {
<!DEBUG_INFO_SMARTCAST!>s<!>.hashCode()
}
}
fun kt3356(s: String?): Int {
if (s?.length != 1) return 0
return <!DEBUG_INFO_SMARTCAST!>s<!>.length
}
open class SomeClass(val data: Any)
class SubClass(val extra: Any, data: Any) : SomeClass(data)
fun kt4565_1(a: SomeClass?) {
val data = a?.data
if (data != null) {
<!DEBUG_INFO_SMARTCAST!>data<!>.hashCode()
<!DEBUG_INFO_SMARTCAST!>a<!>.hashCode()
<!DEBUG_INFO_SMARTCAST!>a<!>.data.hashCode()
}
if (a?.data != null) {
// To be supported (?!)
data<!UNSAFE_CALL!>.<!>hashCode()
<!DEBUG_INFO_SMARTCAST!>a<!>.hashCode()
<!DEBUG_INFO_SMARTCAST!>a<!>.data.hashCode()
}
if (a?.data is String) {
<!DEBUG_INFO_SMARTCAST!>a<!>.data.<!UNRESOLVED_REFERENCE!>length<!>
data.<!UNRESOLVED_REFERENCE!>length<!>
}
}
fun kt4565_2(a: SomeClass?) {
// To be supported
if (a as? SubClass != null) {
a.<!UNRESOLVED_REFERENCE!>extra<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>hashCode<!>()
}
val extra = (a as? SubClass)?.extra
if (extra != null) {
a.<!UNRESOLVED_REFERENCE!>extra<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>hashCode<!>()
}
}
inline fun <reified T : SomeClass> kt45345(a: SomeClass?) {
if (a?.data is T) {
<!DEBUG_INFO_SMARTCAST!>a<!>.data
}
}
inline fun <reified T : U, U : SomeClass> kt45345_2(a: SomeClass?) {
if (a?.data is T) {
<!DEBUG_INFO_SMARTCAST!>a<!>.data
}
}
inline fun <reified T : U, U : SomeClass?> kt45345_3(a: SomeClass?) {
if (a?.data is T) {
a<!UNSAFE_CALL!>.<!>data
}
}
class A(val y: Int)
fun kt7491_1() {
val x: A? = A(42)
val z = x?.y ?: return
<!DEBUG_INFO_SMARTCAST!>x<!>.y
}
fun getA(): A? = null
fun useA(a: A): Int = a.hashCode()
fun kt7491_2() {
val a = getA()
(a?.let { useA(<!DEBUG_INFO_SMARTCAST!>a<!>) } ?: a<!UNSAFE_CALL!>.<!>y ).toString()
}
fun String.correct() = true
fun kt8492(s: String?) {
if (s?.correct() ?: false) {
// To be supported
s<!UNSAFE_CALL!>.<!>length
}
}
fun kt11085(prop: String?) {
when (prop?.hashCode()) {
1 -> <!DEBUG_INFO_SMARTCAST!>prop<!>.length
}
}
class HttpExchange(val code: String)
fun kt11313(arg: HttpExchange?) {
when (arg?.code) {
"GET" -> handleGet(<!DEBUG_INFO_SMARTCAST!>arg<!>)
"POST" -> handlePost(<!DEBUG_INFO_SMARTCAST!>arg<!>)
}
}
fun handleGet(arg: HttpExchange) = arg
fun handlePost(arg: HttpExchange) = arg
class Wrapper {
fun unwrap(): String? = "Something not consistent"
}
fun falsePositive(w: Wrapper) {
if (w.unwrap() != null) {
// Here we should NOT have smart cast
<!SMARTCAST_IMPOSSIBLE!>w.unwrap()<!>.length
}
}
class Invokable(val x: String) {
operator fun invoke() = x
}
class InvokableProperty(val i: Invokable)
fun checkInvokable(ip: InvokableProperty?) {
if (ip?.<!UNSAFE_IMPLICIT_INVOKE_CALL!>i<!>() == "Hello") {
<!DEBUG_INFO_SMARTCAST!>ip<!>.hashCode()
}
}
@@ -1,82 +0,0 @@
package
public fun checkInvokable(/*0*/ ip: InvokableProperty?): kotlin.Unit
public fun falsePositive(/*0*/ w: Wrapper): kotlin.Unit
public fun getA(): A?
public fun handleGet(/*0*/ arg: HttpExchange): HttpExchange
public fun handlePost(/*0*/ arg: HttpExchange): HttpExchange
public fun kt11085(/*0*/ prop: kotlin.String?): kotlin.Unit
public fun kt11313(/*0*/ arg: HttpExchange?): kotlin.Unit
public fun kt1635(/*0*/ s: kotlin.String?): kotlin.Unit
public fun kt2127(): kotlin.Unit
public fun kt3356(/*0*/ s: kotlin.String?): kotlin.Int
public inline fun </*0*/ reified T : SomeClass> kt45345(/*0*/ a: SomeClass?): kotlin.Unit
public inline fun </*0*/ reified T : U, /*1*/ U : SomeClass> kt45345_2(/*0*/ a: SomeClass?): kotlin.Unit
public inline fun </*0*/ reified T : U, /*1*/ U : SomeClass?> kt45345_3(/*0*/ a: SomeClass?): kotlin.Unit
public fun kt4565_1(/*0*/ a: SomeClass?): kotlin.Unit
public fun kt4565_2(/*0*/ a: SomeClass?): kotlin.Unit
public fun kt6840_1(/*0*/ s: kotlin.String?): kotlin.Unit
public fun kt6840_2(/*0*/ s: kotlin.String?): kotlin.Unit
public fun kt7491_1(): kotlin.Unit
public fun kt7491_2(): kotlin.Unit
public fun kt8492(/*0*/ s: kotlin.String?): kotlin.Unit
public fun useA(/*0*/ a: A): kotlin.Int
public fun kotlin.String.correct(): kotlin.Boolean
public final class A {
public constructor A(/*0*/ y: kotlin.Int)
public final val y: kotlin.Int
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class HttpExchange {
public constructor HttpExchange(/*0*/ code: kotlin.String)
public final val code: kotlin.String
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class Invokable {
public constructor Invokable(/*0*/ x: kotlin.String)
public final val x: kotlin.String
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final operator fun invoke(): kotlin.String
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class InvokableProperty {
public constructor InvokableProperty(/*0*/ i: Invokable)
public final val i: Invokable
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public open class SomeClass {
public constructor SomeClass(/*0*/ data: kotlin.Any)
public final val data: kotlin.Any
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class SubClass : SomeClass {
public constructor SubClass(/*0*/ extra: kotlin.Any, /*1*/ data: kotlin.Any)
public final override /*1*/ /*fake_override*/ val data: kotlin.Any
public final val extra: kotlin.Any
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class Wrapper {
public constructor Wrapper()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public final fun unwrap(): kotlin.String?
}
@@ -1,15 +0,0 @@
// !LANGUAGE: -CapturedInClosureSmartCasts
fun run(f: () -> Unit) = f()
fun foo(s: String?) {
var x: String? = null
if (s != null) {
x = s
}
if (x != null) {
run {
x.hashCode()
}
}
}
@@ -1,15 +0,0 @@
// !LANGUAGE: -CapturedInClosureSmartCasts
fun run(f: () -> Unit) = f()
fun foo(s: String?) {
var x: String? = null
if (s != null) {
x = s
}
if (x != null) {
run {
<!SMARTCAST_IMPOSSIBLE!>x<!>.hashCode()
}
}
}
@@ -1,4 +0,0 @@
package
public fun foo(/*0*/ s: kotlin.String?): kotlin.Unit
public fun run(/*0*/ f: () -> kotlin.Unit): kotlin.Unit
@@ -1,10 +0,0 @@
// !LANGUAGE: -SoundSmartCastsAfterTry
fun foo() {
var s: String?
s = "Test"
try {
s = null
} catch (ex: Exception) {}
s<!UNSAFE_CALL!>.<!>hashCode()
}
@@ -1,10 +0,0 @@
// !LANGUAGE: -SoundSmartCastsAfterTry
fun foo() {
var s: String?
s = "Test"
try {
s = null
} catch (ex: Exception) {}
<!DEBUG_INFO_SMARTCAST!>s<!>.hashCode()
}
@@ -1,3 +0,0 @@
package
public fun foo(): kotlin.Unit