-
Notifications
You must be signed in to change notification settings - Fork 10.5k
AST: Stop pretending that conformance lookup takes the module into account #74998
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
AST: Stop pretending that conformance lookup takes the module into account #74998
Conversation
@swift-ci Please smoke test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the right question is: should it take the module into account?
If we're ignoring the module, what actually happens if we can see conformances in multiple modules? Do we just resolve to one arbitrarily?
We return the first conformance output by NominalTypeDecl::lookupConformance(), in whatever order they're stored in within the ConformanceLookupTable. |
@swift-ci Please smoke test |
I think you're both right: it should take the module into account, but in practice it doesn't, and few uses of |
I think the disambiguating rule needs to be global anyway, for example if one conformance is retroactive and the other isn’t, we should prefer the non-retroactive one. If both are retroactive we should return an invalid conformance (possibly encoding the overlap for downstream diagnostics). |
Okay. My language design sense is that, to the extent that we want to support multiple conformances, we probably need some level of site-specific disambiguation analogous to C++'s If we're in agreement that that's the right future direction, then yeah, I think this should move forward. |
swiftlang/llvm-project#8950 |
Based on your discussion with John and Joe, this looks like a reasonable change. My only question is, why not go further? Now that these methods are static, putting them in |
Well, my original plan was to convert call sites incrementally, because you can still write I'll do the renaming in a separate PR. |
…sion instead of -strict-concurrency Also add some comments to explain what in the world is going on with the new checks.
287faac
to
ca9c09f
Compare
swiftlang/llvm-project#8950 |
It has never taken the module into account, and callers are just passing in the nearest random module they can reach from whatever other AST object they have on hand.