Skip to content

Commit 8225b52

Browse files
committed
swift-api-digester: de-duplicate protocol conformance entries in the Json output
For some unclear reasons, calling getAllConformances on Int.Words and UInt.Words returns duplicate entries for conforming to RandomAccessCollection. Since this isn't the case for swift-5.1-branch, we saw false positives shown in rdar://49568079. This patch fixes the ABI/API checker by de-duplicate results collected from getAllConformances.
1 parent 0f1994d commit 8225b52

File tree

3 files changed

+36
-374
lines changed

3 files changed

+36
-374
lines changed

test/api-digester/Inputs/stdlib-stable-abi.json

Lines changed: 0 additions & 150 deletions
Original file line numberDiff line numberDiff line change
@@ -223181,81 +223181,6 @@
223181223181
]
223182223182
}
223183223183
]
223184-
},
223185-
{
223186-
"kind": "Conformance",
223187-
"name": "RandomAccessCollection",
223188-
"printedName": "RandomAccessCollection",
223189-
"children": [
223190-
{
223191-
"kind": "TypeWitness",
223192-
"name": "Element",
223193-
"printedName": "Element",
223194-
"children": [
223195-
{
223196-
"kind": "TypeNominal",
223197-
"name": "UInt",
223198-
"printedName": "UInt",
223199-
"usr": "s:Su"
223200-
}
223201-
]
223202-
},
223203-
{
223204-
"kind": "TypeWitness",
223205-
"name": "Index",
223206-
"printedName": "Index",
223207-
"children": [
223208-
{
223209-
"kind": "TypeNominal",
223210-
"name": "Int",
223211-
"printedName": "Int",
223212-
"usr": "s:Si"
223213-
}
223214-
]
223215-
},
223216-
{
223217-
"kind": "TypeWitness",
223218-
"name": "SubSequence",
223219-
"printedName": "SubSequence",
223220-
"children": [
223221-
{
223222-
"kind": "TypeNominal",
223223-
"name": "Slice",
223224-
"printedName": "Slice<UInt.Words>",
223225-
"children": [
223226-
{
223227-
"kind": "TypeNominal",
223228-
"name": "Words",
223229-
"printedName": "UInt.Words",
223230-
"usr": "s:Su5WordsV"
223231-
}
223232-
],
223233-
"usr": "s:s5SliceV"
223234-
}
223235-
]
223236-
},
223237-
{
223238-
"kind": "TypeWitness",
223239-
"name": "Indices",
223240-
"printedName": "Indices",
223241-
"children": [
223242-
{
223243-
"kind": "TypeNominal",
223244-
"name": "Range",
223245-
"printedName": "Range<Int>",
223246-
"children": [
223247-
{
223248-
"kind": "TypeNominal",
223249-
"name": "Int",
223250-
"printedName": "Int",
223251-
"usr": "s:Si"
223252-
}
223253-
],
223254-
"usr": "s:Sn"
223255-
}
223256-
]
223257-
}
223258-
]
223259223184
}
223260223185
]
223261223186
},
@@ -227320,81 +227245,6 @@
227320227245
]
227321227246
}
227322227247
]
227323-
},
227324-
{
227325-
"kind": "Conformance",
227326-
"name": "RandomAccessCollection",
227327-
"printedName": "RandomAccessCollection",
227328-
"children": [
227329-
{
227330-
"kind": "TypeWitness",
227331-
"name": "Element",
227332-
"printedName": "Element",
227333-
"children": [
227334-
{
227335-
"kind": "TypeNominal",
227336-
"name": "UInt",
227337-
"printedName": "UInt",
227338-
"usr": "s:Su"
227339-
}
227340-
]
227341-
},
227342-
{
227343-
"kind": "TypeWitness",
227344-
"name": "Index",
227345-
"printedName": "Index",
227346-
"children": [
227347-
{
227348-
"kind": "TypeNominal",
227349-
"name": "Int",
227350-
"printedName": "Int",
227351-
"usr": "s:Si"
227352-
}
227353-
]
227354-
},
227355-
{
227356-
"kind": "TypeWitness",
227357-
"name": "SubSequence",
227358-
"printedName": "SubSequence",
227359-
"children": [
227360-
{
227361-
"kind": "TypeNominal",
227362-
"name": "Slice",
227363-
"printedName": "Slice<Int.Words>",
227364-
"children": [
227365-
{
227366-
"kind": "TypeNominal",
227367-
"name": "Words",
227368-
"printedName": "Int.Words",
227369-
"usr": "s:Si5WordsV"
227370-
}
227371-
],
227372-
"usr": "s:s5SliceV"
227373-
}
227374-
]
227375-
},
227376-
{
227377-
"kind": "TypeWitness",
227378-
"name": "Indices",
227379-
"printedName": "Indices",
227380-
"children": [
227381-
{
227382-
"kind": "TypeNominal",
227383-
"name": "Range",
227384-
"printedName": "Range<Int>",
227385-
"children": [
227386-
{
227387-
"kind": "TypeNominal",
227388-
"name": "Int",
227389-
"printedName": "Int",
227390-
"usr": "s:Si"
227391-
}
227392-
],
227393-
"usr": "s:Sn"
227394-
}
227395-
]
227396-
}
227397-
]
227398227248
}
227399227249
]
227400227250
},

