[FIR] Don't set lambda parameter type to Nothing by default

... when the expected type is not a function type.
Instead set it to a new type variable.
This fixes a bunch of false negative CANNOT_INFER_PARAMETER_TYPE.

#KT-59882 Fixed
This commit is contained in:
Kirill Rakhman
2024-02-23 11:33:09 +01:00
committed by Space Team
parent 9857bdc891
commit c3c2f6f90a
22 changed files with 48 additions and 94 deletions
@@ -29,10 +29,10 @@ fun main() {
foo1 { x -> x > 1 }
foo1(f)
foo2 <!ARGUMENT_TYPE_MISMATCH!>{ x -> x <!UNRESOLVED_REFERENCE!>><!> 1 }<!>
foo2 <!ARGUMENT_TYPE_MISMATCH!>{ <!CANNOT_INFER_PARAMETER_TYPE!>x<!> -> x <!UNRESOLVED_REFERENCE!>><!> 1 }<!>
foo2(<!ARGUMENT_TYPE_MISMATCH!>f<!>)
foo3 <!ARGUMENT_TYPE_MISMATCH!>{ x -> x <!UNRESOLVED_REFERENCE!>><!> 1 }<!>
foo3 <!ARGUMENT_TYPE_MISMATCH!>{ <!CANNOT_INFER_PARAMETER_TYPE!>x<!> -> x <!UNRESOLVED_REFERENCE!>><!> 1 }<!>
foo3(<!ARGUMENT_TYPE_MISMATCH!>f<!>)
foo4 { x -> x > 1 }