Skip to content

Update the interpolation failure message #2290

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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