-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Nuke DeclChecker::IsFirstPass #15731
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
Nuke DeclChecker::IsFirstPass #15731
Conversation
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.
Awesome!
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.
Looks great, thank you!
@@ -527,11 +528,6 @@ static void typeCheckFunctionsAndExternalDecls(SourceFile &SF, TypeChecker &TC) | |||
for (AbstractFunctionDecl *FD : TC.definedFunctions) { | |||
TC.checkFunctionErrorHandling(FD); | |||
} | |||
for (auto decl : TC.Context.ExternalDefinitions) { | |||
if (auto fn = dyn_cast<AbstractFunctionDecl>(decl)) { | |||
TC.checkFunctionErrorHandling(fn); |
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.
Nice catch!
lib/Sema/TypeChecker.cpp
Outdated
@@ -462,6 +462,18 @@ static void typeCheckFunctionsAndExternalDecls(SourceFile &SF, TypeChecker &TC) | |||
TC.finalizeDecl(decl); | |||
} | |||
|
|||
// Type check conformance contexts. | |||
for (unsigned i = 0; i != TC.ConformanceContexts.size(); ++i) { |
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.
Good choice; I like doing this as a later "pass" anyway at this point, because it makes us less likely to be order-sensitive in the interim.
0ade261
to
ec5946c
Compare
ec5946c
to
6f79c2f
Compare
I tried doing this directly from typeCheckDecl(), but it breaks associated type inference. We can figure this out later when declaration checking becomes lazier and more incremental. Note that typo correction does not force witnesses of synthesized conformances. This means that a typo correction from a top-level form will no longer pick up synthesized witnesses, and will find the protocol requirement instead. To give a test the same behavior as before, I put the expression in a function body instead of a top-level form. Note that we already had the same behavior with typo correction from pattern binding initializers and other contexts that are type checked before conformances.
6f79c2f
to
5e4f5a4
Compare
@swift-ci Please test |
@swift-ci Please test source compatibility |
2 similar comments
@swift-ci Please test source compatibility |
@swift-ci Please test source compatibility |
Build failed |
@swift-ci Please test |
The epic season finale of #15729.