Skip to content

Commit 925a0c0

Browse files
committed
Fix deprecation warning
1 parent 5a914f9 commit 925a0c0

File tree

10 files changed

+15
-15
lines changed

10 files changed

+15
-15
lines changed

Sources/SwiftCompilerPluginMessageHandling/PluginMacroExpansionContext.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class SourceManager {
4343

4444
/// Location converter to get line/column in the node.
4545
lazy var locationConverter: SourceLocationConverter = .init(
46-
file: self.location.fileName,
46+
fileName: self.location.fileName,
4747
tree: self.node
4848
)
4949
}

Sources/SwiftDiagnostics/Diagnostic.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public struct Diagnostic: CustomDebugStringConvertible {
6868
}
6969

7070
public var debugDescription: String {
71-
let locationConverter = SourceLocationConverter(file: "", tree: node.root)
71+
let locationConverter = SourceLocationConverter(fileName: "", tree: node.root)
7272
let location = location(converter: locationConverter)
7373
return "\(location.line):\(location.column): \(message)"
7474
}

Sources/SwiftDiagnostics/DiagnosticsFormatter.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public struct DiagnosticsFormatter {
189189
suffixTexts: [AbsolutePosition: String],
190190
sourceLocationConverter: SourceLocationConverter? = nil
191191
) -> String {
192-
let slc = sourceLocationConverter ?? SourceLocationConverter(file: fileName ?? "", tree: tree)
192+
let slc = sourceLocationConverter ?? SourceLocationConverter(fileName: fileName ?? "", tree: tree)
193193

194194
// First, we need to put each line and its diagnostics together
195195
var annotatedSourceLines = [AnnotatedSourceLine]()

Sources/SwiftDiagnostics/GroupedDiagnostics.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ extension GroupedDiagnostics {
142142
) -> String {
143143
let sourceFile = sourceFiles[sourceFileID.id]
144144
let slc = SourceLocationConverter(
145-
file: sourceFile.displayName,
145+
fileName: sourceFile.displayName,
146146
tree: sourceFile.tree
147147
)
148148

Sources/SwiftDiagnostics/Note.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public struct Note: CustomDebugStringConvertible {
5757

5858
public var debugDescription: String {
5959
if let root = node.root.as(SourceFileSyntax.self) {
60-
let locationConverter = SourceLocationConverter(file: "", tree: root)
60+
let locationConverter = SourceLocationConverter(fileName: "", tree: root)
6161
let location = location(converter: locationConverter)
6262
return "\(location): \(message)"
6363
} else {

Sources/SwiftSyntaxMacroExpansion/BasicMacroExpansionContext.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,10 @@ extension BasicMacroExpansionContext: MacroExpansionContext {
139139
fileName: String
140140
) -> SourceLocation {
141141
guard let nodeInOriginalTree = detachedNodes[node.root] else {
142-
return SourceLocationConverter(file: fileName, tree: node.root).location(for: position)
142+
return SourceLocationConverter(fileName: fileName, tree: node.root).location(for: position)
143143
}
144144
let adjustedPosition = position + SourceLength(utf8Length: nodeInOriginalTree.position.utf8Offset)
145-
return SourceLocationConverter(file: fileName, tree: nodeInOriginalTree.root).location(for: adjustedPosition)
145+
return SourceLocationConverter(fileName: fileName, tree: nodeInOriginalTree.root).location(for: adjustedPosition)
146146
}
147147

148148
public func location(
@@ -197,7 +197,7 @@ extension BasicMacroExpansionContext: MacroExpansionContext {
197197
}
198198

199199
// Do the location lookup.
200-
let converter = SourceLocationConverter(file: fileName, tree: rootSourceFile)
200+
let converter = SourceLocationConverter(fileName: fileName, tree: rootSourceFile)
201201
return AbstractSourceLocation(converter.location(for: rawPosition + offsetAdjustment))
202202
}
203203
}

Sources/_SwiftSyntaxTestSupport/SyntaxComparison.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ extension TreeDifference: CustomDebugStringConvertible {
4343
public var debugDescription: String {
4444
let includeTrivia = reason == .trivia
4545

46-
let expectedConverter = SourceLocationConverter(file: "Baseline.swift", tree: baseline.root)
47-
let actualConverter = SourceLocationConverter(file: "Actual.swift", tree: node.root)
46+
let expectedConverter = SourceLocationConverter(fileName: "Baseline.swift", tree: baseline.root)
47+
let actualConverter = SourceLocationConverter(fileName: "Actual.swift", tree: node.root)
4848

4949
let expectedDesc = baseline.debugDescription(includeTrivia: includeTrivia, converter: expectedConverter)
5050
let actualDesc = node.debugDescription(includeTrivia: includeTrivia, converter: actualConverter)

Tests/SwiftParserTest/Assertions.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ func assertLocation<T: SyntaxProtocol>(
338338
line: UInt = #line
339339
) {
340340
if let markerLoc = markerLocations[locationMarker] {
341-
let locationConverter = SourceLocationConverter(file: "", tree: tree)
341+
let locationConverter = SourceLocationConverter(fileName: "", tree: tree)
342342
let actualLocation = location
343343
let expectedLocation = locationConverter.location(for: AbsolutePosition(utf8Offset: markerLoc))
344344
if actualLocation.line != expectedLocation.line || actualLocation.column != expectedLocation.column {
@@ -362,7 +362,7 @@ func assertNote<T: SyntaxProtocol>(
362362
expected spec: NoteSpec
363363
) {
364364
XCTAssertEqual(note.message, spec.message, file: spec.file, line: spec.line)
365-
let locationConverter = SourceLocationConverter(file: "", tree: tree)
365+
let locationConverter = SourceLocationConverter(fileName: "", tree: tree)
366366
assertLocation(
367367
note.location(converter: locationConverter),
368368
in: tree,
@@ -381,7 +381,7 @@ func assertDiagnostic<T: SyntaxProtocol>(
381381
markerLocations: [String: Int],
382382
expected spec: DiagnosticSpec
383383
) {
384-
let locationConverter = SourceLocationConverter(file: "", tree: tree)
384+
let locationConverter = SourceLocationConverter(fileName: "", tree: tree)
385385
assertLocation(
386386
diag.location(converter: locationConverter),
387387
in: tree,

Tests/SwiftParserTest/ParserTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class ParserTests: XCTestCase {
3939
let diagnostics = ParseDiagnosticsGenerator.diagnostics(for: parsed)
4040
if !diagnostics.isEmpty {
4141
var locationAndDiagnostics: [String] = []
42-
let locationConverter = SourceLocationConverter(file: fileURL.lastPathComponent, tree: parsed)
42+
let locationConverter = SourceLocationConverter(fileName: fileURL.lastPathComponent, tree: parsed)
4343
for diag in diagnostics {
4444
let location = diag.location(converter: locationConverter)
4545
let message = diag.message

Tests/SwiftParserTest/StringLiteralRepresentedLiteralValueTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ public class StringLiteralRepresentedLiteralValueTests: XCTestCase {
302302

303303
super.init(viewMode: .sourceAccurate)
304304

305-
self.locationConverter = SourceLocationConverter(file: "", tree: syntax)
305+
self.locationConverter = SourceLocationConverter(fileName: "", tree: syntax)
306306
self.walk(syntax)
307307
self.locationConverter = nil
308308
}

0 commit comments

Comments
 (0)