File: RemoteInheritedDocs.swift

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (76 lines) | stat: -rw-r--r-- 3,840 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend %S/Inputs/RemoteP.swift -module-name RemoteP -emit-module -emit-module-path %t/RemoteP.swiftmodule -emit-module-source-info-path %t/RemoteP.swiftsourceinfo -emit-module-doc-path %t/RemoteP.swiftdoc
// RUN: %target-swift-frontend %s -module-name RemoteInheritedDocs -emit-module -emit-module-path %t/RemoteInheritedDocs.swiftmodule -emit-module-source-info-path %t/RemoteInheritedDocs.swiftsourceinfo -emit-module-doc-path %t/RemoteInheritedDocs.swiftdoc -I %t

// RUN: %target-swift-symbolgraph-extract -module-name RemoteInheritedDocs -I %t -pretty-print -output-dir %t -emit-extension-block-symbols
// RUN: %FileCheck %s --input-file %t/RemoteInheritedDocs.symbols.json --check-prefix SOME
// RUN: %FileCheck %s --input-file %t/RemoteInheritedDocs.symbols.json --check-prefix OTHER
// RUN: %FileCheck %s --input-file %t/RemoteInheritedDocs.symbols.json --check-prefix BONUS
// RUN: %FileCheck %s --input-file %t/RemoteInheritedDocs.symbols.json --check-prefix INHERIT
// RUN: %FileCheck %s --input-file %t/RemoteInheritedDocs.symbols.json --check-prefix LOCAL
// RUN: %FileCheck %s --input-file %t/RemoteInheritedDocs.symbols.json --check-prefix OVERRIDE
// RUN: %FileCheck %s --input-file %t/RemoteInheritedDocs@RemoteP.symbols.json --check-prefix EXTENSION

// RUN: %target-swift-symbolgraph-extract -module-name RemoteInheritedDocs -I %t -pretty-print -output-dir %t -skip-inherited-docs
// RUN: %FileCheck %s --input-file %t/RemoteInheritedDocs.symbols.json --check-prefix SOME
// RUN: %FileCheck %s --input-file %t/RemoteInheritedDocs.symbols.json --check-prefix OTHER
// RUN: %FileCheck %s --input-file %t/RemoteInheritedDocs.symbols.json --check-prefix BONUS
// RUN: %FileCheck %s --input-file %t/RemoteInheritedDocs.symbols.json --check-prefix SKIP
// RUN: %FileCheck %s --input-file %t/RemoteInheritedDocs.symbols.json --check-prefix LOCAL
// RUN: %FileCheck %s --input-file %t/RemoteInheritedDocs.symbols.json --check-prefix OVERRIDE

// SOME:           "source": "s:19RemoteInheritedDocs1SV8someFuncyyF"
// SOME-NEXT:      "target": "s:19RemoteInheritedDocs1SV"
// SOME-NEXT:      "sourceOrigin"
// SOME-NEXT:        "identifier": "s:7RemoteP1PP8someFuncyyF"
// SOME-NEXT:        "displayName": "P.someFunc()"

// OTHER:           "source": "s:19RemoteInheritedDocs1SV9otherFuncyyF"
// OTHER-NEXT:      "target": "s:19RemoteInheritedDocs1SV"
// OTHER-NEXT:      "sourceOrigin"
// OTHER-NEXT:        "identifier": "s:7RemoteP1PP9otherFuncyyF"
// OTHER-NEXT:        "displayName": "P.otherFunc()"

// BONUS:           "source": "s:19RemoteInheritedDocs1SV9bonusFuncyyF"
// BONUS-NEXT:      "target": "s:19RemoteInheritedDocs1SV"
// BONUS-NEXT:      "sourceOrigin"
// BONUS-NEXT:        "identifier": "s:7RemoteP1PP9bonusFuncyyF"
// BONUS-NEXT:        "displayName": "P.bonusFunc()"

// INHERIT: This one has docs!
// SKIP-NOT: This one has docs!

// LOCAL: Local docs override!

// OVERRIDE-NOT: Extra default docs!
// OVERRIDE-NOT: Extension override!

// EXTENSION-NOT: Some Protocol

import RemoteP

// The `RemoteP.P` protocol has three methods: `someFunc` and `bonusFunc` don't have docs upstream,
// but `otherFunc` does. Regardless, each one needs a `sourceOrigin` field connecting it to
// upstream.

// `RemoteP.P` also has an extension with a default implementation for `extraFunc` that does have
// docs, but overriding it here should prevent those from appearing

// When emitting extension block symbols, local extension blocks should never inherit documentation
// from the original type declaration.

public struct S: P {
    public func someFunc() {}

    public func otherFunc() {}

    /// Local docs override!
    public func bonusFunc() {}

    public func extraFunc() {}
}

public extension P {
    /// Extension override!
    func someFunc() {}
}