-
Notifications
You must be signed in to change notification settings - Fork 441
Merge nominal parsing into the one function #968
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
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.
Thank you! This was bugging me
Heh, I actually did this because I noticed that |
@swift-ci please test |
b928b76
to
dcdc4c2
Compare
@@ -804,7 +804,7 @@ final class DeclarationTests: XCTestCase { | |||
|
|||
func testDontRecoverFromDeclKeyword() { | |||
AssertParse( | |||
"func foo(first second 1️⃣third 3️⃣struct4️⃣: Int) {}", | |||
"func foo(first second 1️⃣third 2️⃣struct3️⃣: Int4️⃣) {}", |
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 was previously parsing just struct
with all unexpected, but now (after also checking for start of line) parses the remained as a struct
instead.
) -> T where T: NominalTypeDeclarationTrait { | ||
let (unexpectedBeforeIntroducerKeyword, introducerKeyword) = self.eat(introucerHandle) | ||
let (unexpectedBeforeName, name) = self.expectIdentifier(keywordRecovery: true) | ||
if unexpectedBeforeName == nil && name.isMissing && self.currentToken.isAtStartOfLine { |
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.
And to be clear - self.currentToken.isAtStartOfLine
is the change here.
@swift-ci please test |
4f4583e
to
0030cac
Compare
@swift-ci please test |
DiagnosticSpec(locationMarker: "3️⃣", message: "expected identifier in protocol"), | ||
DiagnosticSpec(locationMarker: "4️⃣", message: "unexpected code '>(x: T)' in protocol"), |
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 figure this is no worse. But... also isn't great.
All nominals had extremely similar parse functions. Merge them into the one function so that improvements to one improves them all.
0030cac
to
301047b
Compare
@swift-ci please test |
All nominals had extremely similar parse functions. Merge them into the one function so that improvements to one improves them all.