Skip to content

GSB: Refactor diagnostics for redundant and conflicting superclass requirements #36712

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

Conversation

slavapestov
Copy link
Contributor

@slavapestov slavapestov commented Apr 2, 2021

Let's use the redundant requirement graph to diagnose these, just like we already do for redundant conformance and layout requirements.

Also, diagnose conflicts:

  • Multiple superclass requirements where neither is a superclass of the other
  • A superclass requirement and a concrete type requirement that is not a subclass
  • A layout requirement and a concrete type requirement that does not satisfy the layout requirement

The first two were already being diagnosed, the third is new. Here is an example:

struct G<T : AnyObject> {}

extension G where T == Int {}

We now reject this on account of T not satisfying AnyObject.

@slavapestov slavapestov force-pushed the gsb-conflicting-superclass-requirements branch from ceada1b to 172105d Compare April 2, 2021 05:02
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov
Copy link
Contributor Author

@swift-ci Please test source compatibility

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test macOS

5 similar comments
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test macOS

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test macOS

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test macOS

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test macOS

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test macOS

@slavapestov
Copy link
Contributor Author

swiftlang/sourcekit-lsp#384
@swift-ci Please smoke test macOS

@slavapestov
Copy link
Contributor Author

I merged these changes as part of the other PR.

@slavapestov slavapestov closed this Apr 4, 2021
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