From fcefd03b14a543d02391863a4eb98087bb10f088 Mon Sep 17 00:00:00 2001 From: Geoffrey White <40627776+geoffw0@users.noreply.github.com> Date: Wed, 29 Mar 2023 13:48:31 +0100 Subject: [PATCH] Swift: Fill out the upgrade/downgrade scripts. --- .../type_alias_decls.ql | 6 ++++++ .../upgrade.properties | 5 +++-- .../type_alias_decls.ql | 14 ++++++++++++++ .../upgrade.properties | 5 +++-- 4 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 swift/downgrades/e646f9e0308ec7135c83c0fdf96896d2737a8013/type_alias_decls.ql create mode 100644 swift/ql/lib/upgrades/c2f01f2beb67e5a57e9df9b6d1c51e35e8d5b0a2/type_alias_decls.ql diff --git a/swift/downgrades/e646f9e0308ec7135c83c0fdf96896d2737a8013/type_alias_decls.ql b/swift/downgrades/e646f9e0308ec7135c83c0fdf96896d2737a8013/type_alias_decls.ql new file mode 100644 index 00000000000..72f89e3946d --- /dev/null +++ b/swift/downgrades/e646f9e0308ec7135c83c0fdf96896d2737a8013/type_alias_decls.ql @@ -0,0 +1,6 @@ +class TypeAliasDecl extends @type_alias_decl { + string toString() { result = "TypeAliasDecl" } +} + +from TypeAliasDecl id +select id diff --git a/swift/downgrades/e646f9e0308ec7135c83c0fdf96896d2737a8013/upgrade.properties b/swift/downgrades/e646f9e0308ec7135c83c0fdf96896d2737a8013/upgrade.properties index 64da53384a5..31ffe35bf1c 100644 --- a/swift/downgrades/e646f9e0308ec7135c83c0fdf96896d2737a8013/upgrade.properties +++ b/swift/downgrades/e646f9e0308ec7135c83c0fdf96896d2737a8013/upgrade.properties @@ -1,2 +1,3 @@ -description: -compatibility: full|backwards|partial|breaking +description: Revert adding TypeAliasDecl.getAliasedType() +compatibility: full +type_alias_decls.rel: run type_alias_decls.qlo diff --git a/swift/ql/lib/upgrades/c2f01f2beb67e5a57e9df9b6d1c51e35e8d5b0a2/type_alias_decls.ql b/swift/ql/lib/upgrades/c2f01f2beb67e5a57e9df9b6d1c51e35e8d5b0a2/type_alias_decls.ql new file mode 100644 index 00000000000..4b5ecd00925 --- /dev/null +++ b/swift/ql/lib/upgrades/c2f01f2beb67e5a57e9df9b6d1c51e35e8d5b0a2/type_alias_decls.ql @@ -0,0 +1,14 @@ +class TypeAliasDecl extends @type_alias_decl { + string toString() { result = "TypeAliasDecl" } +} + +class Type extends @type_or_none { + string toString() { result = "Type" } +} + +// use the canonical type as an approximation of the aliased type +from TypeAliasDecl td, Type t, Type canonical +where + type_alias_types(t, td) and // td is the declaration of t + types(t, _, canonical) // canonical is the canonical type of t +select td, canonical diff --git a/swift/ql/lib/upgrades/c2f01f2beb67e5a57e9df9b6d1c51e35e8d5b0a2/upgrade.properties b/swift/ql/lib/upgrades/c2f01f2beb67e5a57e9df9b6d1c51e35e8d5b0a2/upgrade.properties index 64da53384a5..301f7bb8899 100644 --- a/swift/ql/lib/upgrades/c2f01f2beb67e5a57e9df9b6d1c51e35e8d5b0a2/upgrade.properties +++ b/swift/ql/lib/upgrades/c2f01f2beb67e5a57e9df9b6d1c51e35e8d5b0a2/upgrade.properties @@ -1,2 +1,3 @@ -description: -compatibility: full|backwards|partial|breaking +description: Add TypeAliasDecl.getAliasedType() +compatibility: backwards +type_alias_decls.rel: run type_alias_decls.qlo