[FIR] Fix inconsistent RETURN_TYPE_MISMATCH and TYPE_MISMATCH reporting on functions and properties

^KT-51203 Fixed
This commit is contained in:
Ivan Kochurkin
2022-03-17 16:34:19 +03:00
committed by teamcity
parent 4617615fd9
commit c6f52893fb
42 changed files with 82 additions and 77 deletions
@@ -12,7 +12,7 @@ fun foo(): String? {
run {
if (true) return@run
if (true) return <!RETURN_TYPE_MISMATCH, TYPE_MISMATCH!>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 {
@@ -12,7 +12,7 @@ val a: () -> Unit = l@{
val b: () -> Unit = l@{
// Error, coercion can't be applied at this position!
if (true) return@l "hello"
if (true) return@l <!RETURN_TYPE_MISMATCH!>"hello"<!>
// However, this is OK, because here coercion is applied
"hello"