Suppress RESULT_CLASS_IN_RETURN_TYPE in ResultIsResultInspection tests
This fixes four relevant inspection tests
This commit is contained in:
@@ -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()
|
||||
|
||||
+1
@@ -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 }
|
||||
|
||||
+1
@@ -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 {
|
||||
|
||||
+1
@@ -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 {
|
||||
|
||||
+2
@@ -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")
|
||||
|
||||
Vendored
+2
@@ -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")
|
||||
|
||||
+1
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user