mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
KTI-1665 [kotlin] Adjust testdata for KtDataFlowInspectionTest
Some missing `USELESS_IS_CHECK` diagnostics are now reported in K2 Corresponding issue: KT-58203 Corresponding commit from kotlin: 88ff93df GitOrigin-RevId: 6dd50eaebdb1929ad260963a63fc20f3e77792d6
This commit is contained in:
committed by
intellij-monorepo-bot
parent
3f890f8310
commit
55bd83c0d1
@@ -13,8 +13,7 @@ inline fun <reified T: Number> number(t: T) {
|
||||
// Cannot say anything
|
||||
if (x is T) {}
|
||||
x = "hello"
|
||||
// TODO: support 'always false' here
|
||||
if (x is T) {}
|
||||
if (<warning descr="[USELESS_IS_CHECK] Check for instance is always 'false'.">x is T</warning>) {}
|
||||
}
|
||||
|
||||
// Non-reified
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
// WITH_STDLIB
|
||||
fun unrelatedTypes(obj : Any) {
|
||||
if (obj is X) {
|
||||
// Difference with K1: no 'USELESS_IS_CHECK' warning, hence we report it, as it's useful
|
||||
if (<warning descr="Condition 'obj is Y' is always false">obj is Y</warning>) { }
|
||||
if (<warning descr="Condition 'obj !is Y' is always true">obj !is Y</warning>) { }
|
||||
if (<warning descr="[USELESS_IS_CHECK] Check for instance is always 'false'.">obj is Y</warning>) { }
|
||||
if (<warning descr="[USELESS_IS_CHECK] Check for instance is always 'true'.">obj !is Y</warning>) { }
|
||||
}
|
||||
}
|
||||
fun nullableTypes(obj : Any?) {
|
||||
if (obj is X?) {
|
||||
if (obj is Y?) {
|
||||
if (<warning descr="[USELESS_IS_CHECK] Check for instance is always 'true'.">obj is Y?</warning>) {
|
||||
if (<warning descr="Condition 'obj == null' is always true">obj == null</warning>) { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,8 +47,7 @@ fun whenIs(obj : Any?) {
|
||||
}
|
||||
if (obj is X) {
|
||||
when(obj) {
|
||||
// Difference with K1: no 'USELESS_IS_CHECK' warning, hence we report DFA warning, as it's useful
|
||||
<warning descr="'when' branch is never reachable">is Y</warning> -> {}
|
||||
<warning descr="[USELESS_IS_CHECK] Check for instance is always 'false'.">is Y</warning> -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user