Prefer stable types to diagnose useless cast

#KT-11622 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2017-04-05 05:47:34 +03:00
parent 13eddba1f2
commit f518e8ebb8
7 changed files with 64 additions and 25 deletions
+5 -5
View File
@@ -7,12 +7,12 @@ fun test() : Unit {
checkSubtype<Int?>(x)
checkSubtype<Int>(y)
checkSubtype<Int>(x as Int)
checkSubtype<Int>(y <warning>as Int</warning>)
checkSubtype<Int?>(x <warning>as Int?</warning>)
checkSubtype<Int>(y <warning descr="[USELESS_CAST] No cast needed">as Int</warning>)
checkSubtype<Int?>(x as Int?)
checkSubtype<Int?>(y as Int?)
checkSubtype<Int?>(x <warning>as Int?</warning>)
checkSubtype<Int?>(y <warning>as? Int</warning>)
checkSubtype<Int?>(x <warning>as? Int?</warning>)
checkSubtype<Int?>(x as Int?)
checkSubtype<Int?>(y <warning descr="[USELESS_CAST] No cast needed">as? Int</warning>)
checkSubtype<Int?>(x as? Int?)
checkSubtype<Int?>(y as? Int?)
Unit
}