Skip to content

Commit

Permalink
Merge pull request #2290 from ahoppen/ahoppen/interpolation-failure-m…
Browse files Browse the repository at this point in the history
…essage

Update the interpolation failure message
  • Loading branch information
ahoppen authored Oct 17, 2023
2 parents 72565a4 + 947e6f3 commit 8decbe4
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,14 @@ extension SyntaxParseable {
{
let diagnostics = ParseDiagnosticsGenerator.diagnostics(for: self)
let formattedDiagnostics = DiagnosticsFormatter().annotatedSource(tree: self, diags: diagnostics)
Logger(subsystem: "SwiftSyntax", category: "ParseError").fault(
Logger(subsystem: "org.swift.swift-syntax", category: "ParseError").fault(
"""
Parsing a `\(Self.self)` node from string interpolation produced the following parsing errors.
Set a breakpoint in `SyntaxParseable.logStringInterpolationParsingError()` to debug the failure.
To explicitly support parsing of invalid source code, import SwiftParser and invoke the parser as follows
var parser = Parser(source)
\(Self.self).parse(from: &parser)
\(formattedDiagnostics, privacy: .private)
"""
)
Expand All @@ -61,7 +65,7 @@ extension SyntaxParseable {

/// Initialize the syntax node from a string interpolation.
///
/// - Important: This asssumes that the string interpolation produces a valid
/// - Important: This assumes that the string interpolation produces a valid
/// syntax tree. If the syntax tree is not valid, a fault will
/// be logged using OSLog on Darwin platforms.
public init(stringInterpolation: SyntaxStringInterpolation) {
Expand Down

0 comments on commit 8decbe4

Please sign in to comment.