File tree Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ extension Parser {
57
57
if self . at ( . identifier) || self . at ( any: [ . selfKeyword, . capitalSelfKeyword] ) {
58
58
ident = self . expectIdentifierWithoutRecovery ( )
59
59
} else if flags. contains ( . operators) , let ( _, _) = self . at ( anyIn: Operator . self) {
60
- ident = self . consumeAnyToken ( remapping: . identifier )
60
+ ident = self . consumeAnyToken ( remapping: . unspacedBinaryOperator )
61
61
} else if flags. contains ( . keywords) && self . currentToken. tokenKind. isKeyword {
62
62
ident = self . consumeAnyToken ( remapping: . identifier)
63
63
} else {
Original file line number Diff line number Diff line change @@ -177,6 +177,7 @@ func AssertDiagnostic<T: SyntaxProtocol>(
177
177
func AssertParse(
178
178
_ markedSource: String ,
179
179
substructure expectedSubstructure: Syntax ? = nil ,
180
+ substructureAfterMarker: String = " START " ,
180
181
diagnostics expectedDiagnostics: [ DiagnosticSpec ] = [ ] ,
181
182
fixedSource expectedFixedSource: String ? = nil ,
182
183
file: StaticString = #file,
@@ -185,6 +186,7 @@ func AssertParse(
185
186
return AssertParse ( markedSource,
186
187
{ $0. parseSourceFile ( ) } ,
187
188
substructure: expectedSubstructure,
189
+ substructureAfterMarker: substructureAfterMarker,
188
190
diagnostics: expectedDiagnostics,
189
191
fixedSource: expectedFixedSource,
190
192
file: file,
Original file line number Diff line number Diff line change @@ -577,4 +577,12 @@ final class ExpressionTests: XCTestCase {
577
577
_ = ##""" foo # "# "##
578
578
"""### )
579
579
}
580
+
581
+ func testOperatorReference( ) {
582
+ AssertParse (
583
+ " reduce(0, #^PLUS^#+) " ,
584
+ substructure: Syntax ( TokenSyntax . unspacedBinaryOperator ( " + " ) ) ,
585
+ substructureAfterMarker: " PLUS "
586
+ )
587
+ }
580
588
}
You can’t perform that action at this time.
0 commit comments