mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
When extending another module's type in your module, serialize declarations in the extension into the other module's "extension" symbol graph file, including relationships. This mechanic should continue up to the rootmost module. For example: A.AStruct <- B.BStruct < C.CStruct Both BStruct and CStruct should go in `@A` symbol graph files because AStruct owns BStruct and by extension owns CStruct. This is reflected in documentation curation in some form already. rdar://60796811
27 lines
860 B
Swift
27 lines
860 B
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: %target-build-swift %s -module-name BasicExtension -emit-module -emit-module-path %t/
|
|
// RUN: %target-swift-symbolgraph-extract -module-name BasicExtension -I %t -pretty-print -output-dir %t
|
|
// RUN: %FileCheck %s --input-file %t/BasicExtension@Swift.symbols.json
|
|
|
|
extension String {
|
|
/// Return something.
|
|
public var something: String {
|
|
return "something"
|
|
}
|
|
}
|
|
|
|
// CHECK: module
|
|
// CHECK-NEXT: "name": "BasicExtension"
|
|
|
|
// CHECK: "precise": "s:SS14BasicExtensionE9somethingSSvp"
|
|
|
|
// CHECK: "kind": "memberOf"
|
|
// CHECK-NEXT: "source": "s:SS14BasicExtensionE9somethingSSvp"
|
|
// CHECK-NEXT: "target": "s:SS"
|
|
|
|
// Extending `String` creates a memberOf relationship above.
|
|
// However, it should not be included as a node because `String`
|
|
// is owned by the Swift module.
|
|
// rdar://58876107
|
|
// CHECK-NOT: "precise": "s:SS"
|