Skip to content

Commit 4b8abdf

Browse files
committed
swift-api-digester: use qualified type names for generic signatures
There could be cases where several modules having types of the same name. Using fully qualified names could help us detect changing from using one of them to another. The commit also updates the existing ABI/API baselines to incorporate such change.
1 parent dfcfdf7 commit 4b8abdf

10 files changed

+7660
-6124
lines changed

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

Lines changed: 5119 additions & 4127 deletions
Large diffs are not rendered by default.

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

Lines changed: 2533 additions & 1983 deletions
Large diffs are not rendered by default.

test/api-digester/Outputs/Cake-abi.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
/* Generic Signature Changes */
33
cake: Func P1.P1Constraint() has generic signature change from <τ_0_0 where τ_0_0 : P1, τ_0_0 : P2> to <τ_0_0 where τ_0_0 : P1>
4-
cake: Protocol P3 has generic signature change from <τ_0_0 : P1, τ_0_0 : P2> to <τ_0_0 : P1, τ_0_0 : P4>
4+
cake: Protocol P3 has generic signature change from <τ_0_0 : cake.P1, τ_0_0 : cake.P2> to <τ_0_0 : cake.P1, τ_0_0 : cake.P4>
55

66
/* RawRepresentable Changes */
77

test/api-digester/Outputs/Cake.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
/* Generic Signature Changes */
33
cake: Func P1.P1Constraint() has generic signature change from <Self where Self : P1, Self : P2> to <Self where Self : P1>
4-
cake: Protocol P3 has generic signature change from <Self : P1, Self : P2> to <Self : P1, Self : P4>
4+
cake: Protocol P3 has generic signature change from <Self : cake.P1, Self : cake.P2> to <Self : cake.P1, Self : cake.P4>
55

66
/* RawRepresentable Changes */
77

test/api-digester/Outputs/cake-abi.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"declKind": "Protocol",
6060
"usr": "s:4cake2P3P",
6161
"moduleName": "cake",
62-
"genericSig": "<τ_0_0 : P1, τ_0_0 : P2>",
62+
"genericSig": "<τ_0_0 : cake.P1, τ_0_0 : cake.P2>",
6363
"conformances": [
6464
{
6565
"kind": "Conformance",
@@ -1235,7 +1235,7 @@
12351235
"declKind": "Protocol",
12361236
"usr": "s:4cake4PSubP",
12371237
"moduleName": "cake",
1238-
"genericSig": "<τ_0_0 : PSuper>",
1238+
"genericSig": "<τ_0_0 : cake.PSuper>",
12391239
"conformances": [
12401240
{
12411241
"kind": "Conformance",

test/api-digester/Outputs/cake.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"declKind": "Protocol",
6060
"usr": "s:4cake2P3P",
6161
"moduleName": "cake",
62-
"genericSig": "<Self : P1, Self : P2>",
62+
"genericSig": "<Self : cake.P1, Self : cake.P2>",
6363
"conformances": [
6464
{
6565
"kind": "Conformance",
@@ -1137,7 +1137,7 @@
11371137
"declKind": "Protocol",
11381138
"usr": "s:4cake4PSubP",
11391139
"moduleName": "cake",
1140-
"genericSig": "<Self : PSuper>",
1140+
"genericSig": "<Self : cake.PSuper>",
11411141
"conformances": [
11421142
{
11431143
"kind": "Conformance",
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
Class __SwiftNativeNSData has been removed
21
Func _collectReferencesInsideObject(_:) is a new API without @available attribute
32
Func _loadDestroyTLSCounter() is a new API without @available attribute
43
Protocol _RuntimeFunctionCountersStats is a new API without @available attribute
54
Struct _GlobalRuntimeFunctionCountersState is a new API without @available attribute
65
Struct _ObjectRuntimeFunctionCountersState is a new API without @available attribute
76
Struct _RuntimeFunctionCounters is a new API without @available attribute
87
Func _measureRuntimeFunctionCountersDiffs(objects:_:) is a new API without @available attribute
9-
Accessor Slice.subscript(_:).Read() has been removed
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
Func BidirectionalCollection.difference(from:by:) has parameter 1 type change from (τ_0_0.Element, τ_1_0.Element) -> Bool to (τ_1_0.Element, τ_0_0.Element) -> Bool

test/api-digester/stability-stdlib-abi-without-asserts.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,3 @@
1111
// The digester can incorrectly register a generic signature change when
1212
// declarations are shuffled. rdar://problem/46618883
1313
// UNSUPPORTED: swift_evolve
14-
15-
// REQUIRES: rdar51332842

tools/swift-api-digester/ModuleAnalyzerNodes.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,9 +1091,8 @@ StringRef printGenericSignature(SDKContext &Ctx, ArrayRef<Requirement> AllReqs)
10911091
OS << "<";
10921092
bool First = true;
10931093
PrintOptions Opts = PrintOptions::printInterface();
1094-
// We always print unqualifed type names to avoid false positives introduced
1095-
// by the heuristics working differently.
1096-
Opts.FullyQualifiedTypesIfAmbiguous = false;
1094+
// We should always print fully qualified type names here
1095+
Opts.FullyQualifiedTypes = true;
10971096
for (auto Req: AllReqs) {
10981097
if (!First) {
10991098
OS << ", ";

0 commit comments

Comments
 (0)