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
@@ -0,0 +1,16 @@
trait B {
fun bar() {}
}
class C() {
fun bar() {
}
}
fun test(a : Any?) {
if (a is B) {
if (a is C) {
a.<!OVERLOAD_RESOLUTION_AMBIGUITY!>bar<!>();
}
}
}
@@ -0,0 +1,18 @@
package
internal fun test(/*0*/ a: kotlin.Any?): kotlin.Unit
internal trait B {
internal open fun bar(): kotlin.Unit
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
}
internal final class C {
public constructor C()
internal final fun bar(): kotlin.Unit
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
}
@@ -0,0 +1,92 @@
// FILE: a.kt
package example.ns
val y : Any? = 2
// FILE: b.kt
package example
object Obj {
val y : Any? = 2
}
class AClass() {
class object {
val y : Any? = 2
}
}
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_SMARTCAST!>ns.y<!>
}
if (ns.y is Int) {
b = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>example.ns.y<!>
}
if (example.ns.y is Int) {
b = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>ns.y<!>
}
if (example.ns.y is Int) {
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_SMARTCAST!>Obj.y<!>
}
if (example.Obj.y is Int) {
b = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>Obj.y<!>
}
if (AClass.y is Int) {
b = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>AClass.y<!>
}
if (example.AClass.y is Int) {
b = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>AClass.y<!>
}
if (x is Int) {
b = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>x<!>
}
if (example.x is Int) {
b = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>x<!>
}
if (example.x is Int) {
b = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>example.x<!>
}
return 1
}
fun Any?.foo() : Int {
if (this is Int)
return <!DEBUG_INFO_SMARTCAST!>this<!>
if (this@foo is Int)
return <!DEBUG_INFO_SMARTCAST!>this<!>
if (this@foo is Int)
return <!DEBUG_INFO_SMARTCAST!>this@foo<!>
if (this is Int)
return <!DEBUG_INFO_SMARTCAST!>this@foo<!>
return 1
}
trait T {}
open class C {
fun foo() {
var <!ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE!>t<!> : T? = null
if (this is T) {
t = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>this<!>
}
if (this is T) {
t = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>this@C<!>
}
if (this@C is T) {
t = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>this<!>
}
if (this@C is T) {
t = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>this@C<!>
}
}
}
@@ -0,0 +1,56 @@
package
package example {
internal val x: kotlin.Any? = 1
internal fun kotlin.Any?.foo(): kotlin.Int
internal fun kotlin.Any?.vars(/*0*/ a: kotlin.Any?): kotlin.Int
internal final class AClass {
public constructor AClass()
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
internal class object <class-object-for-AClass> {
private constructor <class-object-for-AClass>()
internal final val y: kotlin.Any? = 2
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
}
}
internal open class C {
public constructor C()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
internal final fun foo(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
internal object Obj {
private constructor Obj()
internal final val y: kotlin.Any? = 2
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 class object <class-object-for-Obj> : example.Obj {
private constructor <class-object-for-Obj>()
internal final override /*1*/ /*fake_override*/ val y: 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
}
}
internal trait T {
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
}
package example.ns {
internal val y: kotlin.Any? = 2
}
}