-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Closed
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-8277 |
Radar | rdar://problem/29318186 |
Original Reporter | @YOCKOW |
Type | Bug |
Status | Closed |
Resolution | Done |
Environment
-
OS: macOS, Ubuntu 16.04
-
Swift: 4.1.2, 4.2-dev
Additional Detail from JIRA
Votes | 0 |
Component/s | Compiler |
Labels | Bug, DiagnosticsQoI, TypeChecker |
Assignee | @xedin |
Priority | Medium |
md5: e5b307623cd85333674994be0dcf489a
Issue Description:
There are two error messages when the following code is compiled. But the second one does not indicate the true nature of the problem.
[Code]
func f(_:Bool) {}
struct S {
func g(_:Int) -> Bool { return true }
func g(_:Double) -> Bool { return false }
}
let s = S()
let string = "ABC"
s.g(string)
// -> error: cannot invoke 'g' with an argument list of type '(String)'
// note: overloads for 'g' exist with these partially matching parameter lists: (Int), (Double)
// * Just as I expected.
f(s.g(string))
// -> error: 'g' produces 'Bool', not the expected contextual result type 'Bool'
// * Why isn't it the same as above? --- I believe, at least, 'Bool' is equal to 'Bool'.
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