Enhance inspection about SuccessOrFailure (related to KT-25621)
Increase performance by searching first SuccessOrFailure/runCatching/etc in text of functions without return type. Remove stdlib false positives, like success() & failure(). For catching extension, check also non-catching members. Add "rename to *Catching" fix.
This commit is contained in:
+10
@@ -0,0 +1,10 @@
|
||||
// FIX: Unwrap 'SuccessOrFailure' return type (breaks use-sites!)
|
||||
package kotlin
|
||||
|
||||
class SuccessOrFailure<T>(val value: T?) {
|
||||
fun getOrThrow(): T = value ?: throw AssertionError("")
|
||||
}
|
||||
|
||||
abstract class Abstract {
|
||||
abstract fun <caret>foo(): SuccessOrFailure<Int>
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// FIX: Unwrap 'SuccessOrFailure' return type (breaks use-sites!)
|
||||
package kotlin
|
||||
|
||||
class SuccessOrFailure<T>(val value: T?) {
|
||||
fun getOrThrow(): T = value ?: throw AssertionError("")
|
||||
}
|
||||
|
||||
abstract class Abstract {
|
||||
abstract fun foo(): Int
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIX: Add '.getOrThrow()' to function result (breaks use-sites!)
|
||||
// WITH_RUNTIME
|
||||
|
||||
package kotlin
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIX: Add '.getOrThrow()' to function result (breaks use-sites!)
|
||||
// WITH_RUNTIME
|
||||
|
||||
package kotlin
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIX: Add '.getOrThrow()' to function result (breaks use-sites!)
|
||||
package kotlin
|
||||
|
||||
class SuccessOrFailure<T>(val value: T?) {
|
||||
|
||||
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// FIX: Add '.getOrThrow()' to function result (breaks use-sites!)
|
||||
package kotlin
|
||||
|
||||
class SuccessOrFailure<T>(val value: T?) {
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// FIX: Rename to 'incorrectCatching'
|
||||
package kotlin
|
||||
|
||||
class SuccessOrFailure<T>(val value: T?) {
|
||||
fun getOrThrow(): T = value ?: throw AssertionError("")
|
||||
}
|
||||
|
||||
fun <caret>incorrect() = SuccessOrFailure("123")
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// FIX: Rename to 'incorrectCatching'
|
||||
package kotlin
|
||||
|
||||
class SuccessOrFailure<T>(val value: T?) {
|
||||
fun getOrThrow(): T = value ?: throw AssertionError("")
|
||||
}
|
||||
|
||||
fun <caret>incorrectCatching() = SuccessOrFailure("123")
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIX: Add '.getOrThrow()' to function result (breaks use-sites!)
|
||||
package kotlin
|
||||
|
||||
class SuccessOrFailure<T>(val value: T?) {
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIX: Add '.getOrThrow()' to function result (breaks use-sites!)
|
||||
package kotlin
|
||||
|
||||
class SuccessOrFailure<T>(val value: T?) {
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIX: Add '.getOrThrow()' to function result (breaks use-sites!)
|
||||
package kotlin
|
||||
|
||||
class SuccessOrFailure<T>(val value: T?) {
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIX: Add '.getOrThrow()' to function result (breaks use-sites!)
|
||||
package kotlin
|
||||
|
||||
class SuccessOrFailure<T>(val value: T?) {
|
||||
|
||||
Reference in New Issue
Block a user