44// RUN: %target-swift-symbolgraph-extract -module-name InheritedDocs -I %t -pretty-print -output-dir %t
55// RUN: %FileCheck %s --input-file %t/InheritedDocs.symbols.json --check-prefixes CHECK,DOCS
66// 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
79
810// RUN: %target-swift-symbolgraph-extract -module-name InheritedDocs -I %t -pretty-print -output-dir %t -skip-inherited-docs
911// RUN: %FileCheck %s --input-file %t/InheritedDocs.symbols.json --check-prefixes CHECK,SKIP
1012// 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
1115
1216// RUN: %empty-directory(%t)
1317// 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
1418// RUN: %FileCheck %s --input-file %t/InheritedDocs.symbols.json --check-prefixes SKIP
1519
1620// DOCS-COUNT-3: Some Function
21+ // BONUS-DOCS-COUNT-2: Bonus docs!
1722// 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
1826
1927// CHECK: "source": "s:13InheritedDocs1PPAAE8someFuncyyF::SYNTHESIZED::s:13InheritedDocs1SV"
2028// CHECK-NEXT: "target": "s:13InheritedDocs1SV"
2129// CHECK-NEXT: "sourceOrigin"
2230// CHECK-NEXT: "identifier": "s:13InheritedDocs1PP8someFuncyyF"
2331// CHECK-NEXT: "displayName": "P.someFunc()"
2432
33+ // non-synthesized symbols that nonetheless inherit docs (like this extension) should have the same
34+
2535// IMPL: "source": "s:13InheritedDocs1PPAAE8someFuncyyF"
2636// IMPL-NEXT: "target": "s:13InheritedDocs1PP8someFuncyyF"
2737// IMPL-NEXT: "sourceOrigin"
2838// IMPL-NEXT: "identifier": "s:13InheritedDocs1PP8someFuncyyF"
2939// IMPL-NEXT: "displayName": "P.someFunc()"
3040
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+
3149/// Protocol P
3250public protocol P {
3351 /// Some Function
@@ -36,6 +54,9 @@ public protocol P {
3654
3755public extension P {
3856 func someFunc( ) { }
57+
58+ /// Bonus docs!
59+ func bonusFunc( ) { }
3960}
4061
4162public struct S : P {
0 commit comments