Introduce seven stages:
1) Analyze postponed arguments with fixed parameter types
2) Collect parameter types from constraints and lambda parameters' declaration
3) Fix not postponed variables for parameter types of all postponed arguments
4) Create atoms with revised expected types if needed
5) Analyze the first ready postponed argument and rerun stages if it has been analyzed
6) Force fixation remaining type variables: fix if possible or report not enough information
7) Force analysis remaining not analyzed postponed arguments and rerun stages if there are
^KT-37952 Fixed
^KT-32156 Fixed
^KT-37249 Fixed
^KT-37341 Fixed
#KT-36247 fixed
A lot of testdata changed because significanly less (error) descriptors
are created for unresolved types, so diagnostics became different.
It's necessary because of new type substitutor is eager than odl, so
if there is a substitution of type parameter deep inside type arguments
then second substitutor wins against first
#KT-35896 Fixed
If new inference is enabled only for IDE analysis, then this feature
will be disabled to reduce difference between new and old inference,
but if new inference is enabled in the compiler, then this feature
will be enabled too to preserve behavior of new inference for
compilation
#KT-32175 Fixed
#KT-32143 Fixed
#KT-32123 Fixed
#KT-32230 Fixed
Expression will be checked against expected type later.
Theoretically, this is not very good, but it aligns with the old
inference, plus it helps avoiding multiple type mismatch diagnostics.
Supported:
- conversion in resolution parts. Also sam-with-receiver is supported automatically
- separate flag for kotlin function with java SAM as parameters
TODO:
- fix overload conflict error when function type is the same byte origin types is ordered
- consider case when parameter type is T, T <:> Runnable
- support vararg of Runnable
[NI] Turn off synthetic scope with SAM adapter functions if NI enabled
#KT-10711 Fixed
#KT-12802 Fixed
#KT-12964 Fixed
#KT-15439 Fixed
Analyze callable references in `dependent` mode, then complete them with
respect to expected types
There are two main changes here:
- In CallCompleter, there was a bug: we assumed that the return type of a
candidate must be a subtype of the expected type and were adding a
corresponding constraint to the system. However, this is not true for
callable references where the type of the expression is KFunctionN<...> and
the return type of the candidate must be a subtype of the _last generic
argument_ of the functional type.
- In CandidateResolver, we use a more correct (although still not precise)
heuristic to determine if a candidate fits based on the non-substituted type
of the callable reference expression which it would produce.
This can be further improved, see TODOs in CallCompleter. Also this does not
influence resolution of callable references being passed as arguments to
generic calls (that happens in GenericCandidateResolver)
#KT-10968 Fixed
#KT-11075 Fixed
#KT-12286 Fixed
#KT-12963 Open
#KT-12964 Open