[Test] Disable UNUSED_* diagnostics in tests which are not belong to contolFlowAnalysis suite

This commit is contained in:
Dmitriy Novozhilov
2021-03-29 12:14:16 +03:00
committed by TeamCityServer
parent 85949b387e
commit cd890d5833
758 changed files with 1832 additions and 3745 deletions
@@ -1,20 +0,0 @@
// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect
// !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts
// !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER
import kotlin.contracts.*
fun <T> myRun(block: () -> T): T {
contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
}
return block()
}
fun functionWithSideEffects(x: Int): Int = x + 1 // ...and some other useful side-effects
fun log(s: String) = Unit // some logging or println or whatever returning Unit
fun implicitCastWithIf(s: String) {
myRun { if (s == "") functionWithSideEffects(42) else log(s) }
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect
// !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts
// !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER
@@ -13,8 +14,8 @@ fun <T> myRun(block: () -> T): T {
fun functionWithSideEffects(x: Int): Int = x + 1 // ...and some other useful side-effects
fun log(<!UNUSED_PARAMETER!>s<!>: String) = Unit // some logging or println or whatever returning Unit
fun log(s: String) = Unit // some logging or println or whatever returning Unit
fun implicitCastWithIf(s: String) {
myRun { if (s == "") functionWithSideEffects(42) else log(s) }
}
}
@@ -12,6 +12,6 @@ inline fun <T> myRun(block: () -> T): T {
}
fun throwInLambda(): Int {
<!UNREACHABLE_CODE!>val <!UNUSED_VARIABLE!>x<!> =<!> myRun { throw java.lang.IllegalArgumentException(); <!UNREACHABLE_CODE!>42<!> }
<!UNREACHABLE_CODE!>val x =<!> myRun { throw java.lang.IllegalArgumentException(); <!UNREACHABLE_CODE!>42<!> }
<!UNREACHABLE_CODE!>return x<!>
}
}