@@ -524,53 +524,43 @@ extension String.Index {
524
524
}
525
525
}
526
526
527
- /// A textual representation of this instance.
527
+ /// A textual representation of this instance, intended for debugging .
528
528
///
529
529
/// - Important: The contents of the returned string are not guaranteed to
530
530
/// remain stable: they may arbitrarily change in any Swift release.
531
531
@_alwaysEmitIntoClient // FIXME: Use @backDeployed
532
532
@inline ( never)
533
- public var description : String {
533
+ public var debugDescription : String {
534
534
// 23[utf8]+1
535
535
var d = " \( _encodedOffset) [ \( _encodingDescription) ] "
536
536
if transcodedOffset != 0 {
537
537
d += " + \( transcodedOffset) "
538
538
}
539
539
return d
540
540
}
541
+ }
542
+
543
+ @available ( SwiftStdlib 6 . 1 , * )
544
+ extension String . Index : CustomDebugStringConvertible { }
541
545
542
- /// A textual representation of this instance.
546
+ extension String . Index {
547
+ /// A textual representation of this instance, intended for debugging.
548
+ ///
549
+ /// - Important: The contents of the returned string are not guaranteed to
550
+ /// remain stable: they may arbitrarily change in any Swift release.
543
551
@_alwaysEmitIntoClient
544
- @available ( * , deprecated, renamed: " description " )
552
+ @available ( * , deprecated, renamed: " debugDescription " )
545
553
public var _description : String {
546
554
description
547
555
}
548
- }
549
556
550
- @available ( SwiftStdlib 6 . 1 , * )
551
- extension String . Index : CustomStringConvertible { }
552
-
553
- extension String . Index {
554
- /// A more detailed description of this string index.
557
+ /// A textual representation of this instance, intended for debugging.
558
+ ///
559
+ /// - Important: The contents of the returned string are not guaranteed to
560
+ /// remain stable: they may arbitrarily change in any Swift release.
555
561
@_alwaysEmitIntoClient
556
- @inline ( never )
562
+ @available ( * , deprecated , renamed : " debugDescription " )
557
563
public var _debugDescription : String {
558
- /// Note: This would not make a good `debugDescription`; the current
559
- /// `description` is fine for that.
560
- var d = " String.Index( "
561
- d += " offset: \( _encodedOffset) [ \( _encodingDescription) ] "
562
- if transcodedOffset != 0 {
563
- d += " + \( transcodedOffset) "
564
- }
565
- if _isCharacterAligned {
566
- d += " , aligned: character "
567
- } else if _isScalarAligned {
568
- d += " , aligned: scalar "
569
- }
570
- if let stride = characterStride {
571
- d += " , stride: \( stride) "
572
- }
573
- d += " ) "
574
- return d
564
+ debugDescription
575
565
}
576
566
}
0 commit comments