Skip to content

Commit 9c8e011

Browse files
committed
Remove SourceLocation.debugDescription
The debug description was lossy because it didn’t print file and offset. If we include that information, it’s so verbose that the debug description doesn’t really provide any benefit over the default debug description. Let’s just remove it.
1 parent b8dd2ea commit 9c8e011

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

Sources/SwiftSyntax/SourceLocation.swift

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
/// Represents a source location in a Swift file.
14-
public struct SourceLocation: Hashable, Codable, CustomDebugStringConvertible {
14+
public struct SourceLocation: Hashable, Codable {
1515

1616
/// The line in the file where this location resides. 1-based.
1717
///
@@ -46,13 +46,6 @@ public struct SourceLocation: Hashable, Codable, CustomDebugStringConvertible {
4646
/// location, otherwise this is the same as `file`.
4747
public let presumedFile: String
4848

49-
/// Returns the location as `<line>:<column>` for debugging purposes.
50-
/// Do not rely on this output being stable.
51-
public var debugDescription: String {
52-
// Print file name?
53-
return "\(line):\(column)"
54-
}
55-
5649
/// Create a new source location at the specified `line` and `column` in `file`.
5750
///
5851
/// - Parameters:
@@ -91,7 +84,7 @@ public struct SourceLocation: Hashable, Codable, CustomDebugStringConvertible {
9184
}
9285

9386
/// Represents a half-open range in a Swift file.
94-
public struct SourceRange: Hashable, Codable, CustomDebugStringConvertible {
87+
public struct SourceRange: Hashable, Codable {
9588

9689
/// The beginning location of the source range.
9790
///
@@ -104,12 +97,6 @@ public struct SourceRange: Hashable, Codable, CustomDebugStringConvertible {
10497
/// ie. this location is not included in the range.
10598
public let end: SourceLocation
10699

107-
/// A description describing this range for debugging purposes, don't rely on
108-
/// it being stable
109-
public var debugDescription: String {
110-
return "(\(start.debugDescription),\(end.debugDescription))"
111-
}
112-
113100
/// Construct a new source range, starting at `start` (inclusive) and ending
114101
/// at `end` (exclusive).
115102
public init(start: SourceLocation, end: SourceLocation) {

0 commit comments

Comments
 (0)