-
Notifications
You must be signed in to change notification settings - Fork 449
Fix member type/expression parsing #1077
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 test |
Note that this depends on #1076 (which is included in this PR right now) and the FIXME in https://github.com/apple/swift/pull/62092should be able to be removed after this (looks like there's already a |
f07e6ff
to
fa225db
Compare
@swift-ci please test |
fa225db
to
3dba4f1
Compare
@swift-ci please test |
3dba4f1
to
be258d0
Compare
@swift-ci please test |
853619a
to
75cabed
Compare
@swift-ci please test |
c74a505
to
6c5b7aa
Compare
@swift-ci please test |
.Type
and .Protocol
as MetatypeTypeSyntax
6c5b7aa
to
53bad89
Compare
@swift-ci please test |
@swift-ci please test |
7b425a9
to
dfe5ff7
Compare
@swift-ci please test |
dfe5ff7
to
9aeeb18
Compare
@swift-ci please test |
9aeeb18
to
aaa739d
Compare
@swift-ci please test |
Removed by swift-syntax in swiftlang/swift-syntax#1077.
@swift-ci please test |
- Parse `.Type` and `.Protocol` as `MetatypeTypeSyntax` - Parse keywords in member position as identifiers - Generate a missing identifier rather than unexpected nodes if the next token is on a new line - Diagnose extraneous whitespace after `.` if there was no leading whitespace - Remove `.prefixPeriod` since it is no longer used
aaa739d
to
cf85878
Compare
@swift-ci please test |
mutating func canParseOldStyleProtocolComposition() -> Bool { | ||
self.eat(.protocolKeyword) | ||
|
||
// Check for the starting '<'. | ||
guard self.currentToken.starts(with: "<") else { | ||
return false | ||
} | ||
|
||
self.consumePrefix("<", as: .leftAngle) | ||
|
||
// Check for empty protocol composition. | ||
if self.currentToken.starts(with: ">") { | ||
self.consumePrefix(">", as: .rightAngle) | ||
return true | ||
} | ||
|
||
// Parse the type-composition-list. | ||
var loopProgress = LoopProgressCondition() | ||
repeat { | ||
guard self.canParseTypeIdentifier() else { | ||
return false; | ||
} | ||
} while self.consume(if: .comma) != nil && loopProgress.evaluate(currentToken) | ||
|
||
// Check for the terminating '>'. | ||
guard self.currentToken.starts(with: ">") else { | ||
return false | ||
} | ||
self.consumePrefix(">", as: .rightAngle) | ||
|
||
return true | ||
} |
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.
@bnbarham Was this removed on purpose?
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.
@AnthonyLatsis Yes, in SwiftParser
we decided not to support old style protocol composition at all (there's no parseOldStyleProtocolComposition()
.) So keeping canParseOldStyleProtocolComposition()
doesn't make sense.
Removed by swift-syntax in swiftlang/swift-syntax#1077.
Few fixes to member parsing:
.Type
and.Protocol
asMetatypeTypeSyntax
token is on a new line
.
if there was no leadingwhitespace
.prefixPeriod
since it is no longer used