Skip to content

Commit deb56e1

Browse files
committed
Keep doc comments immediately before declarations.
If there's anything between them, DocC doesn't recognize that the doc comment belongs to the declaration that comes after the interruption, resulting in that declaration being undocumented.
1 parent a2bf0d5 commit deb56e1

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

Sources/System/FilePath/FilePath.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
See https://swift.org/LICENSE.txt for license information
88
*/
99

10+
// TODO(docs): Section on all the new syntactic operations, lexical normalization, decomposition,
11+
// components, etc.
12+
/*System 0.0.1, @available(macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0, *)*/
1013
/// Represents a location in the file system.
1114
///
1215
/// This structure recognizes directory separators (e.g. `/`), roots, and
@@ -38,9 +41,6 @@
3841
/// are file-system–specific and have additional considerations
3942
/// like case insensitivity, Unicode normalization, and symbolic links.
4043
///
41-
// TODO(docs): Section on all the new syntactic operations, lexical normalization, decomposition,
42-
// components, etc.
43-
/*System 0.0.1, @available(macOS 11.0, iOS 14.0, watchOS 7.0, tvOS 14.0, *)*/
4444
public struct FilePath {
4545
internal var _storage: SystemString
4646

Sources/System/FilePath/FilePathSyntax.swift

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ extension FilePath {
5252
/// * `\Users`
5353
public var isRelative: Bool { !isAbsolute }
5454

55+
// TODO(Windows docs): examples with roots, such as whether `\foo\bar`
56+
// starts with `C:\foo`
5557
/// Returns whether `other` is a prefix of `self`, only considering
5658
/// whole path components.
5759
///
@@ -64,14 +66,14 @@ extension FilePath {
6466
/// path.starts(with: "/usr/bin/ls///") // true
6567
/// path.starts(with: "/us") // false
6668
///
67-
// TODO(Windows docs): examples with roots, such as whether `\foo\bar`
68-
// starts with `C:\foo`
6969
public func starts(with other: FilePath) -> Bool {
7070
guard !other.isEmpty else { return true }
7171
return self.root == other.root && components.starts(
7272
with: other.components)
7373
}
7474

75+
// TODO(Windows docs): examples with roots, such as whether `C:\foo\bar`
76+
// ends with `C:bar`
7577
/// Returns whether `other` is a suffix of `self`, only considering
7678
/// whole path components.
7779
///
@@ -84,8 +86,6 @@ extension FilePath {
8486
/// path.ends(with: "/usr/bin/ls///") // true
8587
/// path.ends(with: "/ls") // false
8688
///
87-
// TODO(Windows docs): examples with roots, such as whether `C:\foo\bar`
88-
// ends with `C:bar`
8989
public func ends(with other: FilePath) -> Bool {
9090
if other.root != nil {
9191
// TODO: anything tricky here for Windows?
@@ -441,6 +441,7 @@ extension FilePath {
441441
// Modification and concatenation API
442442
/*System 0.0.2, @available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)*/
443443
extension FilePath {
444+
// TODO(Windows docs): example with roots
444445
/// If `prefix` is a prefix of `self`, removes it and returns `true`.
445446
/// Otherwise returns `false`.
446447
///
@@ -451,7 +452,6 @@ extension FilePath {
451452
/// path.removePrefix("/us") // false
452453
/// path.removePrefix("/usr/local") // true, path is "bin"
453454
///
454-
// TODO(Windows docs): example with roots
455455
public mutating func removePrefix(_ prefix: FilePath) -> Bool {
456456
defer { _invariantCheck() }
457457
// FIXME: Should Windows have more nuanced semantics?
@@ -462,6 +462,7 @@ extension FilePath {
462462
return true
463463
}
464464

465+
// TODO(Windows docs): example with roots
465466
/// Append a `component` on to the end of this path.
466467
///
467468
/// Example:
@@ -473,12 +474,12 @@ extension FilePath {
473474
/// }
474475
/// // path is "/tmp/foo/bar/../baz"
475476
///
476-
// TODO(Windows docs): example with roots
477477
public mutating func append(_ component: __owned FilePath.Component) {
478478
defer { _invariantCheck() }
479479
_append(unchecked: component._slice)
480480
}
481481

482+
// TODO(Windows docs): example with roots
482483
/// Append `components` on to the end of this path.
483484
///
484485
/// Example:
@@ -488,7 +489,6 @@ extension FilePath {
488489
/// let otherPath: FilePath = "/bin/ls"
489490
/// path.append(otherPath.components) // path is "/usr/local/bin/ls"
490491
///
491-
// TODO(Windows docs): example with roots
492492
public mutating func append<C: Collection>(
493493
_ components: __owned C
494494
) where C.Element == FilePath.Component {
@@ -498,6 +498,8 @@ extension FilePath {
498498
}
499499
}
500500

501+
// TODO(Windows docs): example with roots, should we rephrase this "spurious
502+
// roots"?
501503
/// Append the contents of `other`, ignoring any spurious leading separators.
502504
///
503505
/// A leading separator is spurious if `self` is non-empty.
@@ -509,8 +511,6 @@ extension FilePath {
509511
/// path.append("static/assets") // "/var/www/website/static/assets"
510512
/// path.append("/main.css") // "/var/www/website/static/assets/main.css"
511513
///
512-
// TODO(Windows docs): example with roots, should we rephrase this "spurious
513-
// roots"?
514514
public mutating func append(_ other: __owned String) {
515515
defer { _invariantCheck() }
516516
guard !other.utf8.isEmpty else { return }
@@ -522,18 +522,18 @@ extension FilePath {
522522
_append(unchecked: otherPath._storage[otherPath._relativeStart...])
523523
}
524524

525+
// TODO(Windows docs): example with roots
525526
/// Non-mutating version of `append(_:Component)`.
526527
///
527-
// TODO(Windows docs): example with roots
528528
public __consuming func appending(_ other: __owned Component) -> FilePath {
529529
var copy = self
530530
copy.append(other)
531531
return copy
532532
}
533533

534+
// TODO(Windows docs): example with roots
534535
/// Non-mutating version of `append(_:C)`.
535536
///
536-
// TODO(Windows docs): example with roots
537537
public __consuming func appending<C: Collection>(
538538
_ components: __owned C
539539
) -> FilePath where C.Element == FilePath.Component {
@@ -542,15 +542,17 @@ extension FilePath {
542542
return copy
543543
}
544544

545+
// TODO(Windows docs): example with roots
545546
/// Non-mutating version of `append(_:String)`.
546547
///
547-
// TODO(Windows docs): example with roots
548548
public __consuming func appending(_ other: __owned String) -> FilePath {
549549
var copy = self
550550
copy.append(other)
551551
return copy
552552
}
553553

554+
// TODO(Windows docs): examples and docs with roots, update/generalize doc
555+
// comment
554556
/// If `other` does not have a root, append each component of `other`. If
555557
/// `other` has a root, replaces `self` with other.
556558
///
@@ -565,8 +567,6 @@ extension FilePath {
565567
/// path.push("dir/file.txt") // path is "/tmp/dir/file.txt"
566568
/// path.push("/bin") // path is "/bin"
567569
///
568-
// TODO(Windows docs): examples and docs with roots, update/generalize doc
569-
// comment
570570
public mutating func push(_ other: __owned FilePath) {
571571
defer { _invariantCheck() }
572572
guard other.root == nil else {
@@ -577,9 +577,9 @@ extension FilePath {
577577
_append(unchecked: other._storage[...])
578578
}
579579

580+
// TODO(Windows docs): examples and docs with roots
580581
/// Non-mutating version of `push()`.
581582
///
582-
// TODO(Windows docs): examples and docs with roots
583583
public __consuming func pushing(_ other: __owned FilePath) -> FilePath {
584584
var copy = self
585585
copy.push(other)

Sources/System/FilePath/FilePathWindows.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,21 +150,21 @@ internal struct WindowsRootInfo {
150150
/// * Omitted volume from other forms: `\\.\`, `\\.\UNC\server\\`, `\\server\\`
151151
case empty
152152

153+
// TODO: NT paths? Admin paths using `$`?
153154
/// A specified drive.
154155
///
155156
/// * Traditional disk: `C:\`, `C:`
156157
/// * Device disk: `\\.\C:\`, `\\?\C:\`
157158
/// * UNC: `\\server\e:\`, `\\?\UNC\server\e:\`
158159
///
159-
// TODO: NT paths? Admin paths using `$`?
160160
case drive(Character)
161161

162+
// TODO: GUID type?
162163
/// A volume with a GUID in a non-traditional path
163164
///
164165
/// * UNC: `\\host\Volume{0000-...}\`, `\\.\UNC\host\Volume{0000-...}\`
165166
/// * Device roots: `\\.\Volume{0000-...}\`, `\\?\Volume{000-...}\`
166167
///
167-
// TODO: GUID type?
168168
case guid(String)
169169

170170
// TODO: Legacy DOS devices, such as COM1?

0 commit comments

Comments
 (0)