test/api-digester/Inputs/stdlib-stable.json

Lines changed: 0 additions & 206 deletions
Original file line numberDiff line numberDiff line change
@@ -156358,109 +156358,6 @@
156358156358
]
156359156359
}
156360156360
]
156361-
},
156362-
{
156363-
"kind": "Conformance",
156364-
"name": "RandomAccessCollection",
156365-
"printedName": "RandomAccessCollection",
156366-
"children": [
156367-
{
156368-
"kind": "TypeWitness",
156369-
"name": "Element",
156370-
"printedName": "Element",
156371-
"children": [
156372-
{
156373-
"kind": "TypeNameAlias",
156374-
"name": "Element",
156375-
"printedName": "UInt.Words.Element",
156376-
"children": [
156377-
{
156378-
"kind": "TypeNominal",
156379-
"name": "UInt",
156380-
"printedName": "UInt",
156381-
"usr": "s:Su"
156382-
}
156383-
]
156384-
}
156385-
]
156386-
},
156387-
{
156388-
"kind": "TypeWitness",
156389-
"name": "Index",
156390-
"printedName": "Index",
156391-
"children": [
156392-
{
156393-
"kind": "TypeNameAlias",
156394-
"name": "Index",
156395-
"printedName": "UInt.Words.Index",
156396-
"children": [
156397-
{
156398-
"kind": "TypeNominal",
156399-
"name": "Int",
156400-
"printedName": "Int",
156401-
"usr": "s:Si"
156402-
}
156403-
]
156404-
}
156405-
]
156406-
},
156407-
{
156408-
"kind": "TypeWitness",
156409-
"name": "SubSequence",
156410-
"printedName": "SubSequence",
156411-
"children": [
156412-
{
156413-
"kind": "TypeNameAlias",
156414-
"name": "SubSequence",
156415-
"printedName": "UInt.Words.SubSequence",
156416-
"children": [
156417-
{
156418-
"kind": "TypeNominal",
156419-
"name": "Slice",
156420-
"printedName": "Slice<UInt.Words>",
156421-
"children": [
156422-
{
156423-
"kind": "TypeNominal",
156424-
"name": "Words",
156425-
"printedName": "UInt.Words",
156426-
"usr": "s:Su5WordsV"
156427-
}
156428-
],
156429-
"usr": "s:s5SliceV"
156430-
}
156431-
]
156432-
}
156433-
]
156434-
},
156435-
{
156436-
"kind": "TypeWitness",
156437-
"name": "Indices",
156438-
"printedName": "Indices",
156439-
"children": [
156440-
{
156441-
"kind": "TypeNameAlias",
156442-
"name": "Indices",
156443-
"printedName": "UInt.Words.Indices",
156444-
"children": [
156445-
{
156446-
"kind": "TypeNominal",
156447-
"name": "Range",
156448-
"printedName": "Range<Int>",
156449-
"children": [
156450-
{
156451-
"kind": "TypeNominal",
156452-
"name": "Int",
156453-
"printedName": "Int",
156454-
"usr": "s:Si"
156455-
}
156456-
],
156457-
"usr": "s:Sn"
156458-
}
156459-
]
156460-
}
156461-
]
156462-
}
156463-
]
156464156361
}
156465156362
]
156466156363
},
@@ -160153,109 +160050,6 @@
160153160050
]
160154160051
}
160155160052
]
160156-
},
160157-
{
160158-
"kind": "Conformance",
160159-
"name": "RandomAccessCollection",
160160-
"printedName": "RandomAccessCollection",
160161-
"children": [
160162-
{
160163-
"kind": "TypeWitness",
160164-
"name": "Element",
160165-
"printedName": "Element",
160166-
"children": [
160167-
{
160168-
"kind": "TypeNameAlias",
160169-
"name": "Element",
160170-
"printedName": "Int.Words.Element",
160171-
"children": [
160172-
{
160173-
"kind": "TypeNominal",
160174-
"name": "UInt",
160175-
"printedName": "UInt",
160176-
"usr": "s:Su"
160177-
}
160178-
]
160179-
}
160180-
]
160181-
},
160182-
{
160183-
"kind": "TypeWitness",
160184-
"name": "Index",
160185-
"printedName": "Index",
160186-
"children": [
160187-
{
160188-
"kind": "TypeNameAlias",
160189-
"name": "Index",
160190-
"printedName": "Int.Words.Index",
160191-
"children": [
160192-
{
160193-
"kind": "TypeNominal",
160194-
"name": "Int",
160195-
"printedName": "Int",
160196-
"usr": "s:Si"
160197-
}
160198-
]
160199-
}
160200-
]
160201-
},
160202-
{
160203-
"kind": "TypeWitness",
160204-
"name": "SubSequence",
160205-
"printedName": "SubSequence",
160206-
"children": [
160207-
{
160208-
"kind": "TypeNameAlias",
160209-
"name": "SubSequence",
160210-
"printedName": "Int.Words.SubSequence",
160211-
"children": [
160212-
{
160213-
"kind": "TypeNominal",
160214-
"name": "Slice",
160215-
"printedName": "Slice<Int.Words>",
160216-
"children": [
160217-
{
160218-
"kind": "TypeNominal",
160219-
"name": "Words",
160220-
"printedName": "Int.Words",
160221-
"usr": "s:Si5WordsV"
160222-
}
160223-
],
160224-
"usr": "s:s5SliceV"
160225-
}
160226-
]
160227-
}
160228-
]
160229-
},
160230-
{
160231-
"kind": "TypeWitness",
160232-
"name": "Indices",
160233-
"printedName": "Indices",
160234-
"children": [
160235-
{
160236-
"kind": "TypeNameAlias",
160237-
"name": "Indices",
160238-
"printedName": "Int.Words.Indices",
160239-
"children": [
160240-
{
160241-
"kind": "TypeNominal",
160242-
"name": "Range",
160243-
"printedName": "Range<Int>",
160244-
"children": [
160245-
{
160246-
"kind": "TypeNominal",
160247-
"name": "Int",
160248-
"printedName": "Int",
160249-
"usr": "s:Si"
160250-
}
160251-
],
160252-
"usr": "s:Sn"
160253-
}
160254-
]
160255-
}
160256-
]
160257-
}
160258-
]
160259160053
}
160260160054
]
160261160055
},

0 commit comments

Comments
 (0)