[SR-11429] Don't look through CoerceExprs in markDirectCallee #53830
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler itself
type checker
Area → compiler: Semantic analysis
Environment
Swift version 5.1-dev (LLVM c5340df2d1, Swift c14addb448)
Target: x86_64-apple-darwin18.5.0
Additional Detail from JIRA
md5: d962ddabfd7e73fdea14cccf6fc21979
Issue Description:
Currently in
markDirectCallee
, we look through CoerceExprs when marking a callee as being directly applied. However the fact that it gets marked as being directly applied means that any functions with argument labels cannot be used with a coercion to a user-written function type:This is because function types written by the user cannot include argument labels.
The only way to get code like this to compile is to let the compiler infer the type in the coercion through a generic type alias, which allows the argument label to be propagated:
But I would hope that nobody is actually writing code like this.
In addition, trying to rely on the fact that the referenced function within the coercion is marked as being directly applied in order to get an implicit IUO unwrap currently crashes ([SR-10492]):
And I can't immediately think of any other compelling examples that would break if we were to stop looking through CoerceExprs in
markDirectCallee
.The text was updated successfully, but these errors were encountered: