-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Open
Labels
closuresFeature: closuresFeature: closurescompilerThe Swift compiler itselfThe Swift compiler itselfdiagnostics QoIBug: Diagnostics Quality of ImplementationBug: Diagnostics Quality of ImplementationexpressionsFeature: expressionsFeature: expressionsoverloadingFeature: Overloading symbol namesFeature: Overloading symbol namesswift 6.3type checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysis
Description
Description
No response
Reproduction
extension Sequence {
@available(swift, deprecated: 4.1)
func myFlatMap<T>(_: (Element) -> T?) -> [T] {}
func myFlatMap<T: Sequence>(_: (Element) -> T) -> [T.Element] {}
}
func test(_ array: [String]) -> [String] {
array.myFlatMap { str in
if true {
return [str]
} else {
return [str, str.undefined]
}
}
} 184 | array.myFlatMap { str in
185 | if true {
186 | return [str]
| `- error: cannot convert value of type '[String]' to closure result type 'String'
187 | } else {
188 | return [str, str.undefined]
Expected behavior
186 | return [str]
187 | } else {
188 | return [str, str.undefined]
| `- error: value of type 'String' has no member 'undefined'
189 | }
190 | }
Environment
Swift version 6.3-dev (ce082bc)
Additional information
No response
Metadata
Metadata
Assignees
Labels
closuresFeature: closuresFeature: closurescompilerThe Swift compiler itselfThe Swift compiler itselfdiagnostics QoIBug: Diagnostics Quality of ImplementationBug: Diagnostics Quality of ImplementationexpressionsFeature: expressionsFeature: expressionsoverloadingFeature: Overloading symbol namesFeature: Overloading symbol namesswift 6.3type checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysis