Merge pull request #18635 from hvitved/codegen/self-type-alias

Codegen: Improve return type of self-typed properties
This commit is contained in:
Paolo Tranquilli
2025-02-05 17:20:25 +01:00
committed by GitHub
11 changed files with 44 additions and 22 deletions

View File

@@ -45,6 +45,7 @@ class Property:
synth: bool = False synth: bool = False
type_is_hideable: bool = False type_is_hideable: bool = False
type_is_codegen_class: bool = False type_is_codegen_class: bool = False
type_is_self: bool = False
internal: bool = False internal: bool = False
cfg: bool = False cfg: bool = False
@@ -83,6 +84,10 @@ class Property:
def is_indexed(self) -> bool: def is_indexed(self) -> bool:
return self.is_repeated and not self.is_unordered return self.is_repeated and not self.is_unordered
@property
def type_alias(self) -> Optional[str]:
return self.type + "Alias" if self.type_is_self else self.type
@dataclass @dataclass
class Base: class Base:
@@ -116,11 +121,18 @@ class Class:
self.bases_impl = get_bases(self.bases_impl) self.bases_impl = get_bases(self.bases_impl)
if self.properties: if self.properties:
self.properties[0].first = True self.properties[0].first = True
for prop in self.properties:
if prop.type == self.name:
prop.type_is_self = True
@property @property
def root(self) -> bool: def root(self) -> bool:
return not self.bases return not self.bases
@property
def needs_self_alias(self) -> bool:
return self.root or any(p.type_is_self for p in self.properties)
@property @property
def path(self) -> pathlib.Path: def path(self) -> pathlib.Path:
return self.dir / self.name return self.dir / self.name

View File

