Don't suggest "return type is..." inspections for anonymous functions
#KT-29290 Fixed
This commit is contained in:
-18
@@ -71,24 +71,6 @@
|
||||
<problem_class severity="WEAK WARNING" attribute_key="INFO_ATTRIBUTES">Function returning Result directly</problem_class>
|
||||
<description>Function returning Result with a name that does not end with Catching</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>test.kt</file>
|
||||
<line>38</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<package><default></package>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
|
||||
<problem_class severity="WEAK WARNING" attribute_key="INFO_ATTRIBUTES">Function returning Result directly</problem_class>
|
||||
<description>Function returning Result with a name that does not end with Catching</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>test.kt</file>
|
||||
<line>40</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<package><default></package>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
|
||||
<problem_class severity="WEAK WARNING" attribute_key="INFO_ATTRIBUTES">Function returning Result directly</problem_class>
|
||||
<description>Function returning Result with a name that does not end with Catching</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>test.kt</file>
|
||||
<line>60</line>
|
||||
|
||||
@@ -34,9 +34,9 @@ class Container {
|
||||
fun test() {
|
||||
// YES
|
||||
fun localGetSuccess() = Result("123")
|
||||
// YES
|
||||
// NO (no name)
|
||||
val anonymous = fun() = Result(45)
|
||||
// YES
|
||||
// NO (no name)
|
||||
val lambda = { Result(true) }
|
||||
// NO yet (we do not report local *catching functions)
|
||||
fun localCatching() = Result(2.72)
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
// WITH_RUNTIME
|
||||
// PROBLEM: none
|
||||
package kotlinx.coroutines
|
||||
|
||||
suspend fun barAsync(): Deferred<String>? {
|
||||
return null
|
||||
}
|
||||
|
||||
suspend fun foo() {
|
||||
" ".let <caret>{ barAsync() }
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// PROBLEM: none
|
||||
package kotlin
|
||||
|
||||
fun test() {
|
||||
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
package kotlin
|
||||
|
||||
fun test() {
|
||||
val x = fun() = Result("123").getOrThrow()
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// PROBLEM: none
|
||||
package kotlin
|
||||
|
||||
fun test() {
|
||||
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
package kotlin
|
||||
|
||||
fun test() {
|
||||
val x = { Result(true).getOrThrow() }
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// PROBLEM: none
|
||||
package kotlin
|
||||
|
||||
fun test(arg: Boolean) {
|
||||
|
||||
Vendored
-11
@@ -1,11 +0,0 @@
|
||||
package kotlin
|
||||
|
||||
fun test(arg: Boolean) {
|
||||
val x = foo@{
|
||||
(if (!arg) {
|
||||
return@foo Result(true).getOrThrow()
|
||||
} else {
|
||||
Result(false)
|
||||
}).getOrThrow()
|
||||
}
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// PROBLEM: none
|
||||
package kotlin
|
||||
|
||||
fun test() {
|
||||
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
package kotlin
|
||||
|
||||
fun test() {
|
||||
val x = foo@<caret>{ return@foo Result(true).getOrThrow() }
|
||||
}
|
||||
Reference in New Issue
Block a user