diff --git a/test/api-digester/Inputs/cake.swift b/test/api-digester/Inputs/cake.swift index 41d633fd80823..aff628b86add4 100644 --- a/test/api-digester/Inputs/cake.swift +++ b/test/api-digester/Inputs/cake.swift @@ -80,3 +80,7 @@ public protocol PSub: PSuper { } public let GlobalVar = 1 + +public extension P1 { + static func +(lhs: P1, rhs: P1) -> P1 { return lhs } +} diff --git a/test/api-digester/Outputs/cake-abi.json b/test/api-digester/Outputs/cake-abi.json index 557f858745c79..09aa0f6d0a0f0 100644 --- a/test/api-digester/Outputs/cake-abi.json +++ b/test/api-digester/Outputs/cake-abi.json @@ -7,6 +7,38 @@ "kind": "TypeDecl", "name": "P1", "printedName": "P1", + "children": [ + { + "kind": "Function", + "name": "+", + "printedName": "+(_:_:)", + "children": [ + { + "kind": "TypeNominal", + "name": "P1", + "printedName": "P1", + "usr": "s:4cake2P1P" + }, + { + "kind": "TypeNominal", + "name": "P1", + "printedName": "P1", + "usr": "s:4cake2P1P" + }, + { + "kind": "TypeNominal", + "name": "P1", + "printedName": "P1", + "usr": "s:4cake2P1P" + } + ], + "declKind": "Func", + "usr": "s:4cake2P1PAAE1poiyAaB_pAaB_p_AaB_ptFZ", + "moduleName": "cake", + "genericSig": "<τ_0_0 where τ_0_0 : P1>", + "static": true + } + ], "declKind": "Protocol", "usr": "s:4cake2P1P", "moduleName": "cake" diff --git a/test/api-digester/Outputs/cake.json b/test/api-digester/Outputs/cake.json index 3435faa7db0e3..f75f3fba7d05c 100644 --- a/test/api-digester/Outputs/cake.json +++ b/test/api-digester/Outputs/cake.json @@ -7,6 +7,38 @@ "kind": "TypeDecl", "name": "P1", "printedName": "P1", + "children": [ + { + "kind": "Function", + "name": "+", + "printedName": "+(_:_:)", + "children": [ + { + "kind": "TypeNominal", + "name": "P1", + "printedName": "P1", + "usr": "s:4cake2P1P" + }, + { + "kind": "TypeNominal", + "name": "P1", + "printedName": "P1", + "usr": "s:4cake2P1P" + }, + { + "kind": "TypeNominal", + "name": "P1", + "printedName": "P1", + "usr": "s:4cake2P1P" + } + ], + "declKind": "Func", + "usr": "s:4cake2P1PAAE1poiyAaB_pAaB_p_AaB_ptFZ", + "moduleName": "cake", + "genericSig": "", + "static": true + } + ], "declKind": "Protocol", "usr": "s:4cake2P1P", "moduleName": "cake" diff --git a/test/api-digester/source-stability.swift.expected b/test/api-digester/source-stability.swift.expected index 0d2d2bc7757f3..80769f89d0d71 100644 --- a/test/api-digester/source-stability.swift.expected +++ b/test/api-digester/source-stability.swift.expected @@ -119,7 +119,43 @@ AssociatedType StringProtocol.UTF16View has been added as a protocol requirement AssociatedType StringProtocol.UTF8View has been added as a protocol requirement AssociatedType StringProtocol.UnicodeScalarView has been added as a protocol requirement AssociatedType _SequenceWrapper.Base has been added as a protocol requirement + + +// These operator changes are false positive because the baseline doesn't have operators. +Func BinaryInteger.%(_:_:) has been added as a protocol requirement +Func BinaryInteger.%=(_:_:) has been added as a protocol requirement +Func BinaryInteger.&(_:_:) has been added as a protocol requirement +Func BinaryInteger.&=(_:_:) has been added as a protocol requirement +Func BinaryInteger.<<(_:_:) has been added as a protocol requirement +Func BinaryInteger.<<=(_:_:) has been added as a protocol requirement +Func BinaryInteger.>>(_:_:) has been added as a protocol requirement +Func BinaryInteger.>>=(_:_:) has been added as a protocol requirement +Func BinaryInteger.\/(_:_:) has been added as a protocol requirement +Func BinaryInteger.\/=(_:_:) has been added as a protocol requirement +Func BinaryInteger.^(_:_:) has been added as a protocol requirement +Func BinaryInteger.^=(_:_:) has been added as a protocol requirement Func BinaryInteger.isMultiple(of:) has been added as a protocol requirement +Func BinaryInteger.|(_:_:) has been added as a protocol requirement +Func BinaryInteger.|=(_:_:) has been added as a protocol requirement +Func BinaryInteger.~(_:) has been added as a protocol requirement +Func Comparable.<(_:_:) has been added as a protocol requirement +Func Comparable.<=(_:_:) has been added as a protocol requirement +Func Comparable.>(_:_:) has been added as a protocol requirement +Func Comparable.>=(_:_:) has been added as a protocol requirement +Func Equatable.==(_:_:) has been added as a protocol requirement +Func FixedWidthInteger.&<<(_:_:) has been added as a protocol requirement +Func FixedWidthInteger.&<<=(_:_:) has been added as a protocol requirement +Func FixedWidthInteger.&>>(_:_:) has been added as a protocol requirement +Func FixedWidthInteger.&>>=(_:_:) has been added as a protocol requirement +Func FloatingPoint.\/(_:_:) has been added as a protocol requirement +Func FloatingPoint.\/=(_:_:) has been added as a protocol requirement +Func Numeric.*(_:_:) has been added as a protocol requirement +Func Numeric.*=(_:_:) has been added as a protocol requirement +Func Numeric.+(_:_:) has been added as a protocol requirement +Func Numeric.+=(_:_:) has been added as a protocol requirement +Func Numeric.-(_:_:) has been added as a protocol requirement +Func Numeric.-=(_:_:) has been added as a protocol requirement +Func SignedNumeric.-(_:) has been added as a protocol requirement // The subscript changes are bogus because we don't have subscript decls in the baseline. Subscript Collection.subscript(_:) has been added as a protocol requirement diff --git a/tools/swift-api-digester/ModuleAnalyzerNodes.cpp b/tools/swift-api-digester/ModuleAnalyzerNodes.cpp index 0446cd02ff6f1..93a12ff7510ea 100644 --- a/tools/swift-api-digester/ModuleAnalyzerNodes.cpp +++ b/tools/swift-api-digester/ModuleAnalyzerNodes.cpp @@ -1129,8 +1129,6 @@ SwiftDeclCollector::shouldIgnore(Decl *D, const Decl* Parent) { if (isa(D)) return true; if (auto VD = dyn_cast(D)) { - if (VD->isOperator()) - return true; if (VD->getBaseName().empty()) return true; @@ -1325,12 +1323,12 @@ void SwiftDeclCollector::processDecl(ValueDecl *VD) { RootNode->addChild(constructFunctionNode(FD, SDKNodeKind::DeclFunction)); } else if (auto NTD = dyn_cast(VD)) { RootNode->addChild(constructTypeDeclNode(NTD)); - } - if (auto VAD = dyn_cast(VD)) { + } else if (auto VAD = dyn_cast(VD)) { RootNode->addChild(constructVarNode(VAD)); - } - if (auto TAD = dyn_cast(VD)) { + } else if (auto TAD = dyn_cast(VD)) { RootNode->addChild(constructTypeAliasNode(TAD)); + } else { + llvm_unreachable("unhandled value decl"); } }