[FIR] Fix incorrect inference of return type of anonymous functions

Also remove incorrect subtype check checkers

Test unsafeVarianceInAliasedFunctionalType.kt started to fail because
  of KT-54894. This bug existed before, changes from this commit just
  unhided it (previously it was hidden because incorrect subtype check
  in `isSubtypeForTypeMismatch` which is used by FirFunctionReturnTypeMismatchChecker
This commit is contained in:
Dmitriy Novozhilov
2022-11-10 15:08:44 +02:00
committed by Space Team
parent 1b42298025
commit 991d8c18aa
12 changed files with 49 additions and 53 deletions
@@ -11,8 +11,8 @@ fun main() {
val a0: () -> Int = <!INITIALIZER_TYPE_MISMATCH!>fun(): String = "1"<!>
val a1: () -> Int = <!INITIALIZER_TYPE_MISMATCH!>(fun() = "1")<!>
val a2: () -> Unit = (fun() = <!RETURN_TYPE_MISMATCH!>"1"<!>)
val a3: Unit = <!INITIALIZER_TYPE_MISMATCH!>(fun() = <!RETURN_TYPE_MISMATCH!>"1"<!>)<!>
val a2: () -> Unit = <!INITIALIZER_TYPE_MISMATCH!>(fun() = "1")<!>
val a3: Unit = <!INITIALIZER_TYPE_MISMATCH!>(fun() = "1")<!>
val a4 = (fun() = "1")
val a5 = (fun(): String = "1")
val a6: () -> Int = (fun() = 1)
@@ -36,5 +36,5 @@ fun main() {
val a18: () -> Int = <!INITIALIZER_TYPE_MISMATCH!>fun() {}<!>
val a19: () -> () -> Int = <!INITIALIZER_TYPE_MISMATCH!>fun() = fun() {}<!>
val a20: () -> () -> () -> Unit = fun() = fun() = {}
val a21: () -> () -> () -> Int = fun() = fun() = {}
val a21: () -> () -> () -> Int = <!INITIALIZER_TYPE_MISMATCH!>fun() = fun() = {}<!>
}