Rename: auto cast -> smart cast
This commit is contained in:
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user