Skip to content

Refactor conformance checker diagnostics #71041

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

Conversation

slavapestov
Copy link
Contributor

@slavapestov slavapestov commented Jan 21, 2024

This PR moves delayed diagnostics state entirely out of ConformanceChecker. The goal is to decouple type witness inference from ConformanceChecker, leaving it in charge of value witness inference only. This will in turn lead to better request evaluator usage in type witness inference.

This also fixes a case where we accepted invalid AST because a protocol conformance check failed in a secondary source file. We now emit a fallback diagnostic type T does not conform to protocol P in this case. The source location is chosen to be that of the innermost active request that refers to a primary file; if no active requests have such a location, we use the location of the conformance instead.

With a few more cleanups this will allow removing the older reference to invalid associated type fallback diagnostic, which is inaccurate because it misses cases where the invalid type witness ends up in a substitution map, or if the type witness is valid but does not satisfy an associated conformance requirement.

@slavapestov
Copy link
Contributor Author

@swift-ci Please test source compatibility

@slavapestov slavapestov force-pushed the refactor-conformance-checker-diagnostics branch from f2a7222 to 76d9805 Compare January 21, 2024 12:39
@slavapestov slavapestov requested a review from ktoso as a code owner January 21, 2024 12:39
@slavapestov slavapestov force-pushed the refactor-conformance-checker-diagnostics branch from 76d9805 to 0bc2e3f Compare January 21, 2024 13:35
@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

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