Skip to content

Commit d218336

Browse files
authored
Make Diagnostic initializers public
For tools that use SwiftSyntax, it's quite useful to be able to emit their own diagnostics while reusing the `Diagnostic` type from SwiftSyntax. Both `Diagnostic` and its `Builder` type are `public`, and properties of `Diagnostic` are `public` too, but initializers are implicitly `internal`. This means that instances of `Diagnostic` can't be created by tools using SwiftSyntax. I hope this can be fixed with this simple change.
1 parent 723445c commit d218336

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/SwiftSyntax/Diagnostic.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ public struct Diagnostic: Codable, CustomDebugStringConvertible {
248248
/// - location: The location the diagnostic is attached to.
249249
/// - actions: A closure that's used to attach notes and highlights to
250250
/// diagnostics.
251-
init(message: Message, location: SourceLocation?,
251+
public init(message: Message, location: SourceLocation?,
252252
actions: ((inout Builder) -> Void)?) {
253253
var builder = Builder()
254254
actions?(&builder)
@@ -263,7 +263,7 @@ public struct Diagnostic: Codable, CustomDebugStringConvertible {
263263
/// - location: The location the diagnostic is attached to.
264264
/// - highlights: An array of SourceRanges which will be highlighted when
265265
/// the diagnostic is presented.
266-
init(message: Message, location: SourceLocation?, notes: [Note],
266+
public init(message: Message, location: SourceLocation?, notes: [Note],
267267
highlights: [SourceRange], fixIts: [FixIt]) {
268268
self.message = message
269269
self.location = location

0 commit comments

Comments
 (0)