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 {
1777
1777
error: error,
1778
1778
stateTransition: . push( newState: . inStringInterpolationStart( stringLiteralKind: stringLiteralKind) )
1779
1779
)
1780
- } else if self . isAtEscapedNewline ( delimiterLength: delimiterLength) {
1780
+ } else if stringLiteralKind == . multiLine && self . isAtEscapedNewline ( delimiterLength: delimiterLength) {
1781
1781
return Lexer . Result (
1782
1782
. stringSegment,
1783
1783
trailingTriviaLexingMode: . escapedNewlineInMultiLineStringLiteral
Original file line number Diff line number Diff line change @@ -1666,6 +1666,21 @@ final class StatementExpressionTests: XCTestCase {
1666
1666
)
1667
1667
}
1668
1668
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
+ }
1669
1684
func testStringLiteralAfterKeyPath( ) {
1670
1685
AssertParse (
1671
1686
#"""
You can’t perform that action at this time.
0 commit comments