Skip to content

[5.5] [IDE] Fix superclass constraint handling for extension merging #37308

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
May 7, 2021

Conversation

hamishknight
Copy link
Contributor

5.5 cherry-pick of #37295


For a case like:

public class C<T> {}
public class D {}

extension C where T : D {
  public func foo() {}
}

We would indadvertedly drop the extension for C in the doc info, as the superclass constraint would fail the isBindableToSuperclassOf check. Instead, map the subject type of the constraint into the context and check if it could be bound to the superclass. In the example above, this is trivially true, but for cases where we're mirroring a protocol extension onto the type, this will disregard those that don't fulfil the requirements.

Resolves rdar://76868074

For a case like:

```
public class C<T> {}
public class D {}

extension C where T : D {
  public func foo() {}
}
```

We would indadvertedly drop the extension for `C`
in the doc info, as the superclass constraint would
fail the `isBindableToSuperclassOf` check.
Instead, map the subject type of the constraint
into the context and check if it could be bound to
the superclass. In the example above, this is
trivially true, but for cases where we're mirroring
a protocol extension onto the type, this will
disregard those that don't fulfil the requirements.

Resolves rdar://76868074
@hamishknight hamishknight requested a review from a team as a code owner May 7, 2021 09:50
@hamishknight hamishknight requested a review from akyrtzi May 7, 2021 09:50
@hamishknight
Copy link
Contributor Author

@swift-ci please test

@akyrtzi akyrtzi merged commit ce3f107 into swiftlang:release/5.5 May 7, 2021
@hamishknight hamishknight deleted the extra-extensions-5.5 branch May 7, 2021 17:10
@AnthonyLatsis AnthonyLatsis added swift 5.5 🍒 release cherry pick Flag: Release branch cherry picks labels Jan 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 5.5
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants