mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Change diagnostic error thrown for when string interpolations aren't closed by a parenthesis (#58882)
[Parse] Diagnose unclosed string interpolations
This commit is contained in:
33
test/Parse/unclosed-string-interpolation.swift
Normal file
33
test/Parse/unclosed-string-interpolation.swift
Normal file
@@ -0,0 +1,33 @@
|
||||
// RUN: %target-typecheck-verify-swift
|
||||
|
||||
let mid = "pete"
|
||||
|
||||
_ = "mid == \(pete"
|
||||
// expected-error @-1 {{cannot find ')' to match opening '(' in string interpolation}}
|
||||
// expected-error @-2 {{unterminated string literal}}
|
||||
|
||||
let theGoat = "kanye \("
|
||||
// expected-error @-1 {{cannot find ')' to match opening '(' in string interpolation}}
|
||||
// expected-error @-2 {{unterminated string literal}}
|
||||
|
||||
let equation1 = "2 + 2 = \(2 + 2"
|
||||
// expected-error @-1 {{cannot find ')' to match opening '(' in string interpolation}}
|
||||
// expected-error @-2 {{unterminated string literal}}
|
||||
|
||||
let s = "\(x"; print(x)
|
||||
// expected-error @-1 {{cannot find ')' to match opening '(' in string interpolation}}
|
||||
// expected-error @-2 {{unterminated string literal}}
|
||||
|
||||
let zzz = "\(x; print(x)
|
||||
// expected-error @-1 {{cannot find ')' to match opening '(' in string interpolation}}
|
||||
// expected-error @-2 {{unterminated string literal}}
|
||||
|
||||
let goatedAlbum = "The Life Of \("Pablo"
|
||||
// expected-error @-1 {{cannot find ')' to match opening '(' in string interpolation}}
|
||||
// expected-error @-2 {{unterminated string literal}}
|
||||
|
||||
// expected-error @+3 {{cannot find ')' to match opening '(' in string interpolation}}
|
||||
// expected-error @+1 {{unterminated string literal}}
|
||||
_ = """
|
||||
\(
|
||||
"""
|
||||
Reference in New Issue
Block a user