Extract stub library file from "Result is Result" inspection tests

This commit is contained in:
Mikhail Glukhikh
2018-11-28 13:57:28 +03:00
parent 6b60d49e09
commit 93fff99d8d
21 changed files with 9 additions and 86 deletions
@@ -1,10 +1,6 @@
// FIX: Unwrap 'Result' return type (breaks use-sites!)
package kotlin
class Result<T>(val value: T?) {
fun getOrThrow(): T = value ?: throw AssertionError("")
}
abstract class Abstract {
abstract fun <caret>foo(): Result<Int>
}
@@ -1,10 +1,6 @@
// FIX: Unwrap 'Result' return type (breaks use-sites!)
package kotlin
class Result<T>(val value: T?) {
fun getOrThrow(): T = value ?: throw AssertionError("")
}
abstract class Abstract {
abstract fun foo(): Int
}
@@ -1,9 +1,5 @@
package kotlin
class Result<T>(val value: T?) {
fun getOrThrow(): T = value ?: throw AssertionError("")
}
fun test() {
val x = <caret>fun() = Result("123")
}
@@ -1,9 +1,5 @@
package kotlin
class Result<T>(val value: T?) {
fun getOrThrow(): T = value ?: throw AssertionError("")
}
fun test() {
val x = fun() = Result("123").getOrThrow()
}
@@ -3,10 +3,6 @@
package kotlin
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) {
@@ -3,10 +3,6 @@
package kotlin
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) {
@@ -1,9 +1,5 @@
package kotlin
class Result<T>(val value: T?) {
fun getOrThrow(): T = value ?: throw AssertionError("")
}
fun test() {
val x = <caret>{ Result(true) }
}
@@ -1,9 +1,5 @@
package kotlin
class Result<T>(val value: T?) {
fun getOrThrow(): T = value ?: throw AssertionError("")
}
fun test() {
val x = { Result(true).getOrThrow() }
}
@@ -1,9 +1,5 @@
package kotlin
class Result<T>(val value: T?) {
fun getOrThrow(): T = value ?: throw AssertionError("")
}
fun test(arg: Boolean) {
val x = foo@<caret>{
if (!arg) {
@@ -1,9 +1,5 @@
package kotlin
class Result<T>(val value: T?) {
fun getOrThrow(): T = value ?: throw AssertionError("")
}
fun test(arg: Boolean) {
val x = foo@{
(if (!arg) {
@@ -1,9 +1,5 @@
package kotlin
class Result<T>(val value: T?) {
fun getOrThrow(): T = value ?: throw AssertionError("")
}
fun test() {
val x = foo@<caret>{ return@foo Result(true) }
}
@@ -1,9 +1,5 @@
package kotlin
class Result<T>(val value: T?) {
fun getOrThrow(): T = value ?: throw AssertionError("")
}
fun test() {
val x = foo@<caret>{ return@foo Result(true).getOrThrow() }
}
@@ -1,12 +1,5 @@
// FIX: Add '.getOrThrow()' to function result (breaks use-sites!)
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")
@@ -1,12 +1,5 @@
// FIX: Add '.getOrThrow()' to function result (breaks use-sites!)
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()
@@ -1,9 +1,5 @@
// FIX: Rename to 'incorrectCatching'
package kotlin
class Result<T>(val value: T?) {
fun getOrThrow(): T = value ?: throw AssertionError("")
}
@Suppress("RESULT_CLASS_IN_RETURN_TYPE")
fun <caret>incorrect() = Result("123")
@@ -1,9 +1,5 @@
// FIX: Rename to 'incorrectCatching'
package kotlin
class Result<T>(val value: T?) {
fun getOrThrow(): T = value ?: throw AssertionError("")
}
@Suppress("RESULT_CLASS_IN_RETURN_TYPE")
fun <caret>incorrectCatching() = Result("123")
@@ -0,0 +1,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
}
@@ -1,8 +1,4 @@
// FIX: Add '.getOrThrow()' to function result (breaks use-sites!)
package kotlin
class Result<T>(val value: T?) {
fun getOrThrow(): T = value ?: throw AssertionError("")
}
fun <caret>incorrect() = Result("123")
@@ -1,8 +1,4 @@
// FIX: Add '.getOrThrow()' to function result (breaks use-sites!)
package kotlin
class Result<T>(val value: T?) {
fun getOrThrow(): T = value ?: throw AssertionError("")
}
fun incorrect() = Result("123").getOrThrow()
@@ -1,10 +1,6 @@
// FIX: Add '.getOrThrow()' to function result (breaks use-sites!)
package kotlin
class Result<T>(val value: T?) {
fun getOrThrow(): T = value ?: throw AssertionError("")
}
fun <caret>incorrectBlock(arg: Boolean, arg2: Boolean?): Result<Int> {
if (arg) {
return Result(1)
@@ -1,10 +1,6 @@
// FIX: Add '.getOrThrow()' to function result (breaks use-sites!)
package kotlin
class Result<T>(val value: T?) {
fun getOrThrow(): T = value ?: throw AssertionError("")
}
fun incorrectBlock(arg: Boolean, arg2: Boolean?): Int {
if (arg) {
return Result(1).getOrThrow()