Open
Description
With swift-driver version: 1.62.15 Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)
Target: arm64-apple-macosx13.0
swift
this file
func f() -> some Collection<Int> { [1] }
func g0(x: Bool) -> Optional<some Collection<Int>> {
f()
}
func g1(x: Bool) -> Optional<some Collection<Int>> {
x ? f() : nil
}
func g2(x: Bool) -> Optional<some Collection<Int>> {
if x { return f() }
return nil // error: generic parameter 'τ_0_0' could not be inferred
Ideally, g2
should compile, and regardless τ shouldn't appear in the diagnostic.
Metadata
Metadata
Assignees
Labels
A deviation from expected or documented behavior. Also: expected but undesirable behavior.The Swift compiler itselfBug: Diagnostics Quality of ImplementationFeature: generic declarations and typesFeature → expressions: Literals such as an integer or string literalFeature → types: opaque typesArea → compiler: Semantic analysisFeature: type inference