-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Open
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfdiagnostics QoIBug: Diagnostics Quality of ImplementationBug: Diagnostics Quality of Implementationtype checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysis
Description
Previous ID | SR-13503 |
Radar | rdar://problem/68376691 |
Original Reporter | @theblixguy |
Type | Bug |
Environment
Swift version 5.3-dev (LLVM 19447e2, Swift e41a0976e0bdb09)
Target: x86_64-apple-darwin19.5.0
Additional Detail from JIRA
Votes | 0 |
Component/s | Compiler |
Labels | Bug, DiagnosticsQoI, TypeChecker |
Assignee | None |
Priority | Medium |
md5: cf7afdf3fd38fee6a0ef870bb5bd3d36
Issue Description:
struct S {
func callAsFunction() -> Int { 0 }
}
let s = S()
func doIt(arg: Int) { print(arg) }
doIt(arg: s) // error: cannot convert value of type 'S' to expected argument type 'Int'
In the above scenario, it is possible to call s
(by adding ()
) to produce the expected value of type Int
. So, we should create the InsertExplicitCall
fix (or create a fix tailored for callable values) in order to emit a better diagnostic.
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfdiagnostics QoIBug: Diagnostics Quality of ImplementationBug: Diagnostics Quality of Implementationtype checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysis