Don't apply Unit-conversion for expressions that return Nothing type

This commit is contained in:
Mikhail Zarechenskiy
2020-06-05 15:44:53 +03:00
parent 3634cbe3cb
commit 22b558110d
4 changed files with 25 additions and 11 deletions
@@ -1,4 +1,4 @@
// !LANGUAGE: -SuspendConversion
// !LANGUAGE: -UnitConversion
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION
fun foo(f: () -> Unit) {}
@@ -7,9 +7,15 @@ fun bar(): Int = 0
abstract class SubInt : () -> Int
fun test(f: () -> String, s: SubInt) {
fun <T> T.freeze(): T = TODO()
fun test(f: () -> String, g: () -> Nothing, h: () -> Nothing?, s: SubInt) {
foo { "lambda" }
foo(::bar)
foo({ TODO() }.freeze())
foo(g)
foo(<!UNSUPPORTED_FEATURE!>h<!>)
foo(<!UNSUPPORTED_FEATURE!>f<!>)
foo(<!UNSUPPORTED_FEATURE!>s<!>)