Skip to content

Commit baaa4a9

Browse files
author
Max Moiseev
committed
Eliminate some warnings while building the stdlib
- Move deprecated declarations into a separate deprecated extension (suppresses tghe warning) - Mark an initializer from CharacterView as deprecated Addresses: <rdar://problem/40625231>
1 parent 2fe6b11 commit baaa4a9

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

stdlib/public/core/Substring.swift.gyb

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,8 +483,9 @@ extension Substring.${_View} : BidirectionalCollection {
483483
}
484484
}
485485

486-
extension Substring {
487486
% if View == 'CharacterView':
487+
@available(swift, deprecated: 3.2)
488+
extension Substring {
488489
@inlinable // FIXME(sil-serialize-all)
489490
@available(swift, deprecated: 3.2, message:
490491
"Please use String or Substring directly")
@@ -496,8 +497,20 @@ extension Substring {
496497
_characters = newValue
497498
}
498499
}
500+
501+
/// Creates a Substring having the given content.
502+
///
503+
/// - Complexity: O(1)
504+
@inlinable // FIXME(sil-serialize-all)
505+
@available(swift, deprecated: 3.2, message:
506+
"Please use String or Substring directly")
507+
public init(_ content: ${View}) {
508+
self = content._wholeString[content.startIndex..<content.endIndex]
509+
}
510+
}
499511
% end
500512

513+
extension Substring {
501514
@inlinable // FIXME(sil-serialize-all)
502515
public var ${_property}: ${_View} {
503516
get {
@@ -508,13 +521,15 @@ extension Substring {
508521
}
509522
}
510523

524+
% if View != 'CharacterView':
511525
/// Creates a Substring having the given content.
512526
///
513527
/// - Complexity: O(1)
514528
@inlinable // FIXME(sil-serialize-all)
515529
public init(_ content: ${View}) {
516530
self = content._wholeString[content.startIndex..<content.endIndex]
517531
}
532+
% end
518533
}
519534

520535
extension String {

0 commit comments

Comments
 (0)