Suppress RESULT_CLASS_IN_RETURN_TYPE in ResultIsResultInspection tests

This fixes four relevant inspection tests
This commit is contained in:
Mikhail Glukhikh
2018-09-12 18:21:27 +03:00
parent 54e7fe6c52
commit 2e2b15853e
8 changed files with 10 additions and 0 deletions
@@ -6,6 +6,7 @@ class Result<T>(val value: T?) {
fun getOrThrow(): T = value ?: throw AssertionError("")
}
@Suppress("RESULT_CLASS_IN_RETURN_TYPE")
fun <T> runCatching(block: () -> T) = Result(block())
fun correct(arg: Boolean) = runCatching<caret> { if (arg) throw AssertionError("") else 12 }.getOrThrow()
@@ -6,6 +6,7 @@ class Result<T>(val value: T?) {
fun getOrThrow(): T = value ?: throw AssertionError("")
}
@Suppress("RESULT_CLASS_IN_RETURN_TYPE")
fun <T> runCatching(block: () -> T) = Result(block())
fun correct(arg: Boolean) = run { if (arg) throw AssertionError("") else 12 }
@@ -7,6 +7,7 @@ class Result<T>(val value: T?) {
fun getOrThrow(): T = value ?: throw AssertionError("")
}
@Suppress("RESULT_CLASS_IN_RETURN_TYPE")
fun <caret>incorrectBlock(arg: Boolean, arg2: Boolean?): Result<Int> {
if (arg) {
class Local {
@@ -7,6 +7,7 @@ class Result<T>(val value: T?) {
fun getOrThrow(): T = value ?: throw AssertionError("")
}
@Suppress("RESULT_CLASS_IN_RETURN_TYPE")
fun incorrectBlock(arg: Boolean, arg2: Boolean?): Int {
if (arg) {
class Local {
@@ -4,7 +4,9 @@ package kotlin
class Result<T>(val value: T?) {
fun getOrThrow(): T = value ?: throw AssertionError("")
@Suppress("RESULT_CLASS_IN_RETURN_TYPE")
operator fun plus(other: Result<T>) = other
}
@Suppress("RESULT_CLASS_IN_RETURN_TYPE")
fun <caret>incorrect() = Result("123") + Result("456")
@@ -4,7 +4,9 @@ package kotlin
class Result<T>(val value: T?) {
fun getOrThrow(): T = value ?: throw AssertionError("")
@Suppress("RESULT_CLASS_IN_RETURN_TYPE")
operator fun plus(other: Result<T>) = other
}
@Suppress("RESULT_CLASS_IN_RETURN_TYPE")
fun incorrect() = (Result("123") + Result("456")).getOrThrow()
@@ -5,4 +5,5 @@ class Result<T>(val value: T?) {
fun getOrThrow(): T = value ?: throw AssertionError("")
}
@Suppress("RESULT_CLASS_IN_RETURN_TYPE")
fun <caret>incorrect() = Result("123")
@@ -5,4 +5,5 @@ class Result<T>(val value: T?) {
fun getOrThrow(): T = value ?: throw AssertionError("")
}
@Suppress("RESULT_CLASS_IN_RETURN_TYPE")
fun <caret>incorrectCatching() = Result("123")