Skip to content

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Oct 7, 2025

…s in the based are bound

Dependent members cannot be simplified if base type contains unresolved pack expansion type variables because they don't give enough information to substitution logic to form a correct type. For example:

protocol P { associatedtype V }
struct S<each T> : P { typealias V = (repeat (each T)?) }

If pack expansion is represented as $T1 and its pattern is $T2, a reference to V would get a type S<Pack{$T}>.V and simplified version would be Optional<Pack{$T1}> instead of Pack{repeat Optional<$T2>} because $T1 is treated as a substitution for each T until bound.

Resolves: rdar://161207705

…s in the based are bound

Dependent members cannot be simplified if base type contains unresolved
pack expansion type variables because they don't give enough information
to substitution logic to form a correct type. For example:

```
protocol P { associatedtype V }
struct S<each T> : P { typealias V = (repeat (each T)?) }
```

If pack expansion is represented as `$T1` and its pattern is `$T2`, a
reference to `V` would get a type `S<Pack{$T}>.V` and simplified version
would be `Optional<Pack{$T1}>` instead of `Pack{repeat Optional<$T2>}`
because `$T1` is treated as a substitution for `each T` until bound.

Resolves: rdar://161207705
@xedin
Copy link
Contributor Author

xedin commented Oct 7, 2025

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Oct 8, 2025

@swift-ci please test macOS platform

@xedin
Copy link
Contributor Author

xedin commented Oct 8, 2025

@swift-ci please test source compatibility

@xedin xedin merged commit 1d8536e into swiftlang:main Oct 8, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant