|
| 1 | +// RUN: %empty-directory(%t) |
| 2 | +// RUN: %target-swift-frontend %s -module-name InheritedDocs -emit-module -emit-module-path %t/InheritedDocs.swiftmodule -emit-module-source-info-path %t/InheritedDocs.swiftsourceinfo -emit-module-doc-path %t/InheritedDocs.swiftdoc |
| 3 | + |
| 4 | +// RUN: %target-swift-symbolgraph-extract -module-name InheritedDocs -I %t -pretty-print -output-dir %t |
| 5 | +// RUN: %FileCheck %s --input-file %t/InheritedDocs.symbols.json --check-prefixes CHECK,DOCS |
| 6 | +// RUN: %FileCheck %s --input-file %t/InheritedDocs.symbols.json --check-prefixes IMPL |
| 7 | +// RUN: %FileCheck %s --input-file %t/InheritedDocs.symbols.json --check-prefixes BONUS |
| 8 | +// RUN: %FileCheck %s --input-file %t/InheritedDocs.symbols.json --check-prefixes BONUS-DOCS |
| 9 | + |
| 10 | +// RUN: %target-swift-symbolgraph-extract -module-name InheritedDocs -I %t -pretty-print -output-dir %t -skip-inherited-docs |
| 11 | +// RUN: %FileCheck %s --input-file %t/InheritedDocs.symbols.json --check-prefixes CHECK,SKIP |
| 12 | +// RUN: %FileCheck %s --input-file %t/InheritedDocs.symbols.json --check-prefixes IMPL |
| 13 | +// RUN: %FileCheck %s --input-file %t/InheritedDocs.symbols.json --check-prefixes BONUS |
| 14 | +// RUN: %FileCheck %s --input-file %t/InheritedDocs.symbols.json --check-prefixes BONUS-SKIP |
| 15 | + |
| 16 | +// RUN: %empty-directory(%t) |
| 17 | +// RUN: %target-build-swift %s -module-name InheritedDocs -emit-module -emit-module-path %t/InheritedDocs.swiftmodule -emit-symbol-graph -emit-symbol-graph-dir %t/ -skip-inherited-docs |
| 18 | +// RUN: %FileCheck %s --input-file %t/InheritedDocs.symbols.json --check-prefixes SKIP |
| 19 | + |
| 20 | +// DOCS-COUNT-3: Some Function |
| 21 | +// BONUS-DOCS-COUNT-2: Bonus docs! |
| 22 | +// SKIP-COUNT-1: Some Function |
| 23 | +// BONUS-SKIP-COUNT-1: Bonus docs! |
| 24 | + |
| 25 | +// synthesized symbols should have a sourceOrigin field that points to where its docs come from |
| 26 | + |
| 27 | +// CHECK: "source": "s:13InheritedDocs1PPAAE8someFuncyyF::SYNTHESIZED::s:13InheritedDocs1SV" |
| 28 | +// CHECK-NEXT: "target": "s:13InheritedDocs1SV" |
| 29 | +// CHECK-NEXT: "sourceOrigin" |
| 30 | +// CHECK-NEXT: "identifier": "s:13InheritedDocs1PP8someFuncyyF" |
| 31 | +// CHECK-NEXT: "displayName": "P.someFunc()" |
| 32 | + |
| 33 | +// non-synthesized symbols that nonetheless inherit docs (like this extension) should have the same |
| 34 | + |
| 35 | +// IMPL: "source": "s:13InheritedDocs1PPAAE8someFuncyyF" |
| 36 | +// IMPL-NEXT: "target": "s:13InheritedDocs1PP8someFuncyyF" |
| 37 | +// IMPL-NEXT: "sourceOrigin" |
| 38 | +// IMPL-NEXT: "identifier": "s:13InheritedDocs1PP8someFuncyyF" |
| 39 | +// IMPL-NEXT: "displayName": "P.someFunc()" |
| 40 | + |
| 41 | +// synthesized symbols that point directly to their docs should also have a sourceOrigin field |
| 42 | + |
| 43 | +// BONUS: "source": "s:13InheritedDocs1PPAAE9bonusFuncyyF::SYNTHESIZED::s:13InheritedDocs1SV" |
| 44 | +// BONUS-NEXT: "target": "s:13InheritedDocs1SV" |
| 45 | +// BONUS-NEXT: "sourceOrigin" |
| 46 | +// BONUS-NEXT: "identifier": "s:13InheritedDocs1PPAAE9bonusFuncyyF" |
| 47 | +// BONUS-NEXT: "displayName": "P.bonusFunc()" |
| 48 | + |
| 49 | +/// Protocol P |
| 50 | +public protocol P { |
| 51 | + /// Some Function |
| 52 | + func someFunc() |
| 53 | +} |
| 54 | + |
| 55 | +public extension P { |
| 56 | + func someFunc() {} |
| 57 | + |
| 58 | + /// Bonus docs! |
| 59 | + func bonusFunc() {} |
| 60 | +} |
| 61 | + |
| 62 | +public struct S: P { |
| 63 | +} |
0 commit comments