mirror of
https://github.com/apple/swift.git
synced 2026-03-04 18:24:35 +01:00
To differentiate between freestanding extensions of protocols and matching default implementations with their requirements. Otherwise, it's difficult to filter out "duplicate" entries for protocols. rdar://61459287
28 lines
1.0 KiB
Swift
28 lines
1.0 KiB
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: %target-build-swift %s -module-name ProtocolMemberWithoutRequirement -emit-module -emit-module-path %t/
|
|
// RUN: %target-swift-symbolgraph-extract -module-name ProtocolMemberWithoutRequirement -I %t -pretty-print -output-dir %t
|
|
// RUN: %FileCheck %s --input-file %t/ProtocolMemberWithoutRequirement.symbols.json
|
|
|
|
public protocol P {}
|
|
|
|
extension P {
|
|
public func foo() {}
|
|
}
|
|
public protocol Q : P {}
|
|
|
|
extension Q {
|
|
public func bar() {}
|
|
}
|
|
|
|
// foo is a member of P.
|
|
// CHECK-DAG: "kind": "memberOf",{{[[:space:]]*}}"source": "s:32ProtocolMemberWithoutRequirement1PPAAE3fooyyF",{{[[:space:]]*}}"target": "s:32ProtocolMemberWithoutRequirement1PP"
|
|
|
|
// bar is a member of Q.
|
|
// CHECK-DAG: "kind": "memberOf",{{[[:space:]]*}}"source": "s:32ProtocolMemberWithoutRequirement1QPAAE3baryyF",{{[[:space:]]*}}"target": "s:32ProtocolMemberWithoutRequirement1QP"
|
|
|
|
// foo is not a requirement of P nor a default implementation for any requirement.
|
|
// Neither is bar for Q.
|
|
// CHECK-NOT: requirementOf
|
|
// CHECK-NOT: defaultImplementationOf
|
|
|