@@ -9,9 +9,9 @@ private import {{import_prefix}}.Raw
{{#imports}} {{#imports}}
import {{.}} import {{.}}
{{/imports}} {{/imports}}
{{#root}} {{#needs_self_alias}}
private class {{name}}Alias = {{name}}; private class {{name}}Alias = {{name}};
{{/root}} {{/needs_self_alias}}
/** /**
* INTERNAL: This module contains the fully generated definition of `{{name}}` and should not * INTERNAL: This module contains the fully generated definition of `{{name}}` and should not
* be referenced directly. * be referenced directly.
@@ -77,7 +77,7 @@ module Generated {
* INTERNAL: Do not use. * INTERNAL: Do not use.
{{/internal}} {{/internal}}
*/ */
{{type}} get{{#is_unordered}}An{{/is_unordered}}Immediate{{singular}}({{#is_indexed}}int index{{/is_indexed}}) { {{type_alias}} get{{#is_unordered}}An{{/is_unordered}}Immediate{{singular}}({{#is_indexed}}int index{{/is_indexed}}) {
{{^synth}} {{^synth}}
result = Synth::convert{{type}}FromRaw(Synth::convert{{name}}ToRaw(this){{^root}}.(Raw::{{name}}){{/root}}.{{getter}}({{#is_indexed}}index{{/is_indexed}})) result = Synth::convert{{type}}FromRaw(Synth::convert{{name}}ToRaw(this){{^root}}.(Raw::{{name}}){{/root}}.{{getter}}({{#is_indexed}}index{{/is_indexed}}))
{{/synth}} {{/synth}}
@@ -95,7 +95,7 @@ module Generated {
* INTERNAL: Do not use. * INTERNAL: Do not use.
{{/internal}} {{/internal}}
*/ */
final {{type}} {{getter}}({{#is_indexed}}int index{{/is_indexed}}) { final {{type_alias}} {{getter}}({{#is_indexed}}int index{{/is_indexed}}) {
exists({{type}} immediate | immediate = this.get{{#is_unordered}}An{{/is_unordered}}Immediate{{singular}}({{#is_indexed}}index{{/is_indexed}}) and exists({{type}} immediate | immediate = this.get{{#is_unordered}}An{{/is_unordered}}Immediate{{singular}}({{#is_indexed}}index{{/is_indexed}}) and
{{#hideable}}if exists(this.getResolveStep()) then result = immediate else {{/hideable}}result = immediate.resolve()) {{#hideable}}if exists(this.getResolveStep()) then result = immediate else {{/hideable}}result = immediate.resolve())
} }
@@ -111,7 +111,7 @@ module Generated {
* INTERNAL: Do not use. * INTERNAL: Do not use.
{{/internal}} {{/internal}}
*/ */
{{type}} {{getter}}({{#is_indexed}}int index{{/is_indexed}}) { {{type_alias}} {{getter}}({{#is_indexed}}int index{{/is_indexed}}) {
{{^synth}} {{^synth}}
{{^is_predicate}}result = {{/is_predicate}}{{#type_is_codegen_class}}Synth::convert{{type}}FromRaw({{/type_is_codegen_class}}Synth::convert{{name}}ToRaw(this){{^root}}.(Raw::{{name}}){{/root}}.{{getter}}({{#is_indexed}}index{{/is_indexed}}){{#type_is_codegen_class}}){{/type_is_codegen_class}} {{^is_predicate}}result = {{/is_predicate}}{{#type_is_codegen_class}}Synth::convert{{type}}FromRaw({{/type_is_codegen_class}}Synth::convert{{name}}ToRaw(this){{^root}}.(Raw::{{name}}){{/root}}.{{getter}}({{#is_indexed}}index{{/is_indexed}}){{#type_is_codegen_class}}){{/type_is_codegen_class}}
{{/synth}} {{/synth}}
@@ -140,7 +140,7 @@ module Generated {
* INTERNAL: Do not use. * INTERNAL: Do not use.
{{/internal}} {{/internal}}
*/ */
final {{type}} {{indefinite_getter}}() { final {{type_alias}} {{indefinite_getter}}() {
result = this.{{getter}}(_) result = this.{{getter}}(_)
} }
{{^is_optional}} {{^is_optional}}

View File

@@ -582,7 +582,7 @@ lib/codeql/rust/elements/internal/generated/ParenTypeRepr.qll 40ab5c592e7699c621
lib/codeql/rust/elements/internal/generated/ParentChild.qll a180b0d0c8c33503dc4c013c3f568eaa628d24204bfc36a7484c56a701a79f95 df002e5540bfe5de4e6849879f334b09c2ffb4893ff8364146c6c505f4b2d090 lib/codeql/rust/elements/internal/generated/ParentChild.qll a180b0d0c8c33503dc4c013c3f568eaa628d24204bfc36a7484c56a701a79f95 df002e5540bfe5de4e6849879f334b09c2ffb4893ff8364146c6c505f4b2d090
lib/codeql/rust/elements/internal/generated/ParenthesizedArgList.qll c5fa328ea60d3a3333d7c7bb3480969c1873166c7ac8ebb9d0afad7a8099d1a8 2dbbb6200d96f7db7dea4a55bdeab8d67b14d39a43e0bd54ada019f7e466f163 lib/codeql/rust/elements/internal/generated/ParenthesizedArgList.qll c5fa328ea60d3a3333d7c7bb3480969c1873166c7ac8ebb9d0afad7a8099d1a8 2dbbb6200d96f7db7dea4a55bdeab8d67b14d39a43e0bd54ada019f7e466f163
lib/codeql/rust/elements/internal/generated/Pat.qll 3605ac062be2f294ee73336e9669027b8b655f4ad55660e1eab35266275154ee 7f9400db2884d336dd1d21df2a8093759c2a110be9bf6482ce8e80ae0fd74ed4 lib/codeql/rust/elements/internal/generated/Pat.qll 3605ac062be2f294ee73336e9669027b8b655f4ad55660e1eab35266275154ee 7f9400db2884d336dd1d21df2a8093759c2a110be9bf6482ce8e80ae0fd74ed4
lib/codeql/rust/elements/internal/generated/Path.qll bf6a86e7fcb7164624cc070dcce86d2bda50a2516b95115b87d0ebb5596e50a1 fd7a9ad4034cdebe8dfe495619c46f464630d38195313072e0bd904061b0fb00 lib/codeql/rust/elements/internal/generated/Path.qll 8e47e91aff3f8c60f1ee8cb3887b8e4936c38e4665d052f2c92a939a969aac29 2c28beb89cabd7c7c91a5bc65c874f414cb96bbefde37b25811b61089a8a0053
lib/codeql/rust/elements/internal/generated/PathAstNode.qll e6d4d5bffd3c623baaaee46bc183eb31ce88795535f164f6a9b9b4d98bbd6101 168db515404933479ba6b150c72e012d28592cbc32366aefcb1bf9599dbcd183 lib/codeql/rust/elements/internal/generated/PathAstNode.qll e6d4d5bffd3c623baaaee46bc183eb31ce88795535f164f6a9b9b4d98bbd6101 168db515404933479ba6b150c72e012d28592cbc32366aefcb1bf9599dbcd183
lib/codeql/rust/elements/internal/generated/PathExpr.qll 34ebad4d062ce8b7e517f2ab09d52745fb8455203f4a936df7284ad296638387 ba66781cdbdeb89c27a4bfb2be0f27f85fb34978d699b4e343446fb0d7ad2aa6 lib/codeql/rust/elements/internal/generated/PathExpr.qll 34ebad4d062ce8b7e517f2ab09d52745fb8455203f4a936df7284ad296638387 ba66781cdbdeb89c27a4bfb2be0f27f85fb34978d699b4e343446fb0d7ad2aa6
lib/codeql/rust/elements/internal/generated/PathExprBase.qll d8218e201b8557fa6d9ca2c30b764e5ad9a04a2e4fb695cc7219bbd7636a6ac2 4ef178426d7095a156f4f8c459b4d16f63abc64336cb50a6cf883a5f7ee09113 lib/codeql/rust/elements/internal/generated/PathExprBase.qll d8218e201b8557fa6d9ca2c30b764e5ad9a04a2e4fb695cc7219bbd7636a6ac2 4ef178426d7095a156f4f8c459b4d16f63abc64336cb50a6cf883a5f7ee09113

View File

@@ -10,6 +10,8 @@ import codeql.rust.elements.internal.AstNodeImpl::Impl as AstNodeImpl
import codeql.rust.elements.Path import codeql.rust.elements.Path
import codeql.rust.elements.PathSegment import codeql.rust.elements.PathSegment
private class PathAlias = Path;
/** /**
* INTERNAL: This module contains the fully generated definition of `Path` and should not * INTERNAL: This module contains the fully generated definition of `Path` and should not
* be referenced directly. * be referenced directly.
@@ -30,7 +32,7 @@ module Generated {
/** /**
* Gets the qualifier of this path, if it exists. * Gets the qualifier of this path, if it exists.
*/ */
Path getQualifier() { PathAlias getQualifier() {
result = Synth::convertPathFromRaw(Synth::convertPathToRaw(this).(Raw::Path).getQualifier()) result = Synth::convertPathFromRaw(Synth::convertPathToRaw(this).(Raw::Path).getQualifier())
} }

View File

@@ -27,7 +27,7 @@ class StreamCipherInit extends Cryptography::CryptographicOperation::Range {
p.getResolvedCrateOrigin().matches("%/RustCrypto%") and p.getResolvedCrateOrigin().matches("%/RustCrypto%") and
p.getPath().getText() = ["new", "new_from_slice", "new_from_slices", "new_with_eff_key_len"] and p.getPath().getText() = ["new", "new_from_slice", "new_from_slices", "new_with_eff_key_len"] and
( (
rawAlgorithmName = p.getPath().getQualifier().(Path).getText() or // todo: remove infix cast when codegenerator has been fixed rawAlgorithmName = p.getPath().getQualifier().getText() or
rawAlgorithmName = rawAlgorithmName =
p.getPath() p.getPath()
.getQualifier() .getQualifier()

View File

@@ -186,7 +186,7 @@ class ModeledHashOperation extends Cryptography::CryptographicOperation::Range {
sinkNode(input, "hasher-input") and sinkNode(input, "hasher-input") and
call = input.(Node::FlowSummaryNode).getSinkElement().getCall() and call = input.(Node::FlowSummaryNode).getSinkElement().getCall() and
call = this.asExpr().getExpr() and call = this.asExpr().getExpr() and
algorithmName = call.getFunction().(PathExpr).getPath().getQualifier().(Path).getText() // todo: remove infix cast when codegenerator has been fixed algorithmName = call.getFunction().(PathExpr).getPath().getQualifier().getText()
) )
} }

View File

@@ -726,7 +726,7 @@ lib/codeql/swift/generated/decl/AssociatedTypeDecl.qll a590cfa5980eaf5b52c2bfb0a
lib/codeql/swift/generated/decl/CapturedDecl.qll 07999cdbe928b22e157a7295f25c0a9483b29fd1784fe3d9c6e7f1f211b676ab 62b45dc415ab912ad77db69f93011573918ddaeb0ce6837434b86c3fe561536f lib/codeql/swift/generated/decl/CapturedDecl.qll 07999cdbe928b22e157a7295f25c0a9483b29fd1784fe3d9c6e7f1f211b676ab 62b45dc415ab912ad77db69f93011573918ddaeb0ce6837434b86c3fe561536f
lib/codeql/swift/generated/decl/ClassDecl.qll 6d77c5a54c596a4a59d7c8490025411ca6592c55b0f88bda2ad7d62eedf46762 3f8a409209a10c3f7e4ea13be4f00f7d353340b8c8cf357b099b3f244fb9a10e lib/codeql/swift/generated/decl/ClassDecl.qll 6d77c5a54c596a4a59d7c8490025411ca6592c55b0f88bda2ad7d62eedf46762 3f8a409209a10c3f7e4ea13be4f00f7d353340b8c8cf357b099b3f244fb9a10e
lib/codeql/swift/generated/decl/ConcreteVarDecl.qll 04851641d3bba5b38be05159485ec429f0583c921342ab106a67fc9ec938580e 878f6369aaf224d6ad873c3d16a92ac246085cafde6f27e044b228cfc7683da5 lib/codeql/swift/generated/decl/ConcreteVarDecl.qll 04851641d3bba5b38be05159485ec429f0583c921342ab106a67fc9ec938580e 878f6369aaf224d6ad873c3d16a92ac246085cafde6f27e044b228cfc7683da5
lib/codeql/swift/generated/decl/Decl.qll 27975044e201c1bc3475c0da95020379049589c8e61982f751603c42258d5c2f 46b0668e3fa0df216511a65a3ace3009285fc8a9533e3df6f558c62ce1e14c7b lib/codeql/swift/generated/decl/Decl.qll ece3c397f885b683c3bf0a41a2e03cecb8559959b4986463abfd4b2790cd507d a15ceee144caa31c42db68134062af101847d8bf38612a4456f5acf52998e843
lib/codeql/swift/generated/decl/Deinitializer.qll 89e2612dd6a77edabcd02daa408975137b7ccbada7f5e7e3659fca1b4885bcb3 3e6c6a7ffd914de1853ce2299ddbc6ea598eeb572ef66db9f8c3fdd7ee0766f8 lib/codeql/swift/generated/decl/Deinitializer.qll 89e2612dd6a77edabcd02daa408975137b7ccbada7f5e7e3659fca1b4885bcb3 3e6c6a7ffd914de1853ce2299ddbc6ea598eeb572ef66db9f8c3fdd7ee0766f8
lib/codeql/swift/generated/decl/EnumCaseDecl.qll e26a4201d1ee3c5767903067303e6f0c1e91bd9f5802a1e6aacfa48e275c43f0 0781fd0621b03b4753be0e80c1a543ea11e9e93a7760434e1e03a0e8e32125d9 lib/codeql/swift/generated/decl/EnumCaseDecl.qll e26a4201d1ee3c5767903067303e6f0c1e91bd9f5802a1e6aacfa48e275c43f0 0781fd0621b03b4753be0e80c1a543ea11e9e93a7760434e1e03a0e8e32125d9
lib/codeql/swift/generated/decl/EnumDecl.qll cc5fa4aa5f0c00d694dfdef2bf7207d21179c456019152e85ad7fc7e5ce4b0ac 14023d9b557f780dc61f2e5639cfad6e34f3151a992eaad324f5200172f8fef5 lib/codeql/swift/generated/decl/EnumDecl.qll cc5fa4aa5f0c00d694dfdef2bf7207d21179c456019152e85ad7fc7e5ce4b0ac 14023d9b557f780dc61f2e5639cfad6e34f3151a992eaad324f5200172f8fef5
@@ -742,7 +742,7 @@ lib/codeql/swift/generated/decl/InfixOperatorDecl.qll 470f7c99332ebdc0d338f297ba
lib/codeql/swift/generated/decl/Initializer.qll 75bb9636b060e19a4abf9a83552e99381c3ebdccd553c6bc383fe09f2a7f3708 60f0fe8d1b27cd5bf0c77d7a35695f0fca8787bc5801fb3546d27abd4ba9d23e lib/codeql/swift/generated/decl/Initializer.qll 75bb9636b060e19a4abf9a83552e99381c3ebdccd553c6bc383fe09f2a7f3708 60f0fe8d1b27cd5bf0c77d7a35695f0fca8787bc5801fb3546d27abd4ba9d23e
lib/codeql/swift/generated/decl/MacroDecl.qll ee7b112ae935b9b39cfa0b7f7aea1576eb5f14f56fc74d0b00532e1302fb3792 4c1b1be1ddc8b99884a83261122c9d56b2f156d66d960ee283d3161007d77743 lib/codeql/swift/generated/decl/MacroDecl.qll ee7b112ae935b9b39cfa0b7f7aea1576eb5f14f56fc74d0b00532e1302fb3792 4c1b1be1ddc8b99884a83261122c9d56b2f156d66d960ee283d3161007d77743
lib/codeql/swift/generated/decl/MissingMemberDecl.qll dedc5078b55054763192c65cd856273b387a6d56738c7e349a43d281b6589167 956e21409ad3603d82f6bc63fd0f296370023addf84cae39f64a817cd84ffb0f lib/codeql/swift/generated/decl/MissingMemberDecl.qll dedc5078b55054763192c65cd856273b387a6d56738c7e349a43d281b6589167 956e21409ad3603d82f6bc63fd0f296370023addf84cae39f64a817cd84ffb0f
lib/codeql/swift/generated/decl/ModuleDecl.qll 0300b135e1016f20fe38acef57094a88e31d022ca5385560f3623314e7e48ca5 bcd0273f82abdc8e6266630ab3494b358d89b4c5a7d88406e82956691e4b768b lib/codeql/swift/generated/decl/ModuleDecl.qll d426d2a9f4b239a9f4eaa564219e82d1ccfaf8fa99a318e60aec99d625a3f75c b067e958e4a2bce03b91fc4b074d54a7465936fc5a1948dde9ef9a60600d9eaa
lib/codeql/swift/generated/decl/NamedFunction.qll 6a3b7a5accfdc68750f4363bd2a1aaca3e8686fb53798644a91f5ada3ac62539 258ecaec06e1ad497ba6071bad804816214de6059bbb35cb8c4a5841a9997a19 lib/codeql/swift/generated/decl/NamedFunction.qll 6a3b7a5accfdc68750f4363bd2a1aaca3e8686fb53798644a91f5ada3ac62539 258ecaec06e1ad497ba6071bad804816214de6059bbb35cb8c4a5841a9997a19
lib/codeql/swift/generated/decl/NominalTypeDecl.qll 253e228ac80611c0472411a3ed8320f9369f5750a2c6bdf9c7f73222efc67c45 64f26a6624764242f699bf3afde6db560fe4bf93bd9d2b1cf91152d999322efc lib/codeql/swift/generated/decl/NominalTypeDecl.qll 253e228ac80611c0472411a3ed8320f9369f5750a2c6bdf9c7f73222efc67c45 64f26a6624764242f699bf3afde6db560fe4bf93bd9d2b1cf91152d999322efc
lib/codeql/swift/generated/decl/OpaqueTypeDecl.qll 22cee175a61d99345698a5c3702f11b625d14daff138e84aad74c63ce7d9ba7a 070ec8e37582705a905f55a4afd037012313fe86a16ef8c393d4db842ce880af lib/codeql/swift/generated/decl/OpaqueTypeDecl.qll 22cee175a61d99345698a5c3702f11b625d14daff138e84aad74c63ce7d9ba7a 070ec8e37582705a905f55a4afd037012313fe86a16ef8c393d4db842ce880af
@@ -760,7 +760,7 @@ lib/codeql/swift/generated/decl/TopLevelCodeDecl.qll b327da6de5b1e40f5eea5893f4f
lib/codeql/swift/generated/decl/TypeAliasDecl.qll 041c098c276bc7369049e9a11540e99b061d50977338cceca47488f82b21694e 06deed614cbe77031fdbf3f9591780e80b9f545adec8b7831a2b5329ee49bc5f lib/codeql/swift/generated/decl/TypeAliasDecl.qll 041c098c276bc7369049e9a11540e99b061d50977338cceca47488f82b21694e 06deed614cbe77031fdbf3f9591780e80b9f545adec8b7831a2b5329ee49bc5f
lib/codeql/swift/generated/decl/TypeDecl.qll 92f74709cce7e9f0f713598d3b20b730475c312957c518b8096206f8744419a2 305bda46c8bef48b7e30392698e724093ab2984ffed74cae3361f818cbf8c77a lib/codeql/swift/generated/decl/TypeDecl.qll 92f74709cce7e9f0f713598d3b20b730475c312957c518b8096206f8744419a2 305bda46c8bef48b7e30392698e724093ab2984ffed74cae3361f818cbf8c77a
lib/codeql/swift/generated/decl/ValueDecl.qll d3b9c241fd6cb1ce8274435c0242775c28c08f6a47caae01ad1ecd38897b2cd5 bc81291b1394b47972d7b75b6a767ed847f881932a7d9345d28d161a55b66bd1 lib/codeql/swift/generated/decl/ValueDecl.qll d3b9c241fd6cb1ce8274435c0242775c28c08f6a47caae01ad1ecd38897b2cd5 bc81291b1394b47972d7b75b6a767ed847f881932a7d9345d28d161a55b66bd1
lib/codeql/swift/generated/decl/VarDecl.qll f36a0af8720f824a841ef2a23bf496adfc082080e8850463ccfe018ab00399b0 dbef4ab4b1c0e75ee9a9f75bd1adb773fd0cfb2b56fb667a7548a847df2b7b0f lib/codeql/swift/generated/decl/VarDecl.qll 8978a73fa2d7a9f952b68a2638788eda857e62502311a33fa6de1dad49a6cb1c b8b6c8cf6773056c3a90494754b0a257dcae494c03d933f138ece7f531fb9158
lib/codeql/swift/generated/expr/AbiSafeConversionExpr.qll 9d8f0f895a5e1abb89bed9671a9b398e48eca4664eb10b4b41263eb2a29bb2cf 4f65b8e62876664a357433f886baccaf40e4bf7e9ca7eebeb9f5d999354578f9 lib/codeql/swift/generated/expr/AbiSafeConversionExpr.qll 9d8f0f895a5e1abb89bed9671a9b398e48eca4664eb10b4b41263eb2a29bb2cf 4f65b8e62876664a357433f886baccaf40e4bf7e9ca7eebeb9f5d999354578f9
lib/codeql/swift/generated/expr/AnyHashableErasureExpr.qll e9040afb7bf3d2d79fe931aa98f565bf1b8ad4ba56a9f2ee579e61afa7c50719 1e6e4fa2519522a117b7ca05c060f060376974a4148cbad38bb238ac432509c6 lib/codeql/swift/generated/expr/AnyHashableErasureExpr.qll e9040afb7bf3d2d79fe931aa98f565bf1b8ad4ba56a9f2ee579e61afa7c50719 1e6e4fa2519522a117b7ca05c060f060376974a4148cbad38bb238ac432509c6
lib/codeql/swift/generated/expr/AnyTryExpr.qll 32b5df81d686959183af42c0ba30976360f3062bd6279b88d8578ac010740b24 b8a78d4e06d7160b83b31bbd033e4697f607bd6ea294f2e0dbbe96a0c665014d lib/codeql/swift/generated/expr/AnyTryExpr.qll 32b5df81d686959183af42c0ba30976360f3062bd6279b88d8578ac010740b24 b8a78d4e06d7160b83b31bbd033e4697f607bd6ea294f2e0dbbe96a0c665014d
@@ -990,7 +990,7 @@ lib/codeql/swift/generated/type/SubstitutableType.qll b38994c2b445513198950e790c
lib/codeql/swift/generated/type/SugarType.qll c0a5bda4f2d2155460707d0ca8c1d5ab46097eef9e76aef92b54d62f320d13c3 70a43bf44db3596c359e28af59297f7f5852c18a3bc58dda35aed7b29e5f66f5 lib/codeql/swift/generated/type/SugarType.qll c0a5bda4f2d2155460707d0ca8c1d5ab46097eef9e76aef92b54d62f320d13c3 70a43bf44db3596c359e28af59297f7f5852c18a3bc58dda35aed7b29e5f66f5
lib/codeql/swift/generated/type/SyntaxSugarType.qll c462b376aa5d2fb2dcf76d6d2875b5d895f6c23e637e376ac8f16b1b5857b087 82d2fc2faa6d958795d5f044787e1f60d0eeef05e718e2566c4ae74779a8f38a lib/codeql/swift/generated/type/SyntaxSugarType.qll c462b376aa5d2fb2dcf76d6d2875b5d895f6c23e637e376ac8f16b1b5857b087 82d2fc2faa6d958795d5f044787e1f60d0eeef05e718e2566c4ae74779a8f38a
lib/codeql/swift/generated/type/TupleType.qll 118ee646bf107e4c230e7b78a88e91085e26810b84f70a5b3f6a9e46d46b4f9c 6a1ecf46269b17edc9f7ac8bc3656a12c2c41195ca7c121dbc6174d69b5e00c2 lib/codeql/swift/generated/type/TupleType.qll 118ee646bf107e4c230e7b78a88e91085e26810b84f70a5b3f6a9e46d46b4f9c 6a1ecf46269b17edc9f7ac8bc3656a12c2c41195ca7c121dbc6174d69b5e00c2
lib/codeql/swift/generated/type/Type.qll 3c10bdab1f20f242b9dc20492a3a4d234d5207173fffde295552100781933840 3458524b51504bf8b3848f585e102fd82e64900475bf33d22d2e41670b8874b4 lib/codeql/swift/generated/type/Type.qll 4ddd951e68596f8a29ec6404ac0b6dee8fb63f15b08174e2eebf7d09664f2fd0 2b98cb4714187ebca38d271e78d67686e075c30fb551cc3d91bcf3f4b8c921b5
lib/codeql/swift/generated/type/TypeAliasType.qll e13e1441697273d807cb32370f4f1822bf0917575eb691e87ac75241db6d28c1 cade651da280fea21b4d12976501c7ec17c7114643b49a46d59414ed870af4fe lib/codeql/swift/generated/type/TypeAliasType.qll e13e1441697273d807cb32370f4f1822bf0917575eb691e87ac75241db6d28c1 cade651da280fea21b4d12976501c7ec17c7114643b49a46d59414ed870af4fe
lib/codeql/swift/generated/type/TypeRepr.qll 30c750a4802b819478fad36baf0d8d440494f79d66fbecb054ec98ab5788c5ba 51f7de6f16c0c4d3a3bf0124445ac0bd026e54abf176ed1da322314e512f32ab lib/codeql/swift/generated/type/TypeRepr.qll 30c750a4802b819478fad36baf0d8d440494f79d66fbecb054ec98ab5788c5ba 51f7de6f16c0c4d3a3bf0124445ac0bd026e54abf176ed1da322314e512f32ab
lib/codeql/swift/generated/type/UnarySyntaxSugarType.qll 22b59fa3aee9efc1955726aeab52175e400de294df246f14019bbad917cf622f 35419d971c8c22e08a6fb1cf11d795aef5a1193793a91b57767b90e30c4b897d lib/codeql/swift/generated/type/UnarySyntaxSugarType.qll 22b59fa3aee9efc1955726aeab52175e400de294df246f14019bbad917cf622f 35419d971c8c22e08a6fb1cf11d795aef5a1193793a91b57767b90e30c4b897d

View File

@@ -10,6 +10,8 @@ import codeql.swift.elements.internal.AstNodeImpl::Impl as AstNodeImpl
import codeql.swift.elements.decl.Decl import codeql.swift.elements.decl.Decl
import codeql.swift.elements.decl.ModuleDecl import codeql.swift.elements.decl.ModuleDecl
private class DeclAlias = Decl;
/** /**
* INTERNAL: This module contains the fully generated definition of `Decl` and should not * INTERNAL: This module contains the fully generated definition of `Decl` and should not
* be referenced directly. * be referenced directly.
@@ -35,14 +37,14 @@ module Generated {
* on the order of members given by `getMember`. In some cases the order of members may not * on the order of members given by `getMember`. In some cases the order of members may not
* align with expectations, and could change in future releases. * align with expectations, and could change in future releases.
*/ */
Decl getMember(int index) { DeclAlias getMember(int index) {
result = Synth::convertDeclFromRaw(Synth::convertDeclToRaw(this).(Raw::Decl).getMember(index)) result = Synth::convertDeclFromRaw(Synth::convertDeclToRaw(this).(Raw::Decl).getMember(index))
} }
/** /**
* Gets any of the members of this declaration. * Gets any of the members of this declaration.
*/ */
final Decl getAMember() { result = this.getMember(_) } final DeclAlias getAMember() { result = this.getMember(_) }
/** /**
* Gets the number of members of this declaration. * Gets the number of members of this declaration.

View File

@@ -9,6 +9,8 @@ private import codeql.swift.generated.Raw
import codeql.swift.elements.decl.ModuleDecl import codeql.swift.elements.decl.ModuleDecl
import codeql.swift.elements.decl.internal.TypeDeclImpl::Impl as TypeDeclImpl import codeql.swift.elements.decl.internal.TypeDeclImpl::Impl as TypeDeclImpl
private class ModuleDeclAlias = ModuleDecl;
/** /**
* INTERNAL: This module contains the fully generated definition of `ModuleDecl` and should not * INTERNAL: This module contains the fully generated definition of `ModuleDecl` and should not
* be referenced directly. * be referenced directly.
@@ -39,7 +41,7 @@ module Generated {
* Gets the `index`th imported module of this module declaration (0-based). * Gets the `index`th imported module of this module declaration (0-based).
*Gets any of the imported modules of this module declaration. *Gets any of the imported modules of this module declaration.
*/ */
ModuleDecl getAnImportedModule() { ModuleDeclAlias getAnImportedModule() {
result = result =
Synth::convertModuleDeclFromRaw(Synth::convertModuleDeclToRaw(this) Synth::convertModuleDeclFromRaw(Synth::convertModuleDeclToRaw(this)
.(Raw::ModuleDecl) .(Raw::ModuleDecl)
@@ -55,7 +57,7 @@ module Generated {
* Gets the `index`th exported module of this module declaration (0-based). * Gets the `index`th exported module of this module declaration (0-based).
*Gets any of the exported modules of this module declaration. *Gets any of the exported modules of this module declaration.
*/ */
ModuleDecl getAnExportedModule() { ModuleDeclAlias getAnExportedModule() {
result = result =
Synth::convertModuleDeclFromRaw(Synth::convertModuleDeclToRaw(this) Synth::convertModuleDeclFromRaw(Synth::convertModuleDeclToRaw(this)
.(Raw::ModuleDecl) .(Raw::ModuleDecl)

View File

@@ -13,6 +13,8 @@ import codeql.swift.elements.decl.PatternBindingDecl
import codeql.swift.elements.type.Type import codeql.swift.elements.type.Type
import codeql.swift.elements.decl.VarDecl import codeql.swift.elements.decl.VarDecl
private class VarDeclAlias = VarDecl;
/** /**
* INTERNAL: This module contains the fully generated definition of `VarDecl` and should not * INTERNAL: This module contains the fully generated definition of `VarDecl` and should not
* be referenced directly. * be referenced directly.
@@ -189,7 +191,7 @@ module Generated {
* ``` * ```
* This predicate returns such variable declaration. * This predicate returns such variable declaration.
*/ */
VarDecl getPropertyWrapperBackingVar() { VarDeclAlias getPropertyWrapperBackingVar() {
result = result =
Synth::convertVarDeclFromRaw(Synth::convertVarDeclToRaw(this) Synth::convertVarDeclFromRaw(Synth::convertVarDeclToRaw(this)
.(Raw::VarDecl) .(Raw::VarDecl)
@@ -246,7 +248,7 @@ module Generated {
* ``` * ```
* This predicate returns such variable declaration. * This predicate returns such variable declaration.
*/ */
VarDecl getPropertyWrapperProjectionVar() { VarDeclAlias getPropertyWrapperProjectionVar() {
result = result =
Synth::convertVarDeclFromRaw(Synth::convertVarDeclToRaw(this) Synth::convertVarDeclFromRaw(Synth::convertVarDeclToRaw(this)
.(Raw::VarDecl) .(Raw::VarDecl)

View File

@@ -9,6 +9,8 @@ private import codeql.swift.generated.Raw
import codeql.swift.elements.internal.ElementImpl::Impl as ElementImpl import codeql.swift.elements.internal.ElementImpl::Impl as ElementImpl
import codeql.swift.elements.type.Type import codeql.swift.elements.type.Type
private class TypeAlias = Type;
/** /**
* INTERNAL: This module contains the fully generated definition of `Type` and should not * INTERNAL: This module contains the fully generated definition of `Type` and should not
* be referenced directly. * be referenced directly.
@@ -30,7 +32,7 @@ module Generated {
* This includes nodes from the "hidden" AST. It can be overridden in subclasses to change the * This includes nodes from the "hidden" AST. It can be overridden in subclasses to change the
* behavior of both the `Immediate` and non-`Immediate` versions. * behavior of both the `Immediate` and non-`Immediate` versions.
*/ */
Type getImmediateCanonicalType() { TypeAlias getImmediateCanonicalType() {
result = result =
Synth::convertTypeFromRaw(Synth::convertTypeToRaw(this).(Raw::Type).getCanonicalType()) Synth::convertTypeFromRaw(Synth::convertTypeToRaw(this).(Raw::Type).getCanonicalType())
} }
@@ -44,7 +46,7 @@ module Generated {
* ``` * ```
* then `[MyInt?]` has the canonical type `Array<Optional<Int>>`. * then `[MyInt?]` has the canonical type `Array<Optional<Int>>`.
*/ */
final Type getCanonicalType() { final TypeAlias getCanonicalType() {
exists(Type immediate | exists(Type immediate |
immediate = this.getImmediateCanonicalType() and immediate = this.getImmediateCanonicalType() and
if exists(this.getResolveStep()) then result = immediate else result = immediate.resolve() if exists(this.getResolveStep()) then result = immediate else result = immediate.resolve()