[SR-504] Functions with default values cannot be called as parameters #43121
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
Attachment: Download
Environment
OS X 10.11, Xcode(swift 2.1)/REPL(swift 2.2-dev)
Additional Detail from JIRA
md5: b01e85e40f3b2a14293af5843699a96c
is duplicated by:
Issue Description:
When I create a function like the codes below, when I call this function, the IDE actually gives two candidates, one of which is of type Int -> Int, and the other of type (Int, Int) -> Int.
But when I want to feed this function as a parameter of another function, the "Int -> Int" one is not working and produces the error as below.
This bug causes big problem when the parameter function is pre-defined with default values. When you see multiple overloads of that function e.g.
Int tested(x: Int)
andInt tested(x: Int, y: Int)
, you don't know if they were DEFINED by overloading or by default values. But when put it as parameter, the former works while the latter doesn't.This behaviour is also demonstrated by the snapshots attached.
The text was updated successfully, but these errors were encountered: