[PL][tests] K/N: Avoid any unexpected warnings to appear in tests
This commit is contained in:
committed by
Space Team
parent
8cae224cb4
commit
19c6208cc0
+14
-9
@@ -18,11 +18,11 @@ class Checker {
|
||||
fun useClassAsValueParameter(c: Class): String = "Checker.useClassAsValueParameter($c)"
|
||||
fun createAndPassClassAsValueParameter(): String = useClassAsValueParameter(Class())
|
||||
|
||||
fun useRemovedClassAsValueParameter(e: RemovedClass?): String = "FAIL: useRemovedClassAsValueParameter"
|
||||
fun useRemovedClassAsValueParameter(@Suppress("UNUSED_PARAMETER") e: RemovedClass?): String = "FAIL: useRemovedClassAsValueParameter"
|
||||
fun createAndPassRemovedClassAsValueParameter(): String = useRemovedClassAsValueParameter(null)
|
||||
|
||||
var removedClassProperty: RemovedClass? = null
|
||||
protected set(value) { /* Do nothing */ }
|
||||
protected set(_) { /* Do nothing */ }
|
||||
|
||||
fun writeToRemovedClassProperty(): String {
|
||||
removedClassProperty = null
|
||||
@@ -62,7 +62,8 @@ fun readVariableInFunction() {
|
||||
}
|
||||
|
||||
fun writeVariableInFunction() {
|
||||
var removed: RemovedClass?
|
||||
@Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE", "CanBeVal") var removed: RemovedClass?
|
||||
@Suppress("UNUSED_VALUE")
|
||||
removed = null
|
||||
}
|
||||
|
||||
@@ -76,7 +77,8 @@ fun readVariableInLocalFunction() {
|
||||
|
||||
fun writeVariableInLocalFunction() {
|
||||
fun local() {
|
||||
var removed: RemovedClass?
|
||||
@Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE", "CanBeVal") var removed: RemovedClass?
|
||||
@Suppress("UNUSED_VALUE")
|
||||
removed = null
|
||||
}
|
||||
local()
|
||||
@@ -95,7 +97,8 @@ fun readVariableInLocalClass() {
|
||||
fun writeVariableInLocalClass() {
|
||||
class Local {
|
||||
fun foo() {
|
||||
var removed: RemovedClass?
|
||||
@Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE", "CanBeVal") var removed: RemovedClass?
|
||||
@Suppress("UNUSED_VALUE")
|
||||
removed = null
|
||||
}
|
||||
}
|
||||
@@ -114,7 +117,8 @@ fun readVariableInAnonymousObject() {
|
||||
fun writeVariableInAnonymousObject() {
|
||||
object {
|
||||
fun foo() {
|
||||
var removed: RemovedClass?
|
||||
@Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE", "CanBeVal") var removed: RemovedClass?
|
||||
@Suppress("UNUSED_VALUE")
|
||||
removed = null
|
||||
}
|
||||
}.foo()
|
||||
@@ -133,7 +137,8 @@ fun readVariableInAnonymousObjectThroughLocalVar() {
|
||||
fun writeVariableInAnonymousObjectThroughLocalVar() {
|
||||
val obj = object {
|
||||
fun foo() {
|
||||
var removed: RemovedClass?
|
||||
@Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE", "CanBeVal") var removed: RemovedClass?
|
||||
@Suppress("UNUSED_VALUE")
|
||||
removed = null
|
||||
}
|
||||
}
|
||||
@@ -262,10 +267,10 @@ inline fun inlinedFunctionWithCreationOfOpenClassImplThroughReference() {
|
||||
|
||||
inline fun inlinedFunctionWithRemovedOpenClassAnonymousObject() {
|
||||
val foo = object : RemovedOpenClass() {}
|
||||
check(foo == null)
|
||||
check(foo.toString().isNotEmpty())
|
||||
}
|
||||
|
||||
inline fun inlinedFunctionWithOpenClassImplAnonymousObject() {
|
||||
val foo = object : OpenClassImpl() {}
|
||||
check(foo == null)
|
||||
check(foo.toString().isNotEmpty())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user