File tree Expand file tree Collapse file tree 2 files changed +24
-4
lines changed Expand file tree Collapse file tree 2 files changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -944,13 +944,13 @@ extension Parser.Lookahead {
944944 // by a type annotation.
945945 if self . startsParameterName ( isClosure: false , allowMisplacedSpecifierRecovery: false ) {
946946 self . consumeAnyToken ( )
947+ // If we have a secondary argument label, consume it.
947948 if self . atArgumentLabel ( ) {
948949 self . consumeAnyToken ( )
949- guard self . at ( . colon) else {
950- return false
951- }
952950 }
953- self . eat ( . colon)
951+ guard self . consume ( if: . colon) != nil else {
952+ return false
953+ }
954954
955955 // Parse a type.
956956 guard self . canParseType ( ) else {
Original file line number Diff line number Diff line change @@ -2145,6 +2145,26 @@ final class ExpressionTests: ParserTestCase {
21452145 """
21462146 )
21472147 }
2148+
2149+ func testSecondaryArgumentLabelDollarIdentifierInClosure( ) {
2150+ assertParse (
2151+ """
2152+ ℹ️{ a1️⃣: (a $
2153+ """ ,
2154+ diagnostics: [
2155+ DiagnosticSpec (
2156+ message: " expected '}' to end closure " ,
2157+ notes: [ NoteSpec ( message: " to match this opening '{' " ) ] ,
2158+ fixIts: [ " insert '}' " ]
2159+ ) ,
2160+ DiagnosticSpec ( message: " extraneous code ': (a $' at top level " ) ,
2161+ ] ,
2162+ fixedSource: """
2163+ { a
2164+ }: (a $
2165+ """
2166+ )
2167+ }
21482168}
21492169
21502170final class MemberExprTests : ParserTestCase {
You can’t perform that action at this time.
0 commit comments