Introduce FirFunctionReturnTypeMismatchChecker
This commit is contained in:
+1
-1
@@ -12,7 +12,7 @@ fun foo(): String? {
|
||||
run {
|
||||
if (true) return@run
|
||||
|
||||
if (true) return Obj() // correct error, type check against return type of function "foo"
|
||||
if (true) return <!RETURN_TYPE_MISMATCH!>Obj()<!> // correct error, type check against return type of function "foo"
|
||||
}
|
||||
|
||||
run {
|
||||
|
||||
+1
-1
@@ -23,4 +23,4 @@ fun noCoercionBlockHasExplicitReturn() {
|
||||
}
|
||||
}
|
||||
|
||||
fun noCoercionInExpressionBody(): Unit = "hello"
|
||||
fun noCoercionInExpressionBody(): Unit = <!RETURN_TYPE_MISMATCH!>"hello"<!>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// !DIAGNOSTICS: -UNUSED_VARIABLE
|
||||
// Related issue: KT-28654
|
||||
|
||||
fun <K> select(): K = run { }
|
||||
fun <K> select(): K = <!RETURN_TYPE_MISMATCH!>run { }<!>
|
||||
|
||||
fun test() {
|
||||
val x: Int = select()
|
||||
|
||||
Reference in New Issue
Block a user