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
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