-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Labels
compilerThe Swift compiler itselfThe Swift compiler itselfexpressionsFeature: expressionsFeature: expressionsgenericsFeature: generic declarations and typesFeature: generic declarations and typesparameter packsFeature → generics: Parameter packsFeature → generics: Parameter packsswift 6.2type checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysistypealiasFeature → type declarations: `typealias` declarationsFeature → type declarations: `typealias` declarationsunexpected errorBug: Unexpected errorBug: Unexpected error
Description
Description
When I call a function that returns a value pack using optional chaining, the compiler error "type of expression is ambiguous without a type annotation" is emitted.
Reproduction
class Foo {
func f<each T>(_ params: repeat each T) -> (repeat each T) { (repeat each params) }
}
func g() {
let foo: Foo? = Foo()
let result = foo?.f(1, "", true) // type of expression is ambiguous without a type annotation
}
Expected behavior
No compiler errors are emitted. The type of result
should be (Int, String, Bool)?
.
Environment
Apple Swift version 6.2-dev (LLVM 0d47fa0a0fd41fb, Swift 536aa93)
Target: arm64-apple-macosx15.0
Additional information
This also happens if I try to use try?
to call a throwing function that returns a value pack. This is likely related to the "optionalness" of the whole expression.
Related Stack Overflow question., where the OP attempts to call AVURLAsset.load
.
Metadata
Metadata
Assignees
Labels
compilerThe Swift compiler itselfThe Swift compiler itselfexpressionsFeature: expressionsFeature: expressionsgenericsFeature: generic declarations and typesFeature: generic declarations and typesparameter packsFeature → generics: Parameter packsFeature → generics: Parameter packsswift 6.2type checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysistypealiasFeature → type declarations: `typealias` declarationsFeature → type declarations: `typealias` declarationsunexpected errorBug: Unexpected errorBug: Unexpected error