Skip to content

Commit f2dff09

Browse files
committed
Swift: remove parameter labels from function types
As discussed [in this accepted proposal][1], parameter labels do not take part any more in making up a function type, so we need to not extract them any more to avoid DB inconsistencies. These were unused in the library, which makes the upgrade and downgrade scripts have full compatibility. [1]: https://github.com/apple/swift-evolution/blob/9c53790a13a2a1616e59833230e235cdf767fcf5/proposals/0111-remove-arg-label-type-significance.md
1 parent d264785 commit f2dff09

File tree

12 files changed

+10406
-38
lines changed

12 files changed

+10406
-38
lines changed

swift/downgrades/ba43367c819291c264809f13f6c02ddf014dad0a/old.dbscheme

Lines changed: 2596 additions & 0 deletions
Large diffs are not rendered by default.

swift/downgrades/ba43367c819291c264809f13f6c02ddf014dad0a/swift.dbscheme

Lines changed: 2603 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
description: Revert removing parameter labels from function types
2+
compatibility: full

swift/extractor/translators/TypeTranslator.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,6 @@ void TypeTranslator::fillAnyFunctionType(const swift::AnyFunctionType& type,
145145
entry.result = dispatcher.fetchLabel(type.getResult());
146146
for (const auto& p : type.getParams()) {
147147
entry.param_types.push_back(dispatcher.fetchLabel(p.getPlainType()));
148-
if (p.hasLabel()) {
149-
entry.param_labels.emplace_back(p.getLabel().str().str());
150-
} else {
151-
entry.param_labels.emplace_back();
152-
}
153148
}
154149
entry.is_throwing = type.isThrowing();
155150
entry.is_async = type.isAsync();

swift/ql/.generated.list

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -382,10 +382,10 @@ ql/lib/codeql/swift/generated/File.qll 61454459f5f1ae378bd4970ad1da4f39f3e696bac
382382
ql/lib/codeql/swift/generated/Locatable.qll bdc98b9fb7788f44a4bf7e487ee5bd329473409950a8e9f116d61995615ad849 0b36b4fe45e2aa195e4bb70c50ea95f32f141b8e01e5f23466c6427dd9ab88fb
383383
ql/lib/codeql/swift/generated/Location.qll 851766e474cdfdfa67da42e0031fc42dd60196ff5edd39d82f08d3e32deb84c1 b29b2c37672f5acff15f1d3c5727d902f193e51122327b31bd27ec5f877bca3b
384384
ql/lib/codeql/swift/generated/OtherAvailabilitySpec.qll 0e26a203b26ff0581b7396b0c6d1606feec5cc32477f676585cdec4911af91c5 0e26a203b26ff0581b7396b0c6d1606feec5cc32477f676585cdec4911af91c5
385-
ql/lib/codeql/swift/generated/ParentChild.qll adf8af53ce18086eb28e5fe204ad2089f2ab516622c16055ccfdd1335f5ac72b 6f7464ecd8ca04b6aa261139b36a162e5b0636237d514b8431ef4f97a1c603dc
385+
ql/lib/codeql/swift/generated/ParentChild.qll 87c955fbd71e8c720b306b8dc43db354a120a4f984404f83b4dfea4dc8969380 6f7464ecd8ca04b6aa261139b36a162e5b0636237d514b8431ef4f97a1c603dc
386386
ql/lib/codeql/swift/generated/PlatformVersionAvailabilitySpec.qll f82d9ca416fe8bd59b5531b65b1c74c9f317b3297a6101544a11339a1cffce38 7f5c6d3309e66c134107afe55bae76dfc9a72cb7cdd6d4c3706b6b34cee09fa0
387387
ql/lib/codeql/swift/generated/PureSynthConstructors.qll 173c0dd59396a1de26fe870e3bc2766c46de689da2a4d8807cb62023bbce1a98 173c0dd59396a1de26fe870e3bc2766c46de689da2a4d8807cb62023bbce1a98
388-
ql/lib/codeql/swift/generated/Raw.qll df9a9211952260c0213dec8f0bc4865f09ad2f88c970099fb0f09e4c86aea7ac ed9d462267df50194d7d2adfff591306eac86b04dfd4ab92a43366f1febe58bb
388+
ql/lib/codeql/swift/generated/Raw.qll 180dc0f5d34c2e88eb864dca9ef4be0a768583fdad98e737716e031caa355a39 8561938ad09551dc45ad6b3946d599fce1839985a6f61cee63a6dd463dd14a12
389389
ql/lib/codeql/swift/generated/Synth.qll af02e0b49fe7b488592687996cc74d9525d4e3fbc9d324820b310b356f4d2612 5c740a660721173e9e4e45eb701d373ca19ff14d61cdaea309b65871e0deea90
390390
ql/lib/codeql/swift/generated/SynthConstructors.qll a1b3ca33017f82124286ccad317a05484fee144fb9c3cdd2e500ce38e5efcec4 a1b3ca33017f82124286ccad317a05484fee144fb9c3cdd2e500ce38e5efcec4
391391
ql/lib/codeql/swift/generated/UnknownFile.qll 0fcf9beb8de79440bcdfff4bb6ab3dd139bd273e6c32754e05e6a632651e85f6 0fcf9beb8de79440bcdfff4bb6ab3dd139bd273e6c32754e05e6a632651e85f6
@@ -594,7 +594,7 @@ ql/lib/codeql/swift/generated/stmt/ThrowStmt.qll 480553a18c58c2fa594ee3c7bc6b69f
594594
ql/lib/codeql/swift/generated/stmt/WhileStmt.qll 1ac3c3638899386a953905f98f432b7ba5c89e23e28ca55def478ce726127f50 4ac6f0f62082a2a5c1a0119addbb6e4cdebe468a7f972c682c114a70a58c1e80
595595
ql/lib/codeql/swift/generated/stmt/YieldStmt.qll 8b1e8b7b19f94232eb877e1f8956033f6ca51db30d2542642bf3892a20eb1069 87355acc75a95a08e4f2894609c3093321904f62b9033620700ccd4427a9ca70
596596
ql/lib/codeql/swift/generated/type/AnyBuiltinIntegerType.qll a263451163e027c4c4223ec288e090b7e0d399cc46eb962013342bfeac5f6b86 d850ec1ee1902945b172ddd0ecd8884e399e963f939c04bc8bfaadacebdf55a9
597-
ql/lib/codeql/swift/generated/type/AnyFunctionType.qll 28f01d61d199ae6b28800151a923c2c74983aebec6951e6945973292a7d774b1 473b5e0067c5809c7927acf3670acc1e4b9f5fdfcda070954b6c108c7efd409a
597+
ql/lib/codeql/swift/generated/type/AnyFunctionType.qll 0ad10fc75520316769f658cd237f3dbe2bc42cfa5942a71e9341d83dc68d0887 f883269d31b295c853fa06897ef253183049e34274ca0a669dedcd8252a9386e
598598
ql/lib/codeql/swift/generated/type/AnyGenericType.qll ae127c259d9881f240a9b77fb139f16084af53c29aee9abf1af3bcc698bcd611 4cb9e1d9effc7d829e5bc85455c44e4143a4f288454dd58eb25111cd5c1dd95e
599599
ql/lib/codeql/swift/generated/type/AnyMetatypeType.qll 6805a6895e748e02502105d844b66fab5111dbb0d727534d305a0396dacc9465 58e0794b8d6dccd9809f5b83bf64b162e69f3f84b5f3161b88aed10f16a8ede8
600600
ql/lib/codeql/swift/generated/type/ArchetypeType.qll 3c3d88c43a746b54cd09562756768538675ee1bae31c58fca4b8c6af7ccc8656 6dd41b2a89176342a27d3ffa7abc60dc9e53f2a6c132941fb7c79f9aa1b189db

swift/ql/lib/codeql/swift/generated/Raw.qll

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2118,11 +2118,6 @@ module Raw {
21182118
*/
21192119
Type getParamType(int index) { any_function_type_param_types(this, index, result) }
21202120

2121-
/**
2122-
* Gets the `index`th parameter label of this function type (0-based), if it exists.
2123-
*/
2124-
string getParamLabel(int index) { any_function_type_param_labels(this, index, result) }
2125-
21262121
/**
21272122
* Holds if this type refers to a throwing function.
21282123
*/

swift/ql/lib/codeql/swift/generated/type/AnyFunctionType.qll

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -51,23 +51,6 @@ module Generated {
5151
*/
5252
final int getNumberOfParamTypes() { result = count(int i | exists(getParamType(i))) }
5353

54-
/**
55-
* Gets the `index`th parameter label of this function type (0-based), if it exists.
56-
*/
57-
string getParamLabel(int index) {
58-
result = Synth::convertAnyFunctionTypeToRaw(this).(Raw::AnyFunctionType).getParamLabel(index)
59-
}
60-
61-
/**
62-
* Holds if `getParamLabel(index)` exists.
63-
*/
64-
final predicate hasParamLabel(int index) { exists(getParamLabel(index)) }
65-
66-
/**
67-
* Gets any of the parameter labels of this function type.
68-
*/
69-
final string getAParamLabel() { result = getParamLabel(_) }
70-
7154
/**
7255
* Holds if this type refers to a throwing function.
7356
*/

swift/ql/lib/swift.dbscheme

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2003,13 +2003,6 @@ any_function_type_param_types( //dir=type
20032003
int param_type: @type_or_none ref
20042004
);
20052005

2006-
#keyset[id, index]
2007-
any_function_type_param_labels( //dir=type
2008-
int id: @any_function_type ref,
2009-
int index: int ref,
2010-
string param_label: string ref
2011-
);
2012-
20132006
#keyset[id]
20142007
any_function_type_is_throwing( //dir=type
20152008
int id: @any_function_type ref

0 commit comments

Comments
 (0)