https://kotlinlang.org logo
#compiler
Title
# compiler
i

Icyrockton

11/21/2023, 2:27 PM
Why do we need
PostponedArgument
in resolving function calls? Because we need to find the function call (i.e., the callable symbol) first (what
FirCallResolver
does) this way we can get more type constraints from the value parameters of the callable symbol and then process all unprocessed
PostponedArguments
(what
FirCallCompleter
does) Is that correct?
d

dmitriy.novozhilov

11/21/2023, 2:40 PM
Yes, exactly We can't analyze lambda without knowing it's input arguments, so we should analyze it only against some value parameter But if we do it on resolution stage for each candidate we met, then we will analyze each lambda several times (which immediately increase complexity of analysis to exponential scale)
So we postpone lambdas extracting from them all information we can without actual analysis (e.g. number of arguments, types of arguments if they are explicitly written) and actually analyze them when candidate is chosen and all constraints for input types of lambda are resolved
The same story with callable references
i

Icyrockton

11/21/2023, 2:46 PM
🙏 ok thanks
3 Views