-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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] Sink ParamDecl flag collection logic from Parse to AST #79503
Conversation
@@ -276,7 +275,6 @@ extension ASTGenVisitor { | |||
params.reserveCapacity(node.parameters.count) | |||
for (index, node) in node.parameters.enumerated() { | |||
let param = self.generate(closureParameter: node, at: index) | |||
param.setSpecifier(.default) |
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.
This line was a mistake because this set the closure parameter specifier to .default
even if the TypeRepr
has been set. So closures like { (arg: inout T) in .. }
wasn't correctly generated.
@swift-ci Please smoke test |
@@ -8712,6 +8712,45 @@ ParamDecl *ParamDecl::createParsed( | |||
return decl; | |||
} | |||
|
|||
void ParamDecl::setTypeRepr(TypeRepr *repr) { | |||
TyReprAndFlags.setPointer(repr); |
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.
Can we assert that the type repr hasn't been set before?
* Collect flag in `ParamDecl::setTypeRepr()`. * [ASTGen] Separate `BridgedParamDecl.setTypeRepr(_:)` from `BridgedParamDecl.createParsed(_:)` aligning with C++ API. The majority of the creations don't set the typerepr. * Update `ParamSpecifierRequest::evaluate` to handle non-implicit `ParamDecl` without `TypeRepr` (i.e. untyped closure parameter), instead of `setSpecifier(::Default)` manually in Parse.
86f421a
to
8833ff5
Compare
@swift-ci Please smoke test |
swiftlang/swift-corelibs-foundation#5174 |
@swift-ci Please smoke test Windows |
Collect flags in
ParamDecl::setTypeRepr()
.Update
ParamSpecifierRequest::evaluate
to handle non-implicitParamDecl
withoutTypeRepr
(i.e. untyped closure parameter), instead ofsetSpecifier(::Default)
manually in Parse.(ASTGen) Separate
BridgedParamDecl.setTypeRepr(_:)
fromBridgedParamDecl.createParsed(_:)
aligning with C++ API. The majority of the creations don't set the typerepr.