Files
swift-mirror/test/SymbolGraph/Symbols/SkipsPublicUnderscore.swift
Ashley Garland f0887fa245 [SymbolGraph] Emit synthesized members
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
2020-03-04 16:04:21 -08:00

54 lines
1.6 KiB
Swift

// RUN: %empty-directory(%t)
// RUN: %target-build-swift %s -module-name SkipsPublicUnderscore -emit-module -emit-module-path %t/
// RUN: %target-swift-symbolgraph-extract -module-name SkipsPublicUnderscore -I %t -pretty-print -output-dir %t
// RUN: %FileCheck %s --input-file %t/SkipsPublicUnderscore.symbols.json
public protocol PublicProtocol {}
// CHECK-NOT: precise:{{.*}}_ProtocolShouldntAppear
// CHECK-NOT: precise:{{.*}}PublicProtocol
public protocol _ProtocolShouldntAppear {}
// CHECK-NOT: _ShouldntAppear
public struct _ShouldntAppear: PublicProtocol, _ProtocolShouldntAppear {
// Although these are public and not underscored,
// they are inside an underscored type,
// so shouldn't be allowed through.
// CHECK-NOT: shouldntAppear
public var shouldntAppear: Int
// CHECK-NOT: InnerShouldntAppear
public struct InnerShouldntAppear {
// CHECK-NOT: InnerInnerShouldntAppear
public struct InnerInnerShouldntAppear {}
}
}
// A public type's relationship to an "internal" protocol
// shouldn't cause it to be included.
public struct ShouldAppear: _ProtocolShouldntAppear {}
public struct PublicOuter {
// Nor should an "internal" type's relationship to a "public" protocol.
// CHECK-NOT: _InnerShouldntAppear
public struct _InnerShouldntAppear: PublicProtocol {}
}
extension PublicOuter {
// CHECK-NOT: _FromExtension
public struct _FromExtension: PublicProtocol {
// CHECK-NOT: shouldntAppear
public var shouldntAppear: Int
}
}
extension _ShouldntAppear {
// CHECK-NOT: FromExtension
public struct FromExtension: PublicProtocol {
// CHECK-NOT: shouldntAppear
public var shouldntAppear: Int
}
}