Do not report "redundant Unit" for generic calls coerced to Unit
So #KT-18999 Fixed
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
fun <T> run(f: () -> T) = f()
|
||||
|
||||
fun foo(): Unit = run {
|
||||
bar()
|
||||
}
|
||||
|
||||
fun bar() = 1
|
||||
|
||||
fun call(f: () -> Unit) = f()
|
||||
|
||||
fun boo(): Unit = call {
|
||||
baz()
|
||||
}
|
||||
|
||||
fun baz() {}
|
||||
|
||||
fun <T, R> T.let(f: (T) -> R) = f(this)
|
||||
|
||||
fun goo(): Unit = 1.let {
|
||||
bar()
|
||||
}
|
||||
@@ -23,4 +23,12 @@
|
||||
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Redundant 'Unit' return type</problem_class>
|
||||
<description>Redundant Unit return type</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>WithLambda.kt</file>
|
||||
<line>11</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/WithLambda.kt" />
|
||||
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Redundant 'Unit' return type</problem_class>
|
||||
<description>Redundant 'Unit' return type</description>
|
||||
</problem>
|
||||
</problems>
|
||||
|
||||
Reference in New Issue
Block a user