mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Emit copies of default implementations in protocol extensions and superclass declarations in conforming types and subclasses respectively using a virtual USR, i.e. `${REAL_USR}::SYNTHESIZED::${CONFORMING_OR_SUBCLASS_TYPE_USR}`.
- Add a -skip-synthesized-members option to skip these synthesized members.
- Create a new wrapping `Symbol` type that can also contain a base type declaration as well as the inherited declaration for those synthesized cases. Move some symbol-specific APIs there.
- Doc comments can “cascade” down to protocol extensions or refinements in concrete types. When emitting the doc comment for a symbol, look up through to superclasses or protocol requirements for where a doc comment is actually written.
- Clean up filtering of implicitly private (e.g. “public underscored”) types
rdar://problem/59128787
47 lines
1.7 KiB
Swift
47 lines
1.7 KiB
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: %target-build-swift %s -module-name DefaultImplementation -emit-module -emit-module-path %t/
|
|
// RUN: %target-swift-symbolgraph-extract -module-name DefaultImplementation -I %t -pretty-print -output-dir %t
|
|
// RUN: %FileCheck %s --input-file %t/DefaultImplementation.symbols.json
|
|
|
|
public protocol P {
|
|
func foo()
|
|
func bar()
|
|
func baz()
|
|
}
|
|
|
|
extension P {
|
|
public func foo() {}
|
|
}
|
|
|
|
public extension P {
|
|
func bar() {}
|
|
}
|
|
|
|
public struct Outer: P {
|
|
// CHECK-DAG: "precise": "s:21DefaultImplementation1PPAAE3fooyyF::SYNTHESIZED::s:21DefaultImplementation5OuterV",
|
|
// CHECK-DAG: "precise": "s:21DefaultImplementation1PPAAE3baryyF::SYNTHESIZED::s:21DefaultImplementation5OuterV",
|
|
// CHECK-DAG: "precise": "s:21DefaultImplementation5OuterV3bazyyF",
|
|
public func baz() {}
|
|
}
|
|
|
|
|
|
extension Outer {
|
|
public struct Inner: P {
|
|
// CHECK-DAG: "precise": "s:21DefaultImplementation1PPAAE3fooyyF::SYNTHESIZED::s:21DefaultImplementation5OuterV5InnerV",
|
|
// CHECK-DAG: "precise": "s:21DefaultImplementation1PPAAE3baryyF::SYNTHESIZED::s:21DefaultImplementation5OuterV5InnerV",
|
|
// CHECK-DAG: "precise": "s:21DefaultImplementation5OuterV5InnerV3bazyyF"
|
|
public func baz() {}
|
|
}
|
|
}
|
|
|
|
extension Outer {
|
|
public struct FromExtension: P {
|
|
// CHECK-DAG: "precise": "s:21DefaultImplementation1PPAAE3fooyyF::SYNTHESIZED::s:21DefaultImplementation5OuterV13FromExtensionV"
|
|
// CHECK-DAG: "precise": "s:21DefaultImplementation1PPAAE3baryyF::SYNTHESIZED::s:21DefaultImplementation5OuterV13FromExtensionV"
|
|
// CHECK-DAG: "precise": "s:21DefaultImplementation5OuterV13FromExtensionV3bazyyF"
|
|
public func baz() {}
|
|
}
|
|
}
|
|
|
|
// CHECK-NOT: {{.*baz}}::SYNTHESIZED::
|