[FIR] Merge the two type operator checkers into a single one

This way it's easier to reason about where
useless casts/is checks come from, because
everything is on the same screen.

`USELESS_CAST` disappeared from
`FirPsiJsOldFrontendDiagnosticsTestGenerated.testDynamicCastTarget`
because
`LanguageFeature.EnableDfaWarningsInK2`
is disabled, and previously it only
affected `FirCastOperatorsChecker`, but
not `FirUselessTypeOperationCallChecker`,
which felt like an unintended mistake.
A related issue: KT-50965
This commit is contained in:
Nikolay Lunyak
2024-02-28 15:43:13 +02:00
committed by Space Team
parent 116ff60325
commit 92d8da621e
5 changed files with 22 additions and 61 deletions
@@ -1,11 +1,11 @@
// !DIAGNOSTICS: -REDUNDANT_NULLABLE
fun test(d: Any, dl: Collection<dynamic>) {
d <!USELESS_CAST!>as <!DYNAMIC_NOT_ALLOWED!>dynamic<!><!>
d <!USELESS_CAST!>as <!DYNAMIC_NOT_ALLOWED!>dynamic?<!><!>
d as <!DYNAMIC_NOT_ALLOWED!>dynamic<!>
d as <!DYNAMIC_NOT_ALLOWED!>dynamic?<!>
d <!USELESS_CAST!>as? <!DYNAMIC_NOT_ALLOWED!>dynamic<!><!>
d <!USELESS_CAST!>as? <!DYNAMIC_NOT_ALLOWED!>dynamic?<!><!>
d as? <!DYNAMIC_NOT_ALLOWED!>dynamic<!>
d as? <!DYNAMIC_NOT_ALLOWED!>dynamic?<!>
<!USELESS_IS_CHECK!>d is <!DYNAMIC_NOT_ALLOWED!>dynamic<!><!>
<!USELESS_IS_CHECK!>d is <!DYNAMIC_NOT_ALLOWED!>dynamic?<!><!>