More precise diagnostics of smart cast impossible #KT-7240 Fixed
This commit is contained in:
+1
-2
@@ -231,8 +231,7 @@ class Mutable(var <info descr="This property has a backing field">x</info>: Stri
|
||||
return <error descr="[SMARTCAST_IMPOSSIBLE] Smart cast to 'kotlin.String' is impossible, because 'x' is a member variable that can be changed from another thread">x</error>
|
||||
}
|
||||
if (x != null) {
|
||||
// It would be better to have smart cast impossible also here
|
||||
return <error descr="[TYPE_MISMATCH] Type mismatch: inferred type is kotlin.String? but kotlin.String was expected">x</error>
|
||||
return <error descr="[SMARTCAST_IMPOSSIBLE] Smart cast to 'kotlin.String' is impossible, because 'x' is a member variable that can be changed from another thread">x</error>
|
||||
}
|
||||
if (xx is String) {
|
||||
return <error descr="[SMARTCAST_IMPOSSIBLE] Smart cast to 'kotlin.String' is impossible, because 'xx' is a member value that has open or custom getter">xx</error>
|
||||
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
// SUGGESTED_NAMES: i, getKm
|
||||
// PARAM_TYPES: A
|
||||
// PARAM_DESCRIPTOR: val a: A defined in test
|
||||
class A {
|
||||
|
||||
}
|
||||
|
||||
val A.meters: Int? get() = 1
|
||||
|
||||
fun test() {
|
||||
val a = A()
|
||||
if (a.meters == null) return
|
||||
val km = <selection>a.meters / 10</selection>
|
||||
}
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
// SUGGESTED_NAMES: i, getKm
|
||||
// PARAM_TYPES: A
|
||||
// PARAM_DESCRIPTOR: val a: A defined in test
|
||||
class A {
|
||||
|
||||
}
|
||||
|
||||
val A.meters: Int? get() = 1
|
||||
|
||||
fun test() {
|
||||
val a = A()
|
||||
if (a.meters == null) return
|
||||
val km = i(a)
|
||||
}
|
||||
|
||||
private fun i(a: A) = a.meters / 10
|
||||
Reference in New Issue
Block a user