File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
Sources/SwiftParser/Lexer Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -1777,7 +1777,7 @@ extension Lexer.Cursor {
17771777 error: error,
17781778 stateTransition: . push( newState: . inStringInterpolationStart( stringLiteralKind: stringLiteralKind) )
17791779 )
1780- } else if self . isAtEscapedNewline ( delimiterLength: delimiterLength) {
1780+ } else if stringLiteralKind == . multiLine && self . isAtEscapedNewline ( delimiterLength: delimiterLength) {
17811781 return Lexer . Result (
17821782 . stringSegment,
17831783 trailingTriviaLexingMode: . escapedNewlineInMultiLineStringLiteral
Original file line number Diff line number Diff line change @@ -1666,6 +1666,21 @@ final class StatementExpressionTests: XCTestCase {
16661666 )
16671667 }
16681668
1669+
1670+ func testUnterminatedString6( ) {
1671+ AssertParse (
1672+ #"""
1673+ "abc1️⃣\2️⃣
1674+ (def)3️⃣"4️⃣
1675+ """# ,
1676+ diagnostics: [
1677+ DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " invalid escape sequence in literal " ) ,
1678+ DiagnosticSpec ( locationMarker: " 2️⃣ " , message: #"expected '"' to end string literal"# ) ,
1679+ DiagnosticSpec ( locationMarker: " 3️⃣ " , message: " consecutive statements on a line must be separated by ';' " ) ,
1680+ DiagnosticSpec ( locationMarker: " 4️⃣ " , message: #"expected '"' to end string literal"# ) ,
1681+ ]
1682+ )
1683+ }
16691684 func testStringLiteralAfterKeyPath( ) {
16701685 AssertParse (
16711686 #"""
You can’t perform that action at this time.
0 commit comments