Rename: auto cast -> smart cast

This commit is contained in:
Svetlana Isakova
2014-09-29 23:09:05 +04:00
parent 20f3403c80
commit ce01c61811
294 changed files with 840 additions and 842 deletions
@@ -38,7 +38,7 @@ class C {
break;
}
}
<!DEBUG_INFO_AUTOCAST!>a<!>.compareTo("2")
<!DEBUG_INFO_SMARTCAST!>a<!>.compareTo("2")
}
fun containsBreakWithLabel(a: String?) {
@@ -52,7 +52,7 @@ class C {
@loop while(a == null) {
<!NOT_A_LOOP_LABEL!>break<!UNRESOLVED_REFERENCE!>@label<!><!>
}
<!DEBUG_INFO_AUTOCAST!>a<!>.compareTo("2")
<!DEBUG_INFO_SMARTCAST!>a<!>.compareTo("2")
}
fun containsBreakToOuterLoop(a: String?, b: String?) {
@@ -60,7 +60,7 @@ class C {
while(a == null) {
break@loop
}
<!DEBUG_INFO_AUTOCAST!>a<!>.compareTo("2")
<!DEBUG_INFO_SMARTCAST!>a<!>.compareTo("2")
}
}
@@ -135,7 +135,7 @@ class A() : BodyTag("a") {
get() = attributes["href"]
set(value) {
if (value != null) {
attributes.put("href", <!DEBUG_INFO_AUTOCAST!>value<!>)
attributes.put("href", <!DEBUG_INFO_SMARTCAST!>value<!>)
// attributes["href"] = value //doesn't work: KT-1355
}
}
@@ -4,6 +4,6 @@ fun gg() {
val a: String? = ""
if (a != null) {
ff(<!DEBUG_INFO_AUTOCAST!>a<!>)
ff(<!DEBUG_INFO_SMARTCAST!>a<!>)
}
}
@@ -5,4 +5,4 @@ package java
val c : lang.Class<*>? = null
val <T> Array<T>?.length : Int get() = if (this != null) <!DEBUG_INFO_AUTOCAST!>this<!>.size else throw NullPointerException()
val <T> Array<T>?.length : Int get() = if (this != null) <!DEBUG_INFO_SMARTCAST!>this<!>.size else throw NullPointerException()
@@ -1,7 +1,7 @@
fun test() {
val a : Int? = 0
if (a != null) {
<!DEBUG_INFO_AUTOCAST!>a<!>.plus(1)
<!DEBUG_INFO_SMARTCAST!>a<!>.plus(1)
}
else {
a?.plus(1)
@@ -14,54 +14,54 @@ fun test() {
ins?.read()
if (ins != null) {
<!DEBUG_INFO_AUTOCAST!>ins<!>.read()
<!DEBUG_INFO_SMARTCAST!>ins<!>.read()
out?.println()
if (out != null) {
<!DEBUG_INFO_AUTOCAST!>ins<!>.read();
<!DEBUG_INFO_AUTOCAST!>out<!>.println();
<!DEBUG_INFO_SMARTCAST!>ins<!>.read();
<!DEBUG_INFO_SMARTCAST!>out<!>.println();
}
}
if (out != null && ins != null) {
<!DEBUG_INFO_AUTOCAST!>ins<!>.read();
<!DEBUG_INFO_AUTOCAST!>out<!>.println();
<!DEBUG_INFO_SMARTCAST!>ins<!>.read();
<!DEBUG_INFO_SMARTCAST!>out<!>.println();
}
if (out == null) {
out?.println()
} else {
<!DEBUG_INFO_AUTOCAST!>out<!>.println()
<!DEBUG_INFO_SMARTCAST!>out<!>.println()
}
if (out != null && ins != null || out != null) {
ins?.read();
ins<!UNSAFE_CALL!>.<!>read();
<!DEBUG_INFO_AUTOCAST!>out<!>.println();
<!DEBUG_INFO_SMARTCAST!>out<!>.println();
}
if (out == null || <!DEBUG_INFO_AUTOCAST!>out<!>.println(0) == Unit) {
if (out == null || <!DEBUG_INFO_SMARTCAST!>out<!>.println(0) == Unit) {
out?.println(1)
out<!UNSAFE_CALL!>.<!>println(1)
}
else {
<!DEBUG_INFO_AUTOCAST!>out<!>.println(2)
<!DEBUG_INFO_SMARTCAST!>out<!>.println(2)
}
if (out != null && <!DEBUG_INFO_AUTOCAST!>out<!>.println() == Unit) {
<!DEBUG_INFO_AUTOCAST!>out<!>.println();
if (out != null && <!DEBUG_INFO_SMARTCAST!>out<!>.println() == Unit) {
<!DEBUG_INFO_SMARTCAST!>out<!>.println();
}
else {
out?.println();
}
if (out == null || <!DEBUG_INFO_AUTOCAST!>out<!>.println() == Unit) {
if (out == null || <!DEBUG_INFO_SMARTCAST!>out<!>.println() == Unit) {
out?.println();
}
else {
<!DEBUG_INFO_AUTOCAST!>out<!>.println();
<!DEBUG_INFO_SMARTCAST!>out<!>.println();
}
if (1 == 2 || out != null && <!DEBUG_INFO_AUTOCAST!>out<!>.println(1) == Unit) {
if (1 == 2 || out != null && <!DEBUG_INFO_SMARTCAST!>out<!>.println(1) == Unit) {
out?.println(2);
out<!UNSAFE_CALL!>.<!>println(2);
}
@@ -74,55 +74,55 @@ fun test() {
ins?.read()
if (ins != null) {
<!DEBUG_INFO_AUTOCAST!>ins<!>.read()
<!DEBUG_INFO_SMARTCAST!>ins<!>.read()
out?.println()
if (out != null) {
<!DEBUG_INFO_AUTOCAST!>ins<!>.read();
<!DEBUG_INFO_AUTOCAST!>out<!>.println();
<!DEBUG_INFO_SMARTCAST!>ins<!>.read();
<!DEBUG_INFO_SMARTCAST!>out<!>.println();
}
}
if (out != null && ins != null) {
<!DEBUG_INFO_AUTOCAST!>ins<!>.read();
<!DEBUG_INFO_AUTOCAST!>out<!>.println();
<!DEBUG_INFO_SMARTCAST!>ins<!>.read();
<!DEBUG_INFO_SMARTCAST!>out<!>.println();
}
if (out == null) {
out?.println()
} else {
<!DEBUG_INFO_AUTOCAST!>out<!>.println()
<!DEBUG_INFO_SMARTCAST!>out<!>.println()
}
if (out != null && ins != null || out != null) {
ins?.read();
<!DEBUG_INFO_AUTOCAST!>out<!>.println();
<!DEBUG_INFO_SMARTCAST!>out<!>.println();
}
if (out == null || <!DEBUG_INFO_AUTOCAST!>out<!>.println(0) == Unit) {
if (out == null || <!DEBUG_INFO_SMARTCAST!>out<!>.println(0) == Unit) {
out?.println(1)
out<!UNSAFE_CALL!>.<!>println(1)
}
else {
<!DEBUG_INFO_AUTOCAST!>out<!>.println(2)
<!DEBUG_INFO_SMARTCAST!>out<!>.println(2)
}
if (out != null && <!DEBUG_INFO_AUTOCAST!>out<!>.println() == Unit) {
<!DEBUG_INFO_AUTOCAST!>out<!>.println();
if (out != null && <!DEBUG_INFO_SMARTCAST!>out<!>.println() == Unit) {
<!DEBUG_INFO_SMARTCAST!>out<!>.println();
}
else {
out?.println();
out<!UNSAFE_CALL!>.<!>println();
}
if (out == null || <!DEBUG_INFO_AUTOCAST!>out<!>.println() == Unit) {
if (out == null || <!DEBUG_INFO_SMARTCAST!>out<!>.println() == Unit) {
out?.println();
out<!UNSAFE_CALL!>.<!>println();
}
else {
<!DEBUG_INFO_AUTOCAST!>out<!>.println();
<!DEBUG_INFO_SMARTCAST!>out<!>.println();
}
if (1 == 2 || out != null && <!DEBUG_INFO_AUTOCAST!>out<!>.println(1) == Unit) {
if (1 == 2 || out != null && <!DEBUG_INFO_SMARTCAST!>out<!>.println(1) == Unit) {
out?.println(2);
out<!UNSAFE_CALL!>.<!>println(2);
}
@@ -133,12 +133,12 @@ fun test() {
if (1 > 2) {
if (out == null) return;
<!DEBUG_INFO_AUTOCAST!>out<!>.println();
<!DEBUG_INFO_SMARTCAST!>out<!>.println();
}
out?.println();
while (out != null) {
<!DEBUG_INFO_AUTOCAST!>out<!>.println();
<!DEBUG_INFO_SMARTCAST!>out<!>.println();
}
out?.println();
@@ -148,7 +148,7 @@ fun test() {
out2?.println();
out2<!UNSAFE_CALL!>.<!>println();
}
<!DEBUG_INFO_AUTOCAST!>out2<!>.println()
<!DEBUG_INFO_SMARTCAST!>out2<!>.println()
}
@@ -157,7 +157,7 @@ fun f(out : String?) {
out?.get(0)
out<!UNSAFE_CALL!>.<!>get(0)
if (out != null) else return;
<!DEBUG_INFO_AUTOCAST!>out<!>.get(0)
<!DEBUG_INFO_SMARTCAST!>out<!>.get(0)
}
fun f1(out : String?) {
@@ -166,7 +166,7 @@ fun f1(out : String?) {
1 + 2
return;
}
<!DEBUG_INFO_AUTOCAST!>out<!>.get(0)
<!DEBUG_INFO_SMARTCAST!>out<!>.get(0)
}
fun f2(out : String?) {
@@ -175,7 +175,7 @@ fun f2(out : String?) {
1 + 2
return;
}
<!DEBUG_INFO_AUTOCAST!>out<!>.get(0)
<!DEBUG_INFO_SMARTCAST!>out<!>.get(0)
}
fun f3(out : String?) {
@@ -187,25 +187,25 @@ fun f3(out : String?) {
else {
1 + 2
}
<!DEBUG_INFO_AUTOCAST!>out<!>.get(0)
<!DEBUG_INFO_SMARTCAST!>out<!>.get(0)
}
fun f4(s : String?) {
s?.get(0)
while (1 < 2 && s != null) {
<!DEBUG_INFO_AUTOCAST!>s<!>.get(0)
<!DEBUG_INFO_SMARTCAST!>s<!>.get(0)
}
s?.get(0)
while (s == null || 1 < 2) {
s?.get(0)
}
<!DEBUG_INFO_AUTOCAST!>s<!>.get(0)
<!DEBUG_INFO_SMARTCAST!>s<!>.get(0)
}
fun f5(s : String?) {
s?.get(0)
while (1 < 2 && s != null) {
<!DEBUG_INFO_AUTOCAST!>s<!>.get(0)
<!DEBUG_INFO_SMARTCAST!>s<!>.get(0)
}
s?.get(0)
while (s == null || 1 < 2) {
@@ -225,24 +225,24 @@ fun f6(s : String?) {
do {
s?.get(0)
} while (s == null)
<!DEBUG_INFO_AUTOCAST!>s<!>.get(0)
<!DEBUG_INFO_SMARTCAST!>s<!>.get(0)
}
fun f7(s : String?, t : String?) {
s?.get(0)
if (!(s == null)) {
<!DEBUG_INFO_AUTOCAST!>s<!>.get(0)
<!DEBUG_INFO_SMARTCAST!>s<!>.get(0)
}
s?.get(0)
if (!(s != null)) {
s?.get(0)
}
else {
<!DEBUG_INFO_AUTOCAST!>s<!>.get(0)
<!DEBUG_INFO_SMARTCAST!>s<!>.get(0)
}
s?.get(0)
if (!!(s != null)) {
<!DEBUG_INFO_AUTOCAST!>s<!>.get(0)
<!DEBUG_INFO_SMARTCAST!>s<!>.get(0)
}
else {
s?.get(0)
@@ -250,8 +250,8 @@ fun f7(s : String?, t : String?) {
s?.get(0)
t?.get(0)
if (!(s == null || t == null)) {
<!DEBUG_INFO_AUTOCAST!>s<!>.get(0)
<!DEBUG_INFO_AUTOCAST!>t<!>.get(0)
<!DEBUG_INFO_SMARTCAST!>s<!>.get(0)
<!DEBUG_INFO_SMARTCAST!>t<!>.get(0)
}
else {
s?.get(0)
@@ -260,7 +260,7 @@ fun f7(s : String?, t : String?) {
s?.get(0)
t?.get(0)
if (!(s == null)) {
<!DEBUG_INFO_AUTOCAST!>s<!>.get(0)
<!DEBUG_INFO_SMARTCAST!>s<!>.get(0)
t?.get(0)
}
else {
@@ -272,22 +272,22 @@ fun f7(s : String?, t : String?) {
fun f8(b : String?, a : String) {
b?.get(0)
if (b == a) {
<!DEBUG_INFO_AUTOCAST!>b<!>.get(0);
<!DEBUG_INFO_SMARTCAST!>b<!>.get(0);
}
b?.get(0)
if (a == b) {
<!DEBUG_INFO_AUTOCAST!>b<!>.get(0)
<!DEBUG_INFO_SMARTCAST!>b<!>.get(0)
}
if (a != b) {
b?.get(0)
}
else {
<!DEBUG_INFO_AUTOCAST!>b<!>.get(0)
<!DEBUG_INFO_SMARTCAST!>b<!>.get(0)
}
}
fun f9(a : Int?) : Int {
if (a != null)
return <!DEBUG_INFO_AUTOCAST!>a<!>
return <!DEBUG_INFO_SMARTCAST!>a<!>
return 1
}
@@ -5,6 +5,6 @@ trait MutableMap<K, V>: Map<K, V> {
fun p(p: Map<String, Int>) {
if (p is MutableMap<String, Int>) {
<!DEBUG_INFO_AUTOCAST!>p<!>[""] = 1
<!DEBUG_INFO_SMARTCAST!>p<!>[""] = 1
}
}
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -DEBUG_INFO_AUTOCAST
// !DIAGNOSTICS: -DEBUG_INFO_SMARTCAST
trait Either<out A, out B>
trait Left<out A>: Either<A, Nothing> {
val value: A
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -DEBUG_INFO_AUTOCAST
// !DIAGNOSTICS: -DEBUG_INFO_SMARTCAST
trait Either<out A, out B>
trait Left<out A>: Either<A, Nothing> {
val value: A
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -DEBUG_INFO_AUTOCAST
// !DIAGNOSTICS: -DEBUG_INFO_SMARTCAST
trait Either<out A, out B>
trait Left<out A>: Either<A, Nothing> {
val value: A
@@ -1,6 +1,6 @@
fun illegalWhenBlock(a: Any): Int {
when(a) {
is Int -> return <!DEBUG_INFO_AUTOCAST!>a<!>
is String -> return <!DEBUG_INFO_AUTOCAST!>a<!>.length
is Int -> return <!DEBUG_INFO_SMARTCAST!>a<!>
is String -> return <!DEBUG_INFO_SMARTCAST!>a<!>.length
}
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
@@ -11,6 +11,6 @@ fun test(c: Coll?) {
for (x in <!ITERATOR_MISSING!>c<!>) {}
if (c != null) {
for(x in <!DEBUG_INFO_AUTOCAST!>c<!>) {}
for(x in <!DEBUG_INFO_SMARTCAST!>c<!>) {}
}
}
@@ -2,6 +2,6 @@ class C(val f : () -> Unit)
fun test(e : Any) {
if (e is C) {
(<!DEBUG_INFO_AUTOCAST!>e<!>.f)()
(<!DEBUG_INFO_SMARTCAST!>e<!>.f)()
}
}
@@ -1,13 +1,13 @@
fun f1(s: String?) {
if (s!! == "");
<!DEBUG_INFO_AUTOCAST!>s<!> : String
<!DEBUG_INFO_SMARTCAST!>s<!> : String
}
fun f2(s: Number?) {
if (s is Int);
<!TYPE_MISMATCH!>s<!> : Int
if (s as Int == 42);
<!DEBUG_INFO_AUTOCAST!>s<!> : Int
<!DEBUG_INFO_SMARTCAST!>s<!> : Int
}
fun f3(s: Number?) {
@@ -3,7 +3,7 @@ class BinOp(val operator : String) : Expr
fun test(e : Expr) {
if (e is BinOp) {
when (<!DEBUG_INFO_AUTOCAST!>e<!>.operator) {
when (<!DEBUG_INFO_SMARTCAST!>e<!>.operator) {
else -> <!UNUSED_EXPRESSION!>0<!>
}
}
@@ -4,7 +4,7 @@ fun test(x: Any, y: Int?) {
if (x !is String) return
if (y == null) return
class Local: Base(<!DEBUG_INFO_AUTOCAST!>x<!>, <!DEBUG_INFO_AUTOCAST!>y<!>) {
class Local: Base(<!DEBUG_INFO_SMARTCAST!>x<!>, <!DEBUG_INFO_SMARTCAST!>y<!>) {
}
}
@@ -1,8 +1,8 @@
fun test(x: Any) {
if (x !is String) return
class Local(s: String = <!DEBUG_INFO_AUTOCAST!>x<!>) {
fun foo(s: String = <!DEBUG_INFO_AUTOCAST!>x<!>): String = s
class Local(s: String = <!DEBUG_INFO_SMARTCAST!>x<!>) {
fun foo(s: String = <!DEBUG_INFO_SMARTCAST!>x<!>): String = s
}
}
@@ -9,8 +9,8 @@ fun test(del: Any?) {
if (del !is Del) return
class Local {
val delegatedVal by df(<!DEBUG_INFO_AUTOCAST!>del<!>)
val delegatedVal1: Int by df(<!DEBUG_INFO_AUTOCAST!>del<!>)
val delegatedVal by df(<!DEBUG_INFO_SMARTCAST!>del<!>)
val delegatedVal1: Int by df(<!DEBUG_INFO_SMARTCAST!>del<!>)
}
}
@@ -5,7 +5,7 @@ trait D {
fun test(d: Any?) {
if (d !is D) return
class Local : D by <!DEBUG_INFO_AUTOCAST!>d<!> {
class Local : D by <!DEBUG_INFO_SMARTCAST!>d<!> {
}
}
@@ -7,12 +7,12 @@ fun test(d: Any?) {
class Local {
fun f() {
<!DEBUG_INFO_AUTOCAST!>d<!>.foo()
<!DEBUG_INFO_SMARTCAST!>d<!>.foo()
}
fun f1() = <!DEBUG_INFO_AUTOCAST!>d<!>.foo()
fun f1() = <!DEBUG_INFO_SMARTCAST!>d<!>.foo()
fun f2(): String = <!DEBUG_INFO_AUTOCAST!>d<!>.foo()
fun f2(): String = <!DEBUG_INFO_SMARTCAST!>d<!>.foo()
}
}
@@ -6,8 +6,8 @@ fun test(x: Any) {
if (y !is String) return
class Local {
{
<!DEBUG_INFO_AUTOCAST!>x<!>.length
<!DEBUG_INFO_AUTOCAST!>y<!>.length
<!DEBUG_INFO_SMARTCAST!>x<!>.length
<!DEBUG_INFO_SMARTCAST!>y<!>.length
}
}
}
@@ -1,10 +1,10 @@
// KT-338 Support autocasts in nested declarations
// KT-338 Support.smartcasts in nested declarations
fun f(a: Any?) {
if (a is B) {
class C : X(<!DEBUG_INFO_AUTOCAST!>a<!>) {
class C : X(<!DEBUG_INFO_SMARTCAST!>a<!>) {
{
<!DEBUG_INFO_AUTOCAST!>a<!>.foo()
<!DEBUG_INFO_SMARTCAST!>a<!>.foo()
}
}
}
@@ -2,11 +2,11 @@ fun test(x: Any?) {
if (x !is String) return
class C {
val v = <!DEBUG_INFO_AUTOCAST!>x<!>.length
val v = <!DEBUG_INFO_SMARTCAST!>x<!>.length
val vGet: Int
get() = <!DEBUG_INFO_AUTOCAST!>x<!>.length
get() = <!DEBUG_INFO_SMARTCAST!>x<!>.length
val s: String = <!DEBUG_INFO_AUTOCAST!>x<!>
val s: String = <!DEBUG_INFO_SMARTCAST!>x<!>
}
}
@@ -1,7 +1,7 @@
fun foo(x: Any?) {
if (x is String) {
object : Base(<!DEBUG_INFO_AUTOCAST!>x<!>) {
fun bar() = <!DEBUG_INFO_AUTOCAST!>x<!>.length
object : Base(<!DEBUG_INFO_SMARTCAST!>x<!>) {
fun bar() = <!DEBUG_INFO_SMARTCAST!>x<!>.length
}
}
}
@@ -9,7 +9,7 @@ class B : A {
}
fun foo(b: B?) : Int {
if (b == null) return 0
val o = object : A by <!DEBUG_INFO_AUTOCAST!>b<!> { //no info about b not null check
val o = object : A by <!DEBUG_INFO_SMARTCAST!>b<!> { //no info about b not null check
}
return o.foo()
}
@@ -4,7 +4,7 @@ fun test(x: Any) {
class LocalOuter {
inner class Local {
{
<!DEBUG_INFO_AUTOCAST!>x<!>.length
<!DEBUG_INFO_SMARTCAST!>x<!>.length
}
}
}
@@ -2,7 +2,7 @@ open class X(val s: String)
fun f(a: String?) {
if (a != null) {
object : X(<!DEBUG_INFO_AUTOCAST!>a<!>) { // Type mismatch: inferred type is jet.String? but jet.String was expected
object : X(<!DEBUG_INFO_SMARTCAST!>a<!>) { // Type mismatch: inferred type is jet.String? but jet.String was expected
}
}
}
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -DEBUG_INFO_AUTOCAST
// !DIAGNOSTICS: -DEBUG_INFO_SMARTCAST
fun bar(x: Int): Int = x + 1
fun foo() {
@@ -4,10 +4,10 @@ fun foo() {
val x: Int? = null
val a = Array<Int>(3, {0})
if (x != null) bar(a[<!DEBUG_INFO_AUTOCAST!>x<!>]) else bar(a[<!TYPE_MISMATCH!>x<!>])
bar(a[if (x == null) 0 else <!DEBUG_INFO_AUTOCAST!>x<!>])
if (x != null) bar(a[<!DEBUG_INFO_SMARTCAST!>x<!>]) else bar(a[<!TYPE_MISMATCH!>x<!>])
bar(a[if (x == null) 0 else <!DEBUG_INFO_SMARTCAST!>x<!>])
bar(a[<!TYPE_MISMATCH!>x<!>])
"123"[<!TYPE_MISMATCH!>x<!>];
if (x != null) "123"[<!DEBUG_INFO_AUTOCAST!>x<!>];
if (x != null) "123"[<!DEBUG_INFO_SMARTCAST!>x<!>];
}
@@ -1,5 +1,5 @@
fun foo(arr: Array<out Number>): Int {
val result = (arr as Array<Int>)[0]
<!DEBUG_INFO_AUTOCAST!>arr<!> : Array<Int>
<!DEBUG_INFO_SMARTCAST!>arr<!> : Array<Int>
return result
}
@@ -4,23 +4,23 @@ trait G {
}
fun foo1(a: Int?, b: G) {
b[a!!, a<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>] = <!DEBUG_INFO_AUTOCAST!>a<!>
<!DEBUG_INFO_AUTOCAST!>a<!> : Int
b[a!!, a<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>] = <!DEBUG_INFO_SMARTCAST!>a<!>
<!DEBUG_INFO_SMARTCAST!>a<!> : Int
}
fun foo2(a: Int?, b: G) {
b[0, a!!] = <!DEBUG_INFO_AUTOCAST!>a<!>
<!DEBUG_INFO_AUTOCAST!>a<!> : Int
b[0, a!!] = <!DEBUG_INFO_SMARTCAST!>a<!>
<!DEBUG_INFO_SMARTCAST!>a<!> : Int
}
fun foo3(a: Int?, b: G) {
val r = b[a!!, <!DEBUG_INFO_AUTOCAST!>a<!>]
<!DEBUG_INFO_AUTOCAST!>a<!> : Int
val r = b[a!!, <!DEBUG_INFO_SMARTCAST!>a<!>]
<!DEBUG_INFO_SMARTCAST!>a<!> : Int
r : Int
}
fun foo4(a: Int?, b: G) {
val r = b[0, a!!]
<!DEBUG_INFO_AUTOCAST!>a<!> : Int
<!DEBUG_INFO_SMARTCAST!>a<!> : Int
r : Int
}
@@ -1,9 +1,9 @@
fun foo1(a: Int?, b: Array<Array<Int>>) {
b[a!!][a<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>] = <!DEBUG_INFO_AUTOCAST!>a<!>
<!DEBUG_INFO_AUTOCAST!>a<!> : Int
b[a!!][a<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>] = <!DEBUG_INFO_SMARTCAST!>a<!>
<!DEBUG_INFO_SMARTCAST!>a<!> : Int
}
fun foo2(a: Int?, b: Array<Array<Int>>) {
b[0][a!!] = <!DEBUG_INFO_AUTOCAST!>a<!>
<!DEBUG_INFO_AUTOCAST!>a<!> : Int
b[0][a!!] = <!DEBUG_INFO_SMARTCAST!>a<!>
<!DEBUG_INFO_SMARTCAST!>a<!> : Int
}
@@ -5,13 +5,13 @@ trait B : A {
fun bar1(a: A) {
var b: B = a as B
<!DEBUG_INFO_AUTOCAST!>a<!>.foo()
<!DEBUG_INFO_SMARTCAST!>a<!>.foo()
b.foo()
}
fun id(b: B) = b
fun bar2(a: A) {
var b: B = id(a as B)
<!DEBUG_INFO_AUTOCAST!>a<!>.foo()
<!DEBUG_INFO_SMARTCAST!>a<!>.foo()
b.foo()
}
@@ -10,12 +10,12 @@ fun baz(b: B) = b
fun bar1(a: A) {
val b = a as B
<!DEBUG_INFO_AUTOCAST!>a<!>.foo()
<!DEBUG_INFO_SMARTCAST!>a<!>.foo()
b.foo()
}
fun bar2(a: A) {
val b = baz(a as B)
<!DEBUG_INFO_AUTOCAST!>a<!>.foo()
<!DEBUG_INFO_SMARTCAST!>a<!>.foo()
b.foo()
}
@@ -1,15 +1,15 @@
fun bar1(x: Number, y: Int) {
var yy = y
yy += x as Int
<!DEBUG_INFO_AUTOCAST!>x<!> : Int
<!DEBUG_INFO_SMARTCAST!>x<!> : Int
}
fun bar2(x: Number) {
<!UNRESOLVED_REFERENCE!>y<!> <!UNRESOLVED_REFERENCE!>+=<!> x as Int
<!DEBUG_INFO_AUTOCAST!>x<!> : Int
<!DEBUG_INFO_SMARTCAST!>x<!> : Int
}
fun bar3(x: Number, y: Array<Int>) {
y[0] += x as Int
<!DEBUG_INFO_AUTOCAST!>x<!> : Int
<!DEBUG_INFO_SMARTCAST!>x<!> : Int
}
@@ -1,10 +1,10 @@
fun arrayAccessRHS(a: Int?, b: Array<Int>) {
b[0] = a!!
<!DEBUG_INFO_AUTOCAST!>a<!> : Int
<!DEBUG_INFO_SMARTCAST!>a<!> : Int
}
fun arrayAccessLHS(a: Int?, b: Array<Int>) {
b[a!!] = <!DEBUG_INFO_AUTOCAST!>a<!>
<!DEBUG_INFO_AUTOCAST!>a<!> : Int
b[a!!] = <!DEBUG_INFO_SMARTCAST!>a<!>
<!DEBUG_INFO_SMARTCAST!>a<!> : Int
}
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -DEBUG_INFO_AUTOCAST
// !DIAGNOSTICS: -DEBUG_INFO_SMARTCAST
fun bar(x: Int): Int = x + 1
fun foo() {
@@ -6,7 +6,7 @@ fun foo1(x: Number, cond: Boolean): Boolean {
fun foo2(x: Number, cond: Boolean): Boolean {
val result = ((x as Int) == 42) && cond
<!DEBUG_INFO_AUTOCAST!>x<!> : Int
<!DEBUG_INFO_SMARTCAST!>x<!> : Int
return result
}
@@ -18,6 +18,6 @@ fun foo3(x: Number, cond: Boolean): Boolean {
fun foo4(x: Number, cond: Boolean): Boolean {
val result = ((x as Int) == 42) || cond
<!DEBUG_INFO_AUTOCAST!>x<!> : Int
<!DEBUG_INFO_SMARTCAST!>x<!> : Int
return result
}
@@ -4,13 +4,13 @@ trait B : A
fun B.compareTo(b: B) = if (this == b) 0 else 1
fun foo(a: A): Boolean {
val result = (a as B) < <!DEBUG_INFO_AUTOCAST!>a<!>
<!DEBUG_INFO_AUTOCAST!>a<!> : B
val result = (a as B) < <!DEBUG_INFO_SMARTCAST!>a<!>
<!DEBUG_INFO_SMARTCAST!>a<!> : B
return result
}
fun bar(a: A, b: B): Boolean {
val result = b < (a as B)
<!DEBUG_INFO_AUTOCAST!>a<!> : B
<!DEBUG_INFO_SMARTCAST!>a<!> : B
return result
}
@@ -1,5 +1,5 @@
fun foo(x: Number): Boolean {
val result = (x as Int) in 1..5
<!DEBUG_INFO_AUTOCAST!>x<!> : Int
<!DEBUG_INFO_SMARTCAST!>x<!> : Int
return result
}
@@ -1,8 +1,8 @@
fun foo(x: Int?): Int = x!!
fun elvis(x: Number?): Int {
val result = (x as Int?) ?: foo(<!DEBUG_INFO_AUTOCAST!>x<!>)
<!DEBUG_INFO_AUTOCAST!>x<!> : Int?
val result = (x as Int?) ?: foo(<!DEBUG_INFO_SMARTCAST!>x<!>)
<!DEBUG_INFO_SMARTCAST!>x<!> : Int?
return result
}
@@ -3,12 +3,12 @@ trait B : A
fun foo1(a: A, b: B): Boolean {
val result = (a as B) == b
<!DEBUG_INFO_AUTOCAST!>a<!> : B
<!DEBUG_INFO_SMARTCAST!>a<!> : B
return result
}
fun foo2(a: A, b: B): Boolean {
val result = b == (a as B)
<!DEBUG_INFO_AUTOCAST!>a<!> : B
<!DEBUG_INFO_SMARTCAST!>a<!> : B
return result
}
@@ -1,11 +1,11 @@
fun foo(a: Number): Int {
val result = (a as Int) compareTo <!DEBUG_INFO_AUTOCAST!>a<!>
<!DEBUG_INFO_AUTOCAST!>a<!> : Int
val result = (a as Int) compareTo <!DEBUG_INFO_SMARTCAST!>a<!>
<!DEBUG_INFO_SMARTCAST!>a<!> : Int
return result
}
fun bar(a: Number): Int {
val result = 42 compareTo (a as Int)
<!DEBUG_INFO_AUTOCAST!>a<!> : Int
<!DEBUG_INFO_SMARTCAST!>a<!> : Int
return result
}
@@ -4,13 +4,13 @@ trait B : A
fun B.plus(b: B) = if (this == b) b else this
fun foo(a: A): B {
val result = (a as B) + <!DEBUG_INFO_AUTOCAST!>a<!>
<!DEBUG_INFO_AUTOCAST!>a<!> : B
val result = (a as B) + <!DEBUG_INFO_SMARTCAST!>a<!>
<!DEBUG_INFO_SMARTCAST!>a<!> : B
return result
}
fun bar(a: A, b: B): B {
val result = b + (a as B)
<!DEBUG_INFO_AUTOCAST!>a<!> : B
<!DEBUG_INFO_SMARTCAST!>a<!> : B
return result
}
@@ -1,5 +1,5 @@
fun foo(x: Int?): Boolean {
val result = ((x!! == 0) && ((<!DEBUG_INFO_AUTOCAST!>x<!> : Int) == 0))
<!DEBUG_INFO_AUTOCAST!>x<!> : Int
val result = ((x!! == 0) && ((<!DEBUG_INFO_SMARTCAST!>x<!> : Int) == 0))
<!DEBUG_INFO_SMARTCAST!>x<!> : Int
return result
}
@@ -5,7 +5,7 @@ fun whileLoop(x: Int?) {
}
<!TYPE_MISMATCH!>x<!> : Int
}
<!DEBUG_INFO_AUTOCAST!>x<!> : Int
<!DEBUG_INFO_SMARTCAST!>x<!> : Int
}
fun doWhileLoop(x: Int?) {
@@ -15,7 +15,7 @@ fun doWhileLoop(x: Int?) {
} while (x == null)
<!TYPE_MISMATCH!>x<!> : Int
}
<!DEBUG_INFO_AUTOCAST!>x<!> : Int
<!DEBUG_INFO_SMARTCAST!>x<!> : Int
}
fun whileLoopContinueInnerOuter(x: Int?) {
@@ -26,7 +26,7 @@ fun whileLoopContinueInnerOuter(x: Int?) {
}
<!TYPE_MISMATCH!>x<!> : Int
}
<!DEBUG_INFO_AUTOCAST!>x<!> : Int
<!DEBUG_INFO_SMARTCAST!>x<!> : Int
}
<!DEBUG_INFO_AUTOCAST!>x<!> : Int
<!DEBUG_INFO_SMARTCAST!>x<!> : Int
}
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -DEBUG_INFO_AUTOCAST
// !DIAGNOSTICS: -DEBUG_INFO_SMARTCAST
fun bar(x: Int) = x + 1
fun foo() {
@@ -6,7 +6,7 @@ fun foo() {
do {
bar(<!TYPE_MISMATCH!>x<!>)
} while (x == null)
bar(<!DEBUG_INFO_AUTOCAST!>x<!>)
bar(<!DEBUG_INFO_SMARTCAST!>x<!>)
val y: Int? = null
do {
@@ -4,7 +4,7 @@ fun simpleDoWhile(x: Int?, y0: Int) {
x : Int?
y++
} while (x!! == y)
<!DEBUG_INFO_AUTOCAST!>x<!> : Int
<!DEBUG_INFO_SMARTCAST!>x<!> : Int
}
fun doWhileWithBreak(x: Int?, y0: Int) {
@@ -4,6 +4,6 @@ fun foo() {
val x: Int? = null
bar(x ?: 0)
if (x != null) bar(<!USELESS_ELVIS!>x<!> ?: <!DEBUG_INFO_AUTOCAST!>x<!>)
if (x != null) bar(<!USELESS_ELVIS!>x<!> ?: <!DEBUG_INFO_SMARTCAST!>x<!>)
bar(<!TYPE_MISMATCH!>x<!>)
}
@@ -1,5 +1,3 @@
import java.util.HashMap
fun bar(x: Int): Int = x + 1
fun foo() {
@@ -9,16 +7,16 @@ fun foo() {
for (p in a) {
bar(<!TYPE_MISMATCH!>x<!>)
if (x == null) continue
bar(<!DEBUG_INFO_AUTOCAST!>x<!>)
bar(<!DEBUG_INFO_SMARTCAST!>x<!>)
for (q in a) {
bar(<!DEBUG_INFO_AUTOCAST!>x<!>)
if (<!SENSELESS_COMPARISON!>x == null<!>) bar(<!DEBUG_INFO_AUTOCAST!>x<!>)
bar(<!DEBUG_INFO_SMARTCAST!>x<!>)
if (<!SENSELESS_COMPARISON!>x == null<!>) bar(<!DEBUG_INFO_SMARTCAST!>x<!>)
}
}
for (p in a) {
bar(<!TYPE_MISMATCH!>x<!>)
if (x == null) break
bar(<!DEBUG_INFO_AUTOCAST!>x<!>)
bar(<!DEBUG_INFO_SMARTCAST!>x<!>)
}
}
@@ -1,6 +1,6 @@
fun foo(arr: Array<Int>?) {
for (x in arr!!) {
<!DEBUG_INFO_AUTOCAST!>arr<!> : Array<Int>
<!DEBUG_INFO_SMARTCAST!>arr<!> : Array<Int>
}
<!DEBUG_INFO_AUTOCAST!>arr<!> : Array<Int>
<!DEBUG_INFO_SMARTCAST!>arr<!> : Array<Int>
}
@@ -4,6 +4,6 @@ fun foo() {
val x: Int? = null
fun baz() = bar(<!TYPE_MISMATCH!>x<!>)
fun quux() = if (x != null) bar(<!DEBUG_INFO_AUTOCAST!>x<!>) else baz()
fun quuux() = bar(if (x == null) 0 else <!DEBUG_INFO_AUTOCAST!>x<!>)
fun quux() = if (x != null) bar(<!DEBUG_INFO_SMARTCAST!>x<!>) else baz()
fun quuux() = bar(if (x == null) 0 else <!DEBUG_INFO_SMARTCAST!>x<!>)
}
@@ -1,24 +1,24 @@
fun ifThen(x: Int?) {
if (x!! == 0) {
<!DEBUG_INFO_AUTOCAST!>x<!> : Int
<!DEBUG_INFO_SMARTCAST!>x<!> : Int
}
<!DEBUG_INFO_AUTOCAST!>x<!> : Int
<!DEBUG_INFO_SMARTCAST!>x<!> : Int
}
fun ifElse(x: Int?) {
if (x!! == 0) else {
<!DEBUG_INFO_AUTOCAST!>x<!> : Int
<!DEBUG_INFO_SMARTCAST!>x<!> : Int
}
<!DEBUG_INFO_AUTOCAST!>x<!> : Int
<!DEBUG_INFO_SMARTCAST!>x<!> : Int
}
fun ifThenElse(x: Int?) {
if (x!! == 0) {
<!DEBUG_INFO_AUTOCAST!>x<!> : Int
<!DEBUG_INFO_SMARTCAST!>x<!> : Int
} else {
<!DEBUG_INFO_AUTOCAST!>x<!> : Int
<!DEBUG_INFO_SMARTCAST!>x<!> : Int
}
<!DEBUG_INFO_AUTOCAST!>x<!> : Int
<!DEBUG_INFO_SMARTCAST!>x<!> : Int
}
fun ifIs(x: Int?, cond: Boolean) {
@@ -3,27 +3,27 @@ fun bar(x: Int): Int = x + 1
fun foo() {
val x: Int? = null
bar(if (x == null) 0 else <!DEBUG_INFO_AUTOCAST!>x<!>)
bar(if (x == null) 0 else <!DEBUG_INFO_SMARTCAST!>x<!>)
if (x == null) {
bar(<!TYPE_MISMATCH!>x<!>)
return
} else {
bar(<!DEBUG_INFO_AUTOCAST!>x<!>)
bar(<!DEBUG_INFO_SMARTCAST!>x<!>)
}
bar(<!DEBUG_INFO_AUTOCAST!>x<!>)
bar(<!DEBUG_INFO_SMARTCAST!>x<!>)
val y: Int? = null
if (y is Int) {
bar(<!DEBUG_INFO_AUTOCAST!>y<!>)
bar(<!DEBUG_INFO_SMARTCAST!>y<!>)
} else {
bar(<!TYPE_MISMATCH!>y<!>)
return
}
bar(<!DEBUG_INFO_AUTOCAST!>y<!>)
bar(<!DEBUG_INFO_SMARTCAST!>y<!>)
val z: Int? = null
if (z != null) bar(<!DEBUG_INFO_AUTOCAST!>z<!>)
if (z != null) bar(<!DEBUG_INFO_SMARTCAST!>z<!>)
bar(<!TYPE_MISMATCH!>z<!>)
bar(z!!)
if (<!SENSELESS_COMPARISON!>z != null<!>) bar(z<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>)
@@ -12,5 +12,5 @@ fun foo() {
if (<!SENSELESS_COMPARISON!>x == null<!>) return
2<!OVERLOAD_RESOLUTION_AMBIGUITY!>+<!><!SYNTAX!><!>
}
bar(<!DEBUG_INFO_AUTOCAST!>x<!>)
bar(<!DEBUG_INFO_SMARTCAST!>x<!>)
}
@@ -1,6 +1,6 @@
fun foo(x: Number) {
if ((x as Int) is Int) {
<!DEBUG_INFO_AUTOCAST!>x<!> : Int
<!DEBUG_INFO_SMARTCAST!>x<!> : Int
}
<!DEBUG_INFO_AUTOCAST!>x<!> : Int
<!DEBUG_INFO_SMARTCAST!>x<!> : Int
}
@@ -2,6 +2,6 @@ fun Int.component1() = "a"
fun foo(a: Number) {
val (x) = a as Int
<!DEBUG_INFO_AUTOCAST!>a<!> : Int
<!DEBUG_INFO_SMARTCAST!>a<!> : Int
x : String
}
@@ -4,7 +4,7 @@ fun foo() {
val x: Int? = null
val <!UNUSED_VARIABLE!>a<!> = object {
fun baz() = bar(if (x == null) 0 else <!DEBUG_INFO_AUTOCAST!>x<!>)
fun quux(): Int = if (x == null) <!TYPE_MISMATCH!>x<!> else <!DEBUG_INFO_AUTOCAST!>x<!>
fun baz() = bar(if (x == null) 0 else <!DEBUG_INFO_SMARTCAST!>x<!>)
fun quux(): Int = if (x == null) <!TYPE_MISMATCH!>x<!> else <!DEBUG_INFO_SMARTCAST!>x<!>
}
}
@@ -9,5 +9,5 @@ fun foo() {
A().bar(<!TYPE_MISMATCH!>x<!>)
if (x == null) return
A().bar(<!DEBUG_INFO_AUTOCAST!>x<!>)
A().bar(<!DEBUG_INFO_SMARTCAST!>x<!>)
}
@@ -1,4 +1,4 @@
// !DIAGNOSTICS: -DEBUG_INFO_AUTOCAST
// !DIAGNOSTICS: -DEBUG_INFO_SMARTCAST
fun bar(x: Int): Int = x + 1
fun foo(): Int {
@@ -1,6 +1,6 @@
fun foo(x: Number, y: String?): String {
val result = "abcde $x ${x as Int} ${y!!} $x $y"
<!DEBUG_INFO_AUTOCAST!>x<!> : Int
<!DEBUG_INFO_AUTOCAST!>y<!> : String
<!DEBUG_INFO_SMARTCAST!>x<!> : Int
<!DEBUG_INFO_SMARTCAST!>y<!> : String
return result
}
@@ -11,11 +11,11 @@ class Derived : Base() {
super.bar(<!TYPE_MISMATCH!>x<!>)
this.baz(<!TYPE_MISMATCH!>x<!>)
if (x == null) return
super.bar(<!DEBUG_INFO_AUTOCAST!>x<!>)
this.baz(<!DEBUG_INFO_AUTOCAST!>x<!>)
super.bar(<!DEBUG_INFO_SMARTCAST!>x<!>)
this.baz(<!DEBUG_INFO_SMARTCAST!>x<!>)
val y: Int? = null
if (y != null) super.bar(this.baz(<!DEBUG_INFO_AUTOCAST!>y<!>))
if (y != null) super.bar(this.baz(<!DEBUG_INFO_SMARTCAST!>y<!>))
else this.baz(super.bar(<!TYPE_MISMATCH!>y<!>))
}
}
@@ -4,6 +4,6 @@ fun foo() {
val x: Int? = null
if (x == null) throw bar(<!TYPE_MISMATCH!>x<!>)
throw bar(<!DEBUG_INFO_AUTOCAST!>x<!>)
<!UNREACHABLE_CODE!>throw bar(<!DEBUG_INFO_AUTOCAST!>x<!>)<!>
throw bar(<!DEBUG_INFO_SMARTCAST!>x<!>)
<!UNREACHABLE_CODE!>throw bar(<!DEBUG_INFO_SMARTCAST!>x<!>)<!>
}
@@ -6,10 +6,10 @@ fun foo() {
bar(<!TYPE_MISMATCH!>x<!>)
if (x == null) return
try {
bar(<!DEBUG_INFO_AUTOCAST!>x<!>)
bar(<!DEBUG_INFO_SMARTCAST!>x<!>)
}
catch (e: Exception) {
bar(<!DEBUG_INFO_AUTOCAST!>x<!>)
bar(<!DEBUG_INFO_SMARTCAST!>x<!>)
}
bar(<!DEBUG_INFO_AUTOCAST!>x<!>)
bar(<!DEBUG_INFO_SMARTCAST!>x<!>)
}
@@ -3,7 +3,7 @@ fun tryFinally(x: Int?) {
} finally {
x!!
}
<!DEBUG_INFO_AUTOCAST!>x<!> : Int
<!DEBUG_INFO_SMARTCAST!>x<!> : Int
}
fun tryCatchFinally(x: Int?) {
@@ -15,5 +15,5 @@ fun tryCatchFinally(x: Int?) {
<!TYPE_MISMATCH!>x<!> : Int
x!!
}
<!DEBUG_INFO_AUTOCAST!>x<!> : Int
<!DEBUG_INFO_SMARTCAST!>x<!> : Int
}
@@ -5,10 +5,10 @@ fun foo() {
val x: Int? = null
bar(<!UNSAFE_CALL!>-<!>x)
if (x != null) bar(-<!DEBUG_INFO_AUTOCAST!>x<!>)
if (x != null) bar(-<!DEBUG_INFO_SMARTCAST!>x<!>)
bar(<!UNSAFE_CALL!>-<!>x)
val b: Boolean? = null
baz(<!UNSAFE_CALL!>!<!>b)
if (b != null) baz(!<!DEBUG_INFO_AUTOCAST!>b<!>)
if (b != null) baz(!<!DEBUG_INFO_SMARTCAST!>b<!>)
}
@@ -5,7 +5,7 @@ fun foo() {
if (x != null) {
when (x) {
0 -> bar(<!DEBUG_INFO_AUTOCAST!>x<!>)
0 -> bar(<!DEBUG_INFO_SMARTCAST!>x<!>)
else -> {}
}
}
@@ -14,5 +14,5 @@ fun foo() {
0 -> { if (<!SENSELESS_COMPARISON!>x == null<!>) return }
else -> { if (x == null) return }
}
bar(<!DEBUG_INFO_AUTOCAST!>x<!>)
bar(<!DEBUG_INFO_SMARTCAST!>x<!>)
}
@@ -1,24 +1,24 @@
fun foo(x: Number, y: Int) {
when (x) {
x as Int -> <!DEBUG_INFO_AUTOCAST!>x<!> : Int
x as Int -> <!DEBUG_INFO_SMARTCAST!>x<!> : Int
y -> {}
else -> {}
}
<!DEBUG_INFO_AUTOCAST!>x<!> : Int
<!DEBUG_INFO_SMARTCAST!>x<!> : Int
}
fun bar(x: Number) {
when (x) {
x as Int -> <!DEBUG_INFO_AUTOCAST!>x<!> : Int
x as Int -> <!DEBUG_INFO_SMARTCAST!>x<!> : Int
else -> {}
}
<!DEBUG_INFO_AUTOCAST!>x<!> : Int
<!DEBUG_INFO_SMARTCAST!>x<!> : Int
}
fun whenWithoutSubject(x: Number) {
when {
(x as Int) == 42 -> <!DEBUG_INFO_AUTOCAST!>x<!> : Int
(x as Int) == 42 -> <!DEBUG_INFO_SMARTCAST!>x<!> : Int
else -> {}
}
<!DEBUG_INFO_AUTOCAST!>x<!> : Int
<!DEBUG_INFO_SMARTCAST!>x<!> : Int
}
@@ -1,6 +1,6 @@
fun foo(x: Number, y: Int) {
when (x) {
is Int -> <!DEBUG_INFO_AUTOCAST!>x<!> : Int
is Int -> <!DEBUG_INFO_SMARTCAST!>x<!> : Int
y -> {}
else -> {}
}
@@ -9,7 +9,7 @@ fun foo(x: Number, y: Int) {
fun bar(x: Number) {
when (x) {
is Int -> <!DEBUG_INFO_AUTOCAST!>x<!> : Int
is Int -> <!DEBUG_INFO_SMARTCAST!>x<!> : Int
else -> {}
}
<!TYPE_MISMATCH!>x<!> : Int
@@ -17,7 +17,7 @@ fun bar(x: Number) {
fun whenWithoutSubject(x: Number) {
when {
(x is Int) -> <!DEBUG_INFO_AUTOCAST!>x<!> : Int
(x is Int) -> <!DEBUG_INFO_SMARTCAST!>x<!> : Int
else -> {}
}
<!TYPE_MISMATCH!>x<!> : Int
@@ -1,13 +1,13 @@
fun foo(x: Int, list: List<Int>?) {
when (x) {
in list!! -> <!DEBUG_INFO_AUTOCAST!>list<!> : List<Int>
in list!! -> <!DEBUG_INFO_SMARTCAST!>list<!> : List<Int>
else -> {}
}
}
fun whenWithoutSubject(x: Int, list: List<Int>?) {
when {
x in list!! -> <!DEBUG_INFO_AUTOCAST!>list<!> : List<Int>
x in list!! -> <!DEBUG_INFO_SMARTCAST!>list<!> : List<Int>
else -> {}
}
}
@@ -1,6 +1,6 @@
fun foo(x: Number) {
when (x as Int) {
else -> <!DEBUG_INFO_AUTOCAST!>x<!> : Int
else -> <!DEBUG_INFO_SMARTCAST!>x<!> : Int
}
<!DEBUG_INFO_AUTOCAST!>x<!> : Int
<!DEBUG_INFO_SMARTCAST!>x<!> : Int
}
@@ -5,11 +5,11 @@ fun foo() {
while (x == null) {
bar(<!TYPE_MISMATCH!>x<!>)
}
bar(<!DEBUG_INFO_AUTOCAST!>x<!>)
bar(<!DEBUG_INFO_SMARTCAST!>x<!>)
val y: Int? = null
while (y != null) {
bar(<!DEBUG_INFO_AUTOCAST!>y<!>)
bar(<!DEBUG_INFO_SMARTCAST!>y<!>)
}
bar(<!TYPE_MISMATCH!>y<!>)
@@ -1,19 +1,19 @@
fun simpleWhile(x: Int?, y0: Int) {
var y = y0
while (x!! == y) {
<!DEBUG_INFO_AUTOCAST!>x<!> : Int
<!DEBUG_INFO_SMARTCAST!>x<!> : Int
y++
}
<!DEBUG_INFO_AUTOCAST!>x<!> : Int
<!DEBUG_INFO_SMARTCAST!>x<!> : Int
}
fun whileWithBreak(x: Int?, y0: Int) {
var y = y0
while (x!! == y) {
<!DEBUG_INFO_AUTOCAST!>x<!> : Int
<!DEBUG_INFO_SMARTCAST!>x<!> : Int
break
}
<!DEBUG_INFO_AUTOCAST!>x<!> : Int
<!DEBUG_INFO_SMARTCAST!>x<!> : Int
}
fun whileWithNoCondition(x: Int?) {
@@ -1,9 +1,9 @@
//KT-4332 when/autocast underperforms
//KT-4332 when/smartcast underperforms
fun testWhen(t: String?, x: String?): Int {
return when {
t == null -> 0
x == null -> <!DEBUG_INFO_AUTOCAST!>t<!>.length // Wrong error report here. t can be inferred as not-null. (And it actually does if you replace when with if/else if)
else -> (<!DEBUG_INFO_AUTOCAST!>t<!> + x).length
x == null -> <!DEBUG_INFO_SMARTCAST!>t<!>.length // Wrong error report here. t can be inferred as not-null. (And it actually does if you replace when with if/else if)
else -> (<!DEBUG_INFO_SMARTCAST!>t<!> + x).length
}
}
@@ -3,7 +3,7 @@
fun foo(s: String?) {
when {
s == null -> <!UNUSED_EXPRESSION!>1<!>
<!DEBUG_INFO_AUTOCAST!>s<!>.foo() -> <!UNUSED_EXPRESSION!>2<!>
<!DEBUG_INFO_SMARTCAST!>s<!>.foo() -> <!UNUSED_EXPRESSION!>2<!>
else -> <!UNUSED_EXPRESSION!>3<!>
}
}
@@ -8,6 +8,6 @@ class B: A() {
fun foo(a: A) = when {
a !is B -> 2
true -> <!DEBUG_INFO_AUTOCAST!>a<!>.foo() //'foo' is unresolved, smart cast doesn't work
else -> <!DEBUG_INFO_AUTOCAST!>a<!>.foo()
true -> <!DEBUG_INFO_SMARTCAST!>a<!>.foo() //'foo' is unresolved, smart cast doesn't work
else -> <!DEBUG_INFO_SMARTCAST!>a<!>.foo()
}
@@ -15,4 +15,4 @@ internal final class C {
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
}
}
@@ -20,53 +20,53 @@ val x : Any? = 1
fun Any?.vars(<!UNUSED_PARAMETER!>a<!>: Any?) : Int {
var <!ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE!>b<!>: Int = 0
if (ns.y is Int) {
b = <!UNUSED_VALUE, DEBUG_INFO_AUTOCAST!>ns.y<!>
b = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>ns.y<!>
}
if (ns.y is Int) {
b = <!UNUSED_VALUE, DEBUG_INFO_AUTOCAST!>example.ns.y<!>
b = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>example.ns.y<!>
}
if (example.ns.y is Int) {
b = <!UNUSED_VALUE, DEBUG_INFO_AUTOCAST!>ns.y<!>
b = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>ns.y<!>
}
if (example.ns.y is Int) {
b = <!UNUSED_VALUE, DEBUG_INFO_AUTOCAST!>example.ns.y<!>
b = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>example.ns.y<!>
}
// if (package.bottles.ns.y is Int) {
// b = ns.y
// }
if (Obj.y is Int) {
b = <!UNUSED_VALUE, DEBUG_INFO_AUTOCAST!>Obj.y<!>
b = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>Obj.y<!>
}
if (example.Obj.y is Int) {
b = <!UNUSED_VALUE, DEBUG_INFO_AUTOCAST!>Obj.y<!>
b = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>Obj.y<!>
}
if (AClass.y is Int) {
b = <!UNUSED_VALUE, DEBUG_INFO_AUTOCAST!>AClass.y<!>
b = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>AClass.y<!>
}
if (example.AClass.y is Int) {
b = <!UNUSED_VALUE, DEBUG_INFO_AUTOCAST!>AClass.y<!>
b = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>AClass.y<!>
}
if (x is Int) {
b = <!UNUSED_VALUE, DEBUG_INFO_AUTOCAST!>x<!>
b = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>x<!>
}
if (example.x is Int) {
b = <!UNUSED_VALUE, DEBUG_INFO_AUTOCAST!>x<!>
b = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>x<!>
}
if (example.x is Int) {
b = <!UNUSED_VALUE, DEBUG_INFO_AUTOCAST!>example.x<!>
b = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>example.x<!>
}
return 1
}
fun Any?.foo() : Int {
if (this is Int)
return <!DEBUG_INFO_AUTOCAST!>this<!>
return <!DEBUG_INFO_SMARTCAST!>this<!>
if (this@foo is Int)
return <!DEBUG_INFO_AUTOCAST!>this<!>
return <!DEBUG_INFO_SMARTCAST!>this<!>
if (this@foo is Int)
return <!DEBUG_INFO_AUTOCAST!>this@foo<!>
return <!DEBUG_INFO_SMARTCAST!>this@foo<!>
if (this is Int)
return <!DEBUG_INFO_AUTOCAST!>this@foo<!>
return <!DEBUG_INFO_SMARTCAST!>this@foo<!>
return 1
}
@@ -77,16 +77,16 @@ open class C {
fun foo() {
var <!ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE!>t<!> : T? = null
if (this is T) {
t = <!UNUSED_VALUE, DEBUG_INFO_AUTOCAST!>this<!>
t = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>this<!>
}
if (this is T) {
t = <!UNUSED_VALUE, DEBUG_INFO_AUTOCAST!>this@C<!>
t = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>this@C<!>
}
if (this@C is T) {
t = <!UNUSED_VALUE, DEBUG_INFO_AUTOCAST!>this<!>
t = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>this<!>
}
if (this@C is T) {
t = <!UNUSED_VALUE, DEBUG_INFO_AUTOCAST!>this@C<!>
t = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>this@C<!>
}
}
}
@@ -53,4 +53,4 @@ package example {
package example.ns {
internal val y: kotlin.Any? = 2
}
}
}
@@ -5,10 +5,10 @@ class A {
fun a(aa : A?, b : Any) {
if (aa != null) {
val (<!UNUSED_VARIABLE!>a1<!>, <!UNUSED_VARIABLE!>b1<!>) = <!DEBUG_INFO_AUTOCAST!>aa<!>;
val (<!UNUSED_VARIABLE!>a1<!>, <!UNUSED_VARIABLE!>b1<!>) = <!DEBUG_INFO_SMARTCAST!>aa<!>;
}
if (b is A) {
val (<!UNUSED_VARIABLE!>a1<!>, <!UNUSED_VARIABLE!>b1<!>) = <!DEBUG_INFO_AUTOCAST!>b<!>;
val (<!UNUSED_VARIABLE!>a1<!>, <!UNUSED_VARIABLE!>b1<!>) = <!DEBUG_INFO_SMARTCAST!>b<!>;
}
}
@@ -2,10 +2,10 @@ package m
fun test(i: Int?) {
if (i != null) {
foo(@l1 <!DEBUG_INFO_AUTOCAST!>i<!>)
foo((<!DEBUG_INFO_AUTOCAST!>i<!>))
foo(@l2 (<!DEBUG_INFO_AUTOCAST!>i<!>))
foo((@l3 <!DEBUG_INFO_AUTOCAST!>i<!>))
foo(@l1 <!DEBUG_INFO_SMARTCAST!>i<!>)
foo((<!DEBUG_INFO_SMARTCAST!>i<!>))
foo(@l2 (<!DEBUG_INFO_SMARTCAST!>i<!>))
foo((@l3 <!DEBUG_INFO_SMARTCAST!>i<!>))
}
val a: Int = @l4 <!TYPE_MISMATCH!>""<!>
@@ -5,4 +5,4 @@ val y: Any? = 2
// FILE: b.kt
package example
val x: Int = if (ns.y is Int) <!DEBUG_INFO_AUTOCAST!>ns.y<!> else 2
val x: Int = if (ns.y is Int) <!DEBUG_INFO_SMARTCAST!>ns.y<!> else 2
@@ -3,10 +3,10 @@
import java.io.*
inline val InputStream.buffered : BufferedInputStream
get() = if(this is BufferedInputStream) <!DEBUG_INFO_AUTOCAST!>this<!> else BufferedInputStream(this)
get() = if(this is BufferedInputStream) <!DEBUG_INFO_SMARTCAST!>this<!> else BufferedInputStream(this)
inline val Reader.buffered : BufferedReader
get() = if(this is BufferedReader) <!DEBUG_INFO_AUTOCAST!>this<!> else BufferedReader(this)
get() = if(this is BufferedReader) <!DEBUG_INFO_SMARTCAST!>this<!> else BufferedReader(this)
//more tests
@@ -1,10 +1,9 @@
// !DIAGNOSTICS: -DEBUG_INFO_AUTOCAST
// !DIAGNOSTICS: -DEBUG_INFO_SMARTCAST
package a
import java.util.Date
import java.util.Comparator
fun foo() {
val <!UNUSED_VARIABLE!>c<!>: Comparator<Date?> = comparator {(date1, date2) ->
@@ -1,4 +1,4 @@
//KT-1358 Overload resolution ambiguity with autocast and generic function
//KT-1358 Overload resolution ambiguity with smartcast and generic function
package d
fun bar(a: Any?) {
@@ -11,8 +11,8 @@ fun f9(init : A?) {
a?.foo()
a?.<!UNRESOLVED_REFERENCE!>bar<!>()
if (a is B) {
<!DEBUG_INFO_AUTOCAST!>a<!>.bar()
<!DEBUG_INFO_AUTOCAST!>a<!>.foo()
<!DEBUG_INFO_SMARTCAST!>a<!>.bar()
<!DEBUG_INFO_SMARTCAST!>a<!>.foo()
}
a?.foo()
a?.<!UNRESOLVED_REFERENCE!>bar<!>()
@@ -20,14 +20,14 @@ fun f9(init : A?) {
a?.<!UNRESOLVED_REFERENCE!>bar<!>()
a?.foo()
}
if (!(a is B) || <!DEBUG_INFO_AUTOCAST!>a<!>.bar() == Unit) {
if (!(a is B) || <!DEBUG_INFO_SMARTCAST!>a<!>.bar() == Unit) {
a?.<!UNRESOLVED_REFERENCE!>bar<!>()
}
if (!(a is B)) {
return;
}
<!DEBUG_INFO_AUTOCAST!>a<!>.bar()
<!DEBUG_INFO_AUTOCAST!>a<!>.foo()
<!DEBUG_INFO_SMARTCAST!>a<!>.bar()
<!DEBUG_INFO_SMARTCAST!>a<!>.foo()
}
fun f10(init : A?) {
@@ -48,15 +48,15 @@ class C() : A() {
fun f101(a : A?) {
if (a is C) {
<!DEBUG_INFO_AUTOCAST!>a<!>.bar();
<!DEBUG_INFO_SMARTCAST!>a<!>.bar();
}
}
fun f11(a : A?) {
when (a) {
is B -> <!DEBUG_INFO_AUTOCAST!>a<!>.bar()
is A -> <!DEBUG_INFO_AUTOCAST!>a<!>.foo()
is Any -> <!DEBUG_INFO_AUTOCAST!>a<!>.foo()
is B -> <!DEBUG_INFO_SMARTCAST!>a<!>.bar()
is A -> <!DEBUG_INFO_SMARTCAST!>a<!>.foo()
is Any -> <!DEBUG_INFO_SMARTCAST!>a<!>.foo()
is Any? -> a.<!UNRESOLVED_REFERENCE!>bar<!>()
else -> a?.foo()
}
@@ -64,11 +64,11 @@ fun f11(a : A?) {
fun f12(a : A?) {
when (a) {
is B -> <!DEBUG_INFO_AUTOCAST!>a<!>.bar()
is A -> <!DEBUG_INFO_AUTOCAST!>a<!>.foo()
is Any -> <!DEBUG_INFO_AUTOCAST!>a<!>.foo();
is B -> <!DEBUG_INFO_SMARTCAST!>a<!>.bar()
is A -> <!DEBUG_INFO_SMARTCAST!>a<!>.foo()
is Any -> <!DEBUG_INFO_SMARTCAST!>a<!>.foo();
is Any? -> a.<!UNRESOLVED_REFERENCE!>bar<!>()
is C -> <!DEBUG_INFO_AUTOCAST!>a<!>.bar()
is C -> <!DEBUG_INFO_SMARTCAST!>a<!>.bar()
else -> a?.foo()
}
@@ -76,15 +76,15 @@ fun f12(a : A?) {
a?.<!UNRESOLVED_REFERENCE!>bar<!>()
}
if (a is B) {
<!DEBUG_INFO_AUTOCAST!>a<!>.foo()
<!DEBUG_INFO_AUTOCAST!>a<!>.bar()
<!DEBUG_INFO_SMARTCAST!>a<!>.foo()
<!DEBUG_INFO_SMARTCAST!>a<!>.bar()
}
}
fun f13(a : A?) {
if (a is B) {
<!DEBUG_INFO_AUTOCAST!>a<!>.foo()
<!DEBUG_INFO_AUTOCAST!>a<!>.bar()
<!DEBUG_INFO_SMARTCAST!>a<!>.foo()
<!DEBUG_INFO_SMARTCAST!>a<!>.bar()
}
else {
a?.foo()
@@ -97,14 +97,14 @@ fun f13(a : A?) {
<!UNRESOLVED_REFERENCE!>c<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>bar<!>()
}
else {
<!DEBUG_INFO_AUTOCAST!>a<!>.foo()
<!DEBUG_INFO_SMARTCAST!>a<!>.foo()
<!UNRESOLVED_REFERENCE!>c<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>bar<!>()
}
a?.foo()
if (a is B && <!DEBUG_INFO_AUTOCAST!>a<!>.foo() == Unit) {
<!DEBUG_INFO_AUTOCAST!>a<!>.foo()
<!DEBUG_INFO_AUTOCAST!>a<!>.bar()
if (a is B && <!DEBUG_INFO_SMARTCAST!>a<!>.foo() == Unit) {
<!DEBUG_INFO_SMARTCAST!>a<!>.foo()
<!DEBUG_INFO_SMARTCAST!>a<!>.bar()
}
else {
a?.foo()
@@ -120,70 +120,70 @@ fun f13(a : A?) {
}
if (!(a is B)) return
<!DEBUG_INFO_AUTOCAST!>a<!>.bar()
<!DEBUG_INFO_SMARTCAST!>a<!>.bar()
}
fun f14(a : A?) {
while (!(a is B)) {
}
<!DEBUG_INFO_AUTOCAST!>a<!>.bar()
<!DEBUG_INFO_SMARTCAST!>a<!>.bar()
}
fun f15(a : A?) {
do {
} while (!(a is B))
<!DEBUG_INFO_AUTOCAST!>a<!>.bar()
<!DEBUG_INFO_SMARTCAST!>a<!>.bar()
}
fun getStringLength(obj : Any) : Char? {
if (obj !is String)
return null
return <!DEBUG_INFO_AUTOCAST!>obj<!>.get(0) // no cast to String is needed
return <!DEBUG_INFO_SMARTCAST!>obj<!>.get(0) // no cast to String is needed
}
fun toInt(i: Int?): Int = if (i != null) <!DEBUG_INFO_AUTOCAST!>i<!> else 0
fun toInt(i: Int?): Int = if (i != null) <!DEBUG_INFO_SMARTCAST!>i<!> else 0
fun illegalWhenBody(a: Any): Int = <!NO_ELSE_IN_WHEN!>when<!>(a) {
is Int -> <!DEBUG_INFO_AUTOCAST!>a<!>
is Int -> <!DEBUG_INFO_SMARTCAST!>a<!>
is String -> <!TYPE_MISMATCH!>a<!>
}
fun illegalWhenBlock(a: Any): Int {
when(a) {
is Int -> return <!DEBUG_INFO_AUTOCAST!>a<!>
is Int -> return <!DEBUG_INFO_SMARTCAST!>a<!>
is String -> return <!TYPE_MISMATCH!>a<!>
}
<!NO_RETURN_IN_FUNCTION_WITH_BLOCK_BODY!>}<!>
fun declarations(a: Any?) {
if (a is String) {
val <!UNUSED_VARIABLE!>p4<!>: String = <!DEBUG_INFO_AUTOCAST!>a<!>
val <!UNUSED_VARIABLE!>p4<!>: String = <!DEBUG_INFO_SMARTCAST!>a<!>
}
if (a is String?) {
if (a != null) {
val <!UNUSED_VARIABLE!>s<!>: String = <!DEBUG_INFO_AUTOCAST!>a<!>
val <!UNUSED_VARIABLE!>s<!>: String = <!DEBUG_INFO_SMARTCAST!>a<!>
}
}
if (a != null) {
if (a is String?) {
val <!UNUSED_VARIABLE!>s<!>: String = <!DEBUG_INFO_AUTOCAST!>a<!>
val <!UNUSED_VARIABLE!>s<!>: String = <!DEBUG_INFO_SMARTCAST!>a<!>
}
}
}
fun vars(a: Any?) {
var <!ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE!>b<!>: Int = 0
if (a is Int) {
b = <!UNUSED_VALUE, DEBUG_INFO_AUTOCAST!>a<!>
b = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>a<!>
}
}
fun returnFunctionLiteralBlock(a: Any?): Function0<Int> {
if (a is Int) return { <!DEBUG_INFO_AUTOCAST!>a<!> }
if (a is Int) return { <!DEBUG_INFO_SMARTCAST!>a<!> }
else return { 1 }
}
fun returnFunctionLiteral(a: Any?): Function0<Int> =
if (a is Int) { (): Int -> <!DEBUG_INFO_AUTOCAST!>a<!> }
if (a is Int) { (): Int -> <!DEBUG_INFO_SMARTCAST!>a<!> }
else { () -> 1 }
fun mergeAutocasts(a: Any?) {
fun mergeSmartCasts(a: Any?) {
if (a is String || a is Int) {
a.<!UNRESOLVED_REFERENCE!>compareTo<!>("")
<!DEBUG_INFO_AUTOCAST!>a<!>.toString()
<!DEBUG_INFO_SMARTCAST!>a<!>.toString()
}
if (a is Int || a is String) {
a.<!UNRESOLVED_REFERENCE!>compareTo<!>("")
@@ -192,9 +192,9 @@ fun mergeAutocasts(a: Any?) {
is String, is Any -> a.<!UNRESOLVED_REFERENCE!>compareTo<!>("")
}
if (a is String && a is Any) {
val <!UNUSED_VARIABLE!>i<!>: Int = <!DEBUG_INFO_AUTOCAST!>a<!>.compareTo("")
val <!UNUSED_VARIABLE!>i<!>: Int = <!DEBUG_INFO_SMARTCAST!>a<!>.compareTo("")
}
if (a is String && <!DEBUG_INFO_AUTOCAST!>a<!>.compareTo("") == 0) {}
if (a is String && <!DEBUG_INFO_SMARTCAST!>a<!>.compareTo("") == 0) {}
if (a is String || a.<!UNRESOLVED_REFERENCE!>compareTo<!>("") <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>==<!> 0) {}
}
@@ -202,10 +202,10 @@ fun mergeAutocasts(a: Any?) {
fun f(): String {
var a: Any = 11
if (a is String) {
val <!UNUSED_VARIABLE!>i<!>: String = <!AUTOCAST_IMPOSSIBLE!>a<!>
<!AUTOCAST_IMPOSSIBLE!>a<!>.compareTo("f")
val <!UNUSED_VARIABLE!>f<!>: Function0<String> = { <!AUTOCAST_IMPOSSIBLE!>a<!> }
return <!AUTOCAST_IMPOSSIBLE!>a<!>
val <!UNUSED_VARIABLE!>i<!>: String = <!SMARTCAST_IMPOSSIBLE!>a<!>
<!SMARTCAST_IMPOSSIBLE!>a<!>.compareTo("f")
val <!UNUSED_VARIABLE!>f<!>: Function0<String> = { <!SMARTCAST_IMPOSSIBLE!>a<!> }
return <!SMARTCAST_IMPOSSIBLE!>a<!>
}
return ""
}
@@ -213,7 +213,7 @@ fun f(): String {
fun foo(aa: Any): Int {
var a = aa
if (a is Int) {
return <!AUTOCAST_IMPOSSIBLE!>a<!>
return <!SMARTCAST_IMPOSSIBLE!>a<!>
}
return 1
}
@@ -14,7 +14,7 @@ internal fun foo(/*0*/ aa: kotlin.Any): kotlin.Int
internal fun getStringLength(/*0*/ obj: kotlin.Any): kotlin.Char?
internal fun illegalWhenBlock(/*0*/ a: kotlin.Any): kotlin.Int
internal fun illegalWhenBody(/*0*/ a: kotlin.Any): kotlin.Int
internal fun mergeAutocasts(/*0*/ a: kotlin.Any?): kotlin.Unit
internal fun mergeSmartCasts(/*0*/ a: kotlin.Any?): kotlin.Unit
internal fun returnFunctionLiteral(/*0*/ a: kotlin.Any?): () -> kotlin.Int
internal fun returnFunctionLiteralBlock(/*0*/ a: kotlin.Any?): () -> kotlin.Int
internal fun toInt(/*0*/ i: kotlin.Int?): kotlin.Int
@@ -44,4 +44,4 @@ internal final class C : A {
internal final override /*1*/ /*fake_override*/ fun foo(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
}
@@ -9,7 +9,7 @@ fun bar(any: Any): <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>java.lang.Iterable<Int><!>
val <!UNUSED_VARIABLE!>c<!> : <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>Iterator<String><!>? = null
if (any is <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>Iterator<*><!>) {
<!DEBUG_INFO_AUTOCAST!>any<!> : <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>Iterator<*><!>
<!DEBUG_INFO_SMARTCAST!>any<!> : <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>Iterator<*><!>
}
any as <!PLATFORM_CLASS_MAPPED_TO_KOTLIN!>Iterator<*><!>
return null
@@ -4,7 +4,7 @@ fun test() {
val ints = Array<Int?>(2, { null })
ints.forEach @lit {
if (it == null) <!RETURN_NOT_ALLOWED_EXPLICIT_RETURN_TYPE_REQUIRED!>return @lit<!>
use(<!DEBUG_INFO_AUTOCAST!>it<!> + 5)
use(<!DEBUG_INFO_SMARTCAST!>it<!> + 5)
}
}
@@ -4,7 +4,7 @@ fun test() {
val <!UNUSED_VARIABLE!>a<!> = @a{(Int?).() ->
if (this != null) {
val <!UNUSED_VARIABLE!>b<!> = {String.() ->
<!DEBUG_INFO_AUTOCAST!>this@a<!>.times(5) // @a Unresolved
<!DEBUG_INFO_SMARTCAST!>this@a<!>.times(5) // @a Unresolved
}
}
}
@@ -31,6 +31,6 @@ import p.*
fun test(b: B<String>?) {
if (b is C) {
<!DEBUG_INFO_AUTOCAST!>b<!>?.foo("")
<!DEBUG_INFO_SMARTCAST!>b<!>?.foo("")
}
}
@@ -33,6 +33,6 @@ import p.*
fun test(b: B<Tr>?) {
if (b is C) {
<!DEBUG_INFO_AUTOCAST!>b<!>?.foo(null)
<!DEBUG_INFO_SMARTCAST!>b<!>?.foo(null)
}
}
@@ -31,6 +31,6 @@ import p.*
fun <Y> test(b: B<Y>?, y: Y) {
if (b is C) {
<!DEBUG_INFO_AUTOCAST!>b<!>?.foo(y)
<!DEBUG_INFO_SMARTCAST!>b<!>?.foo(y)
}
}
@@ -31,6 +31,6 @@ import p.*
fun test(b: B<String>?) {
if (b is C) {
<!DEBUG_INFO_AUTOCAST!>b<!>?.foo()
<!DEBUG_INFO_SMARTCAST!>b<!>?.foo()
}
}
@@ -31,6 +31,6 @@ import p.*
fun test(b: B?) {
if (b is C) {
<!DEBUG_INFO_AUTOCAST!>b<!>?.foo(1, "")
<!DEBUG_INFO_SMARTCAST!>b<!>?.foo(1, "")
}
}
@@ -31,12 +31,12 @@ import p.*
fun test(b: B?) {
if (b is C) {
<!DEBUG_INFO_AUTOCAST!>b<!>?.foo<String>("")
<!DEBUG_INFO_SMARTCAST!>b<!>?.foo<String>("")
}
}
fun test1(b: B?) {
if (b is C) {
<!DEBUG_INFO_AUTOCAST!>b<!>?.foo("")
<!DEBUG_INFO_SMARTCAST!>b<!>?.foo("")
}
}
@@ -31,10 +31,10 @@ import p.*
fun test(b: B?) {
if (b !is C) return
<!DEBUG_INFO_AUTOCAST!>b<!>?.foo("")
<!DEBUG_INFO_SMARTCAST!>b<!>?.foo("")
}
fun test1(b: B?) {
if (b !is C) return
<!DEBUG_INFO_AUTOCAST!>b<!>?.foo<String>("")
<!DEBUG_INFO_SMARTCAST!>b<!>?.foo<String>("")
}
@@ -35,10 +35,10 @@ import p.*
fun test(b: B?) {
if (b !is C) return
<!DEBUG_INFO_AUTOCAST!>b<!>?.foo("")
<!DEBUG_INFO_SMARTCAST!>b<!>?.foo("")
}
fun test1(b: B?) {
if (b !is C) return
<!DEBUG_INFO_AUTOCAST!>b<!>?.foo<String>("")
<!DEBUG_INFO_SMARTCAST!>b<!>?.foo<String>("")
}
@@ -31,10 +31,10 @@ import p.*
fun test(b: B?) {
if (b !is C) return
<!DEBUG_INFO_AUTOCAST!>b<!>?.foo("")
<!DEBUG_INFO_SMARTCAST!>b<!>?.foo("")
}
fun test1(b: B?) {
if (b !is C) return
<!DEBUG_INFO_AUTOCAST!>b<!>?.foo<String>("")
<!DEBUG_INFO_SMARTCAST!>b<!>?.foo<String>("")
}

Some files were not shown because too many files have changed in this diff Show More