Don't register safe cast type info for unstable values
Important: to be removed in 1.3 So #KT-20752 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
8ae3dbdcfc
commit
a55c6f0c95
@@ -0,0 +1,25 @@
|
||||
// !LANGUAGE: +SafeCastCheckBoundSmartCasts
|
||||
// See KT-20752
|
||||
|
||||
class Unstable {
|
||||
val first: String? get() = null
|
||||
}
|
||||
|
||||
class StringList {
|
||||
fun remove(s: String) = s
|
||||
}
|
||||
|
||||
fun StringList.remove(s: String?) = s ?: ""
|
||||
|
||||
fun foo(list: StringList, arg: Unstable) {
|
||||
list.remove(arg.first)
|
||||
if (arg.first <!USELESS_CAST!>as? String<!> != null) {
|
||||
// Ideally should have smart cast impossible here
|
||||
list.remove(arg.first)
|
||||
}
|
||||
val s = arg.first <!USELESS_CAST!>as? String<!>
|
||||
if (s != null) {
|
||||
// Ideally should have smart cast impossible here
|
||||
list.remove(arg.first)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package
|
||||
|
||||
public fun foo(/*0*/ list: StringList, /*1*/ arg: Unstable): kotlin.Unit
|
||||
public fun StringList.remove(/*0*/ s: kotlin.String?): kotlin.String
|
||||
|
||||
public final class StringList {
|
||||
public constructor StringList()
|
||||
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 fun remove(/*0*/ s: kotlin.String): kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public final class Unstable {
|
||||
public constructor Unstable()
|
||||
public final val first: 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
|
||||
}
|
||||
Reference in New Issue
Block a user