Skip to content

[Syntax] Parse attributed types in expr position as TypeExprSyntax #34257

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

Merged
merged 1 commit into from
Oct 10, 2020

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Oct 9, 2020

rdar://problem/70101520
https://bugs.swift.org/browse/SR-13711

@rintaro
Copy link
Member Author

rintaro commented Oct 9, 2020

@swift-ci Please smoke test

@rintaro rintaro requested a review from allevato October 9, 2020 22:26
@@ -73,6 +73,7 @@ class C <MemberDeclBlock>{<MemberDeclListItem><FunctionDecl>

func foo3<FunctionSignature><ParameterClause>() </ParameterClause></FunctionSignature><CodeBlock>{<SequenceExpr><DiscardAssignmentExpr>
_ </DiscardAssignmentExpr><AssignmentExpr>= </AssignmentExpr><FunctionCallExpr><ArrayExpr>[<ArrayElement><TypeExpr><SimpleTypeIdentifier>Any</SimpleTypeIdentifier></TypeExpr></ArrayElement>]</ArrayExpr>()</FunctionCallExpr></SequenceExpr><SequenceExpr><DiscardAssignmentExpr>
_ </DiscardAssignmentExpr><AssignmentExpr>= </AssignmentExpr><MemberAccessExpr><TupleExpr>(<TupleExprElement><AttributedType><Attribute>@convention(c) </Attribute><FunctionType>(<TupleTypeElement><SimpleTypeIdentifier>Int</SimpleTypeIdentifier></TupleTypeElement>) -> <SimpleTypeIdentifier>Void</SimpleTypeIdentifier></FunctionType></AttributedType></TupleExprElement>)</TupleExpr>.self</MemberAccessExpr></SequenceExpr><SequenceExpr><DiscardAssignmentExpr>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to ExprNodes.py, the expression child of a TupleExprElement must be of kind Expr. But if I'm reading this XML correctly, would this attempt to put an AttributedType directly into the TupleExprElement, which wouldn't "fit" because an AttributedType isn't an Expr?

What would this look like when SwiftSyntax tries to parse it into the gybbed data types; i.e., how would I access the type?

Copy link
Member Author

@rintaro rintaro Oct 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah sorry, the test result file is outdated (I forgot to git add I believe). Will fix.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@rintaro rintaro force-pushed the syntax-typeexpr-rdar70101520 branch from e8256ae to 4117512 Compare October 10, 2020 00:19
@rintaro
Copy link
Member Author

rintaro commented Oct 10, 2020

@swift-ci Please smoke test

Copy link
Member

@allevato allevato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants