-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Requestify Extension Type Validation #26844
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
@swift-ci please smoke test |
lib/AST/TypeCheckRequests.cpp
Outdated
//----------------------------------------------------------------------------// | ||
|
||
Optional<Type> ExtendedTypeRequest::getCachedResult() const { | ||
auto *ext = std::get<0>(getStorage()); |
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.
Perhaps ExtensionDecl could just store a TypeRepr instead of a TypeLoc and we can use built-in caching for this.
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 idea. Lots of cleanup falling out of this.
0777b27
to
2aa2215
Compare
@swift-ci please smoke test |
Replumb the TypeLoc for the extended type as a TypeRepr instead. Fixup the myriad callsites this touches in the process.
2aa2215
to
8d22702
Compare
@swift-ci please smoke test |
@swift-ci please smoke test |
@@ -14,8 +14,5 @@ | |||
// CHECK1: s:4Foo219FooOverlayClassBaseC | |||
// CHECK1: FooOverlayClassBase.Type | |||
|
|||
// RUN: %sourcekitd-test -req=interface-gen %S/Inputs/UnresolvedExtension.swift -- %S/Inputs/UnresolvedExtension.swift | %FileCheck -check-prefix=CHECK2 %s |
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.
@akyrtzi Can you remember what this test was trying to do? It seems like pure coincidence that it passed before.
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 don't quite remember but I'd guess this is likely to have been checking that this test case doesn't trigger a crash.
@swift-ci please smoke test |
I wonder if this patch could be a step towards resolving TF-632: supporting extensions of synthesized member types? Related forum discussion. Perhaps not; @slavapestov's suggestions at the bottom of the thread suggest handling TF-632 requires lower-level name lookup changes. struct TF_632<T: Differentiable, U: Differentiable>: @memberwise Differentiable {
var x: T
var y: U
// The compiler synthesizes:
// struct TangentVector: Differentiable, AdditiveArithmetic {
// var x: T.TangentVector
// var y: U.TangentVector
// }
}
|
⛵️ |
No description provided.