Skip to content

OpenedExistentials: Do not attempt to erase existential metatypes wit… #78593

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 19, 2025

Conversation

AnthonyLatsis
Copy link
Collaborator

…h invariant Self

The non-metatype case was never supported. The same should hold for the existential metatype case, which used to miscompile and now crashes because the invariant reference is deemed OK but the erasure expectedly fails to handle it:

class C<T> {}
protocol P {
  associatedtype A

  func f() -> any P & C<A>
  func fMeta() -> any (P & C<A>).Type
}

do {
  let p: any P
  let _ = p.f() // error
  let _ = p.fMeta() // crash
}

…h invariant `Self`

The non-metatype case was never supported. The same should hold for the
existential metatype case, which used to miscompile and now crashes
because the invariant reference is deemed OK but the erasure expectedly
fails to handle it:

```swift
class C<T> {}
protocol P {
  associatedtype A

  func f() -> any P & C<A>
  func fMeta() -> any (P & C<A>).Type
}

do {
  let p: any P
  let _ = p.f() // error
  let _ = p.fMeta() // crash
}
```
@AnthonyLatsis
Copy link
Collaborator Author

@swift-ci please smoke test macOS

@AnthonyLatsis
Copy link
Collaborator Author

@swift-ci please smoke test

@AnthonyLatsis
Copy link
Collaborator Author

@swift-ci please smoke test Linux

@AnthonyLatsis AnthonyLatsis merged commit 6c9bb2a into swiftlang:main Jan 19, 2025
3 checks passed
@AnthonyLatsis AnthonyLatsis deleted the cocos-nucifera branch January 19, 2025 04:29
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.

2 participants