-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Refactor checkGenericArguments() and related code #31226
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
Refactor checkGenericArguments() and related code #31226
Conversation
@CodaFi The last commit re-indents part of TypeChecker.h; ignore it for the purposes of the review. |
@swift-ci Please smoke test |
@swift-ci Please test source compatibility |
Builder died @swift-ci test source compatibility release |
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.
…anceInModule Calling TypeChecker::conformsToProtocol() with SkipConditionalRequirements and an invalid SourceLoc() is now the same as calling ModuleDecl::lookupConformance(), so we can replace all usages of TypeChecker::LookUpConformance with LookUpConformanceInModule.
…rguments() All callers were just doing module lookups.
…g autodiff attributes
All callers can trivially be refactored to use ModuleDecl::lookupConformance() instead. Since this was the last flag in ConformanceCheckOptions, we can remove that, too.
c77f2e8
to
796fd46
Compare
@swift-ci Please smoke test |
@swift-ci Please test source compatibility |
1 similar comment
@swift-ci Please test source compatibility |
@swift-ci Please smoke test |
@swift-ci Please test source compatibility |
Now that
TypeChecker::conformsToProtocol()
no longer uses the DeclContext to record dependencies, we can make a few simplifications:ModuleDecl::lookupConformance()
insteadConformanceCheckFlags
now that the last remaining flag is gonecheckGenericArguments()
a littleThe last remaining usage of the DeclContext is a
mapTypeIntoContext()
call incheckGenericArguments()
.The next step is to refactor
checkGenericArguments()
andconformsToProtocol()
to take a module instead of a DeclContext.After that, I would like to split off the diagnostics and listener logic from
checkGenericArguments()
into a new method, and move the lower-level semantic query from Sema to AST.