FIR checker: warn unnecessary non-null assertions
This commit is contained in:
committed by
Mikhail Glukhikh
parent
5229d4e4f4
commit
2ecb6733ed
@@ -11,14 +11,14 @@ class Pair<A, B>(val a: A, val b: B)
|
||||
fun main() {
|
||||
val d : Long = 1
|
||||
val period : Int? = null
|
||||
if (period != null) Pair(d, checkSubtype<Int>(period!!)) else Pair(d, 1)
|
||||
if (period != null) Pair(d, checkSubtype<Int>(period<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>)) else Pair(d, 1)
|
||||
if (period != null) Pair(d, checkSubtype<Int>(period)) else Pair(d, 1)
|
||||
}
|
||||
|
||||
fun foo() {
|
||||
val x : Int? = 3
|
||||
if (x != null) {
|
||||
val u = checkSubtype<Int>(x!!)
|
||||
val u = checkSubtype<Int>(x<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>)
|
||||
val y = checkSubtype<Int>(x)
|
||||
val z : Int = y
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user