-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Closed as duplicate of#44398
Closed as duplicate of#44398
Copy link
Labels
TypeResolverbugA 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 itselfexpressionsFeature: expressionsFeature: expressionsgenericsFeature: generic declarations and typesFeature: generic declarations and typesparameter packsFeature → generics: Parameter packsFeature → generics: Parameter packsswift 6.0swift evolution proposal neededFlag → feature: A feature that warrants a Swift evolution proposalFlag → feature: A feature that warrants a Swift evolution proposaltype checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysistype inferenceFeature: type inferenceFeature: type inferenceunexpected errorBug: Unexpected errorBug: Unexpected error
Description
Description
Shape recognition of parameter pack has a bug.
Errors:
Cannot convert return expression of type 'S<repeat each T>' to return type 'S<repeat each T, U>'
Pack expansion requires that 'each T' and 'repeat each T, U' have the same shape
Reproduction
struct S<each T> {
let t: (repeat each T)
func build<U>(_ u: U) -> S<repeat each T, U> {
S(t: (repeat each t, u))
// NOTE: the following works
// S<repeat each T, U>(t: (repeat each t, u))
}
}
Expected behavior
Return type should not require explicit type spec.
let x = S(t: ("Hello", 1))
let y = x.build(2.0)
// Expected type of y is S<String, Int, Double>
Environment
Apple Swift version 6.0-dev (LLVM 5f87d6ee2f8c800, Swift 5c01ca1)
Target: arm64-apple-macosx14.0
Additional information
No response
Metadata
Metadata
Assignees
Labels
TypeResolverbugA 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 itselfexpressionsFeature: expressionsFeature: expressionsgenericsFeature: generic declarations and typesFeature: generic declarations and typesparameter packsFeature → generics: Parameter packsFeature → generics: Parameter packsswift 6.0swift evolution proposal neededFlag → feature: A feature that warrants a Swift evolution proposalFlag → feature: A feature that warrants a Swift evolution proposaltype checkerArea → compiler: Semantic analysisArea → compiler: Semantic analysistype inferenceFeature: type inferenceFeature: type inferenceunexpected errorBug: Unexpected errorBug: Unexpected error