-
Notifications
You must be signed in to change notification settings - Fork 10.5k
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 ImplementationgenericsFeature: generic declarations and typesFeature: generic declarations and typesliteralsFeature → expressions: Literals such as an integer or string literalFeature → expressions: Literals such as an integer or string literalopaque typesFeature → types: opaque typesFeature → types: opaque typesswift 5.7type checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysistype inferenceFeature: type inferenceFeature: type inference
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
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 ImplementationgenericsFeature: generic declarations and typesFeature: generic declarations and typesliteralsFeature → expressions: Literals such as an integer or string literalFeature → expressions: Literals such as an integer or string literalopaque typesFeature → types: opaque typesFeature → types: opaque typesswift 5.7type checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysistype inferenceFeature: type inferenceFeature: type inference