-
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.call expressionsFeature → expressions: Call expressionsFeature → expressions: Call expressionscompilerThe Swift compiler itselfThe Swift compiler itselfdiagnostics QoIBug: Diagnostics Quality of ImplementationBug: Diagnostics Quality of ImplementationexpressionsFeature: expressionsFeature: expressionsreturnFeature → statements: `return` statementsFeature → statements: `return` statementsstatementsFeature: statementsFeature: statementsswift 6.0tuplesFeature: tuplesFeature: tuplestype checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysis
Description
Description
This is specific to tuples. The return expression type mismatch error message is shown instead of the argument type mismatch error message (cannot_convert_to_return_type
vs. cannot_convert_argument_value
).
Reproduction
func foo(_: (Int, Int)) -> String {}
func test() -> String {
return foo((0, true))
}
222 | func test() -> String {
223 | return foo((0, true))
| `- error: cannot convert return expression of type '(Int, Bool)' to return type '(Int, Int)' [cannot_convert_to_return_type]
224 | }
Expected behavior
error: cannot convert value of type '(Int, Bool)' to expected argument type '(Int, Int)'
Environment
Swift version 6.0-dev (LLVM c7c87ee42989d4b, Swift 8493312)
Additional information
Reduced from #46829.
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.call expressionsFeature → expressions: Call expressionsFeature → expressions: Call expressionscompilerThe Swift compiler itselfThe Swift compiler itselfdiagnostics QoIBug: Diagnostics Quality of ImplementationBug: Diagnostics Quality of ImplementationexpressionsFeature: expressionsFeature: expressionsreturnFeature → statements: `return` statementsFeature → statements: `return` statementsstatementsFeature: statementsFeature: statementsswift 6.0tuplesFeature: tuplesFeature: tuplestype checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysis