Do not report "redundant Unit" for generic calls coerced to Unit

So #KT-18999 Fixed
This commit is contained in:
Mikhail Glukhikh
2017-07-19 20:44:23 +03:00
parent c554bfa20d
commit 39f1ef390e
3 changed files with 50 additions and 8 deletions
@@ -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>