From f22d60f011b76ed23cc307724ace6936cf59fb15 Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Mon, 23 Oct 2023 12:37:32 +0200 Subject: [PATCH 1/7] Swift: clean up `VarDecl`, `NamedPattern` and `SwitchStmt` interactions * `variables` under `CaseStmt` are now AST children, which solves orphan `VarDecl`s in that case * reordered `CaseStmt` AST children to be `labels > variables > body` (was `body > labels`) * made `NamedPattern::getVarDecl` an extracted property instead of `getName` * The above led to duplicate DB entities because of a quirk in the Swift compiler code. This is solved by tweaking the extraction of `variables` under `CaseStmt` to not use `getCaseBodyVariables`. --- .../translators/PatternTranslator.cpp | 2 +- .../extractor/translators/StmtTranslator.cpp | 17 +- swift/ql/.generated.list | 19 +- swift/ql/.gitattributes | 11 +- .../swift/elements/pattern/NamedPattern.qll | 15 +- .../codeql/swift/generated/ParentChild.qll | 16 +- swift/ql/lib/codeql/swift/generated/Raw.qll | 14 +- .../swift/generated/pattern/NamedPattern.qll | 10 +- .../codeql/swift/generated/stmt/CaseStmt.qll | 16 +- swift/ql/lib/swift.dbscheme | 2 +- .../ConcreteVarDecl/ConcreteVarDecl.expected | 6 + .../ConcreteVarDecl_getParentPattern.expected | 4 + .../decl/ConcreteVarDecl/var_decls.swift | 13 + .../stmt/CaseLabelItem/MISSING_SOURCE.txt | 4 - .../stmt/CaseStmt/MISSING_SOURCE.txt | 4 - .../stmt/SwitchStmt/CaseLabelItem.expected | 13 + .../stmt/SwitchStmt/CaseLabelItem.ql | 11 + .../CaseLabelItem_getGuard.expected | 2 + .../stmt/SwitchStmt/CaseLabelItem_getGuard.ql | 7 + .../stmt/SwitchStmt/CaseStmt.expected | 12 + .../generated/stmt/SwitchStmt/CaseStmt.ql | 13 + .../SwitchStmt/CaseStmt_getLabel.expected | 13 + .../stmt/SwitchStmt/CaseStmt_getLabel.ql | 7 + .../SwitchStmt/CaseStmt_getVariable.expected | 7 + .../stmt/SwitchStmt/CaseStmt_getVariable.ql | 7 + .../stmt/SwitchStmt/MISSING_SOURCE.txt | 4 - .../stmt/SwitchStmt/SwitchStmt.expected | 4 + .../generated/stmt/SwitchStmt/SwitchStmt.ql | 12 + .../SwitchStmt/SwitchStmt_getCase.expected | 12 + .../stmt/SwitchStmt/SwitchStmt_getCase.ql | 7 + .../SwitchStmt/SwitchStmt_getLabel.expected | 2 + .../stmt/SwitchStmt/SwitchStmt_getLabel.ql | 7 + .../generated/stmt/SwitchStmt/switch.swift | 42 ++ .../extractor-tests/updates/PrintAst.expected | 16 +- .../test/library-tests/ast/PrintAst.expected | 570 ++++++++++-------- swift/schema.py | 8 +- 36 files changed, 602 insertions(+), 327 deletions(-) delete mode 100644 swift/ql/test/extractor-tests/generated/stmt/CaseLabelItem/MISSING_SOURCE.txt delete mode 100644 swift/ql/test/extractor-tests/generated/stmt/CaseStmt/MISSING_SOURCE.txt create mode 100644 swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/CaseLabelItem.expected create mode 100644 swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/CaseLabelItem.ql create mode 100644 swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/CaseLabelItem_getGuard.expected create mode 100644 swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/CaseLabelItem_getGuard.ql create mode 100644 swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/CaseStmt.expected create mode 100644 swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/CaseStmt.ql create mode 100644 swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/CaseStmt_getLabel.expected create mode 100644 swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/CaseStmt_getLabel.ql create mode 100644 swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/CaseStmt_getVariable.expected create mode 100644 swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/CaseStmt_getVariable.ql delete mode 100644 swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/MISSING_SOURCE.txt create mode 100644 swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/SwitchStmt.expected create mode 100644 swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/SwitchStmt.ql create mode 100644 swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/SwitchStmt_getCase.expected create mode 100644 swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/SwitchStmt_getCase.ql create mode 100644 swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/SwitchStmt_getLabel.expected create mode 100644 swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/SwitchStmt_getLabel.ql create mode 100644 swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/switch.swift diff --git a/swift/extractor/translators/PatternTranslator.cpp b/swift/extractor/translators/PatternTranslator.cpp index 14a913d26b42..195e9af33781 100644 --- a/swift/extractor/translators/PatternTranslator.cpp +++ b/swift/extractor/translators/PatternTranslator.cpp @@ -4,7 +4,7 @@ namespace codeql { codeql::NamedPattern PatternTranslator::translateNamedPattern(const swift::NamedPattern& pattern) { auto entry = dispatcher.createEntry(pattern); - entry.name = pattern.getNameStr().str(); + entry.var_decl = dispatcher.fetchLabel(pattern.getDecl()); return entry; } diff --git a/swift/extractor/translators/StmtTranslator.cpp b/swift/extractor/translators/StmtTranslator.cpp index c856e5c0ab1d..f58a8c37d61d 100644 --- a/swift/extractor/translators/StmtTranslator.cpp +++ b/swift/extractor/translators/StmtTranslator.cpp @@ -73,7 +73,7 @@ codeql::ForEachStmt StmtTranslator::translateForEachStmt(const swift::ForEachStm auto entry = dispatcher.createEntry(stmt); fillLabeledStmt(stmt, entry); entry.body = dispatcher.fetchLabel(stmt.getBody()); - // entry.sequence = dispatcher.fetchLabel(stmt.getTypeCheckedSequence()); + // entry.sequence = dispatcher.fetchLabel(stmt.getTypeCheckedSequence()); entry.pattern = dispatcher.fetchLabel(stmt.getPattern()); entry.iteratorVar = dispatcher.fetchLabel(stmt.getIteratorVar()); entry.where = dispatcher.fetchOptionalLabel(stmt.getWhere()); @@ -133,12 +133,17 @@ codeql::DoCatchStmt StmtTranslator::translateDoCatchStmt(const swift::DoCatchStm codeql::CaseStmt StmtTranslator::translateCaseStmt(const swift::CaseStmt& stmt) { auto entry = dispatcher.createEntry(stmt); + auto labels = stmt.getCaseLabelItems(); entry.body = dispatcher.fetchLabel(stmt.getBody()); - entry.labels = dispatcher.fetchRepeatedLabels(stmt.getCaseLabelItems()); - if (stmt.hasCaseBodyVariables()) { - for (auto var : stmt.getCaseBodyVariables()) { - entry.variables.push_back(dispatcher.fetchLabel(var)); - } + entry.labels = dispatcher.fetchRepeatedLabels(labels); + // we don't use stmt.getCaseBodyVariables() because it's actually filled with copies of the + // variable declarations, which would lead to duplicate `DeclVar` entities. + // Instead we follow the same logic that's used to fill getCaseBodyVariables, looking at the first + // pattern and collecting variables from it. See + // https://github.com/apple/swift/blob/71fff6649b3ce57cc22954f141cf8b567be6de88/lib/Parse/ParseStmt.cpp#L2210 + if (!labels.empty() && labels.front().getPattern()) { + labels.front().getPattern()->forEachVariable( + [&](const swift::VarDecl* var) { entry.variables.push_back(dispatcher.fetchLabel(var)); }); } return entry; } diff --git a/swift/ql/.generated.list b/swift/ql/.generated.list index 0b575dc34b32..4eebffc01766 100644 --- a/swift/ql/.generated.list +++ b/swift/ql/.generated.list @@ -376,10 +376,10 @@ lib/codeql/swift/generated/KeyPathComponent.qll c79c7bc04fc1426992ab472eedc1a20a lib/codeql/swift/generated/Locatable.qll be20967d48a34cdba126fe298606e0adc11697831f097acba9c52a0b7ce9983e 8aa01bc376614abbc3209e25785c72f86c9b4e94bb5f471a4a0677fedaec4f61 lib/codeql/swift/generated/Location.qll c5793987e77812059a28254dadee29bfe9b38153c0399fbb1bf6a2f5c237fdab 6e6d8802b021e36bbaad81845657769dd48a798ea33080ada05e9818a20b38f7 lib/codeql/swift/generated/OtherAvailabilitySpec.qll 0e26a203b26ff0581b7396b0c6d1606feec5cc32477f676585cdec4911af91c5 0e26a203b26ff0581b7396b0c6d1606feec5cc32477f676585cdec4911af91c5 -lib/codeql/swift/generated/ParentChild.qll 6e7b64896a2ad25a06130592ba27036e0e2b9bf4268a730d1bce78ebaf32607d dfe0e3c578f726cf2b7d024bf247701f12d6a79fd061a3c805d23fac85218635 +lib/codeql/swift/generated/ParentChild.qll f2c1bcd5495f9b72cf43f7fe9691e888071e128069c1a4cb43feecec55fd0ab6 95c801caf726159580192fb6f93e2218776014fb0def04ec423dff3f245d53c1 lib/codeql/swift/generated/PlatformVersionAvailabilitySpec.qll f82d9ca416fe8bd59b5531b65b1c74c9f317b3297a6101544a11339a1cffce38 7f5c6d3309e66c134107afe55bae76dfc9a72cb7cdd6d4c3706b6b34cee09fa0 lib/codeql/swift/generated/PureSynthConstructors.qll 173c0dd59396a1de26fe870e3bc2766c46de689da2a4d8807cb62023bbce1a98 173c0dd59396a1de26fe870e3bc2766c46de689da2a4d8807cb62023bbce1a98 -lib/codeql/swift/generated/Raw.qll 349eb78e973669d9f30922399571bc31313f781c82c2993cdae4b03493440c1d 1537b15a42b35dd7e22a7e22e70dce38ed93e00e79678bbd78cfd14c1433fcbe +lib/codeql/swift/generated/Raw.qll 72b362fb6c19eb88de89780bfeda5cb2c4ab5f68e24fd5c0fe6220acd49d48b7 2442908ec02efcf633f9bf137b52e024bd6b9001961b27e932d21007accbb1ee lib/codeql/swift/generated/Synth.qll 551fdf7e4b53f9ee1314d1bb42c2638cf82f45bfa1f40a635dfa7b6072e4418c 9ab178464700a19951fc5285acacda4913addee81515d8e072b3d7055935a814 lib/codeql/swift/generated/SynthConstructors.qll 2f801bd8b0db829b0253cd459ed3253c1fdfc55dce68ebc53e7fec138ef0aca4 2f801bd8b0db829b0253cd459ed3253c1fdfc55dce68ebc53e7fec138ef0aca4 lib/codeql/swift/generated/UnknownFile.qll 0fcf9beb8de79440bcdfff4bb6ab3dd139bd273e6c32754e05e6a632651e85f6 0fcf9beb8de79440bcdfff4bb6ab3dd139bd273e6c32754e05e6a632651e85f6 @@ -556,7 +556,7 @@ lib/codeql/swift/generated/pattern/BoolPattern.qll 118300aa665defa688a7c28f82deb lib/codeql/swift/generated/pattern/EnumElementPattern.qll 2d92a861316d46190e11880b0c383651e4ea15ea8fb81f55c08c4ce733bee2c7 c5915d7a3b62f7c009daac2e7d87c7d435a81a128bdfcc1db9ad281600acfb67 lib/codeql/swift/generated/pattern/ExprPattern.qll 169cef487e499a21d0d2cc4eda7268eb29cb6b1081fa6a0bc4e8571677f063f3 b7f3160f0812cf565873b607a247e184f17cc0289758f9a46748e90e783abd4f lib/codeql/swift/generated/pattern/IsPattern.qll c809159dff26b86d44f560742d66e75b3cf143cdfc0f3933b959864412770248 7375cb8140da3c1531b55b084c4b6aa8009495dd40697a13f05b258d3f5677cc -lib/codeql/swift/generated/pattern/NamedPattern.qll 5d25e51eb83e86363b95a6531ffb164e5a6070b4a577f3900140edbef0e83c71 9e88b2b2b90a547b402d4782e8d494bc555d4200763c094dd985fe3b7ebc1ec8 +lib/codeql/swift/generated/pattern/NamedPattern.qll de29f055d43087ada4ffbad33bdf50887a140820a308d3b8ff7f00f0a05134ee 8a9ff5b0b6fc78ab726058f6e4b6e7eef80dd780d76b1b3d5a2bec7dfa320306 lib/codeql/swift/generated/pattern/OptionalSomePattern.qll 5b9c7032584619d4921d1a1324e3ce4bd7207f0d4daa703e1e059f983bf1b132 e6d44514cd123a7ad27f657a2b83d46277a961a849139380ece886430a862920 lib/codeql/swift/generated/pattern/ParenPattern.qll 337cb03dcb7384f7ef13e35d843b3498c0ae391374f5e870d1e52c2d1baacd95 cba288ee99726f5bbf15cf61971e000a835cf6e8b7507dcf6f6c6dea91ec287a lib/codeql/swift/generated/pattern/Pattern.qll 0e96528a8dd87185f4fb23ba33ea418932762127e99739d7e56e5c8988e024d1 ba1e010c9f7f891048fb8c4ff8ea5a6c664c09e43d74b860d559f6459f82554a @@ -565,7 +565,7 @@ lib/codeql/swift/generated/pattern/TypedPattern.qll 6a9fd2815755eddc6918d6be8221 lib/codeql/swift/generated/stmt/BraceStmt.qll 5273745afaaf10dc4b6ee159ca304e1251dc11af3c86af812b28294cbbcf2597 dbd4b003b453742e7197b22633ec8c87418e207f7ca409a04e3c6fb2cf2ea5fd lib/codeql/swift/generated/stmt/BreakStmt.qll 879cf66911cc7f53e7e8f4ae8244681018fb17d6501b269fb7cf9d8481f0b539 c78fc1b0e3e76321fc1653aa8b0aabaaacf082e01a003b78f693b106cc05faa0 lib/codeql/swift/generated/stmt/CaseLabelItem.qll 9536d2909a274c3a969eec25f8e5966adfaa9b0d6451ea6319d9f7bb2fd6fe07 02e25f036db50e9a6e9a7ceab6002dd605b73afb55fa1dee6f22e7af33a40913 -lib/codeql/swift/generated/stmt/CaseStmt.qll c180478c6161439bc76bd39edfab343faba7450900ffedcadd3ccea12dc3a08c b537eb517db76113cfbc91c59e6bdfbf16ff83d639dfe6fd6892171f71a97090 +lib/codeql/swift/generated/stmt/CaseStmt.qll fb92601b5e93ac4b0e99a910baf2586725ef83075d0363c64a4fe1d036effefa c56801706bea64ec76ec942f193c43d330c10612da9414d2d343af74960e1982 lib/codeql/swift/generated/stmt/ConditionElement.qll 29c1f9ab045cceac466836c8c6b9b158395351a76d4c4f8725d98663ea75b9de 09342a6d9632a1af973ef21fd03d30ca85b94ebb7d51991b4b573ce9096f97f4 lib/codeql/swift/generated/stmt/ContinueStmt.qll bf300c9655f750db8e71eb530d8972eca1ac9bf022023c8d99e299de8f5b3a44 746a2432752743e18e2b5fa4b46407e5d4c0e6ee38635c6de0846452cbc5eec5 lib/codeql/swift/generated/stmt/DeferStmt.qll 230f8c8f53c86afd3169b36214c03c54ac3e5240b1c1c1ade4446b45c4c3c32a d0d9e728be7506aa07904c53087eb1273a82762139866767abb0b851f3e559ee @@ -854,8 +854,6 @@ test/extractor-tests/generated/pattern/TuplePattern/MISSING_SOURCE.txt 66846d526 test/extractor-tests/generated/pattern/TypedPattern/MISSING_SOURCE.txt 66846d526b0bc4328735c3c4dd9c390a9325da5b5dfd42ec07622f9c7108a7d7 66846d526b0bc4328735c3c4dd9c390a9325da5b5dfd42ec07622f9c7108a7d7 test/extractor-tests/generated/stmt/BraceStmt/MISSING_SOURCE.txt 66846d526b0bc4328735c3c4dd9c390a9325da5b5dfd42ec07622f9c7108a7d7 66846d526b0bc4328735c3c4dd9c390a9325da5b5dfd42ec07622f9c7108a7d7 test/extractor-tests/generated/stmt/BreakStmt/MISSING_SOURCE.txt 66846d526b0bc4328735c3c4dd9c390a9325da5b5dfd42ec07622f9c7108a7d7 66846d526b0bc4328735c3c4dd9c390a9325da5b5dfd42ec07622f9c7108a7d7 -test/extractor-tests/generated/stmt/CaseLabelItem/MISSING_SOURCE.txt 66846d526b0bc4328735c3c4dd9c390a9325da5b5dfd42ec07622f9c7108a7d7 66846d526b0bc4328735c3c4dd9c390a9325da5b5dfd42ec07622f9c7108a7d7 -test/extractor-tests/generated/stmt/CaseStmt/MISSING_SOURCE.txt 66846d526b0bc4328735c3c4dd9c390a9325da5b5dfd42ec07622f9c7108a7d7 66846d526b0bc4328735c3c4dd9c390a9325da5b5dfd42ec07622f9c7108a7d7 test/extractor-tests/generated/stmt/ConditionElement/MISSING_SOURCE.txt 66846d526b0bc4328735c3c4dd9c390a9325da5b5dfd42ec07622f9c7108a7d7 66846d526b0bc4328735c3c4dd9c390a9325da5b5dfd42ec07622f9c7108a7d7 test/extractor-tests/generated/stmt/ContinueStmt/MISSING_SOURCE.txt 66846d526b0bc4328735c3c4dd9c390a9325da5b5dfd42ec07622f9c7108a7d7 66846d526b0bc4328735c3c4dd9c390a9325da5b5dfd42ec07622f9c7108a7d7 test/extractor-tests/generated/stmt/DeferStmt/MISSING_SOURCE.txt 66846d526b0bc4328735c3c4dd9c390a9325da5b5dfd42ec07622f9c7108a7d7 66846d526b0bc4328735c3c4dd9c390a9325da5b5dfd42ec07622f9c7108a7d7 @@ -870,7 +868,14 @@ test/extractor-tests/generated/stmt/PoundAssertStmt/PoundAssertStmt.ql dc72e3a7f test/extractor-tests/generated/stmt/RepeatWhileStmt/MISSING_SOURCE.txt 66846d526b0bc4328735c3c4dd9c390a9325da5b5dfd42ec07622f9c7108a7d7 66846d526b0bc4328735c3c4dd9c390a9325da5b5dfd42ec07622f9c7108a7d7 test/extractor-tests/generated/stmt/ReturnStmt/MISSING_SOURCE.txt 66846d526b0bc4328735c3c4dd9c390a9325da5b5dfd42ec07622f9c7108a7d7 66846d526b0bc4328735c3c4dd9c390a9325da5b5dfd42ec07622f9c7108a7d7 test/extractor-tests/generated/stmt/StmtCondition/MISSING_SOURCE.txt 66846d526b0bc4328735c3c4dd9c390a9325da5b5dfd42ec07622f9c7108a7d7 66846d526b0bc4328735c3c4dd9c390a9325da5b5dfd42ec07622f9c7108a7d7 -test/extractor-tests/generated/stmt/SwitchStmt/MISSING_SOURCE.txt 66846d526b0bc4328735c3c4dd9c390a9325da5b5dfd42ec07622f9c7108a7d7 66846d526b0bc4328735c3c4dd9c390a9325da5b5dfd42ec07622f9c7108a7d7 +test/extractor-tests/generated/stmt/SwitchStmt/CaseLabelItem.ql 6a95c434a2cc23714e888582db5c72b423ed4fe4f41f39e6382fa72cb54e1b25 1cdbb9652d78f2d46f9238dc47982dd3b3c2e8183f1c560686af0bdf232ff161 +test/extractor-tests/generated/stmt/SwitchStmt/CaseLabelItem_getGuard.ql f561d4d0583c7c978da66a2f45a5a3cdcb6c21d431d69435bb2d223449b68e2c 3663f0cab05b5993c6e22a24756157297a3704acf68670a73547ed66f9d29a49 +test/extractor-tests/generated/stmt/SwitchStmt/CaseStmt.ql 1660daf75c6a1a20bd2dbb334c05395b76e01ac2d21e400df62d64ae77032d04 74bbb0c7abe299484cfcc0e433f1ef09d7c608859e44f18c0bebec64761423d6 +test/extractor-tests/generated/stmt/SwitchStmt/CaseStmt_getLabel.ql d1e93510f4fd55937236714c8fb374daf90b281390a8cd23807f096229e4f8c8 90070b50cf06abcd26286ef40a23e8fc2ff6b82d413fb010a5dc20eaa0a8d116 +test/extractor-tests/generated/stmt/SwitchStmt/CaseStmt_getVariable.ql 3afec99b34d0c29051c0043a2a24b03e5b0edca65b3657a639d2888b518ff3e0 36a2d7a8202a595e6f8c21b70b48042fd7cc5d271139fb24dd999d7e07c61f5d +test/extractor-tests/generated/stmt/SwitchStmt/SwitchStmt.ql 6b16bc2b345520905ba1923e5a554d6599e7f16916fe4e50f128970f89d3e8df 95d60c9e914068cce977ae27048d190ad2ed68eb3c9e7357ab3dfc64a0503612 +test/extractor-tests/generated/stmt/SwitchStmt/SwitchStmt_getCase.ql 6958d28a8256e213108cb356af9467143f2ffcd31c45b08c177fc858194f8f3d cf9dacdcd68269d7218bc8ca9cb0ffe9c3cdcf968833393f00e65ca486a5b5b1 +test/extractor-tests/generated/stmt/SwitchStmt/SwitchStmt_getLabel.ql b96b047146c4f1dd09f819ca5943f13ee0dc5277398eedd89b96dcd177d8d9cf a94cf29c6b7e19dac10443fb29063b4f0ac81b8853ea7c39f3b43265d2180eab test/extractor-tests/generated/stmt/ThrowStmt/MISSING_SOURCE.txt 66846d526b0bc4328735c3c4dd9c390a9325da5b5dfd42ec07622f9c7108a7d7 66846d526b0bc4328735c3c4dd9c390a9325da5b5dfd42ec07622f9c7108a7d7 test/extractor-tests/generated/stmt/WhileStmt/MISSING_SOURCE.txt 66846d526b0bc4328735c3c4dd9c390a9325da5b5dfd42ec07622f9c7108a7d7 66846d526b0bc4328735c3c4dd9c390a9325da5b5dfd42ec07622f9c7108a7d7 test/extractor-tests/generated/stmt/YieldStmt/MISSING_SOURCE.txt 66846d526b0bc4328735c3c4dd9c390a9325da5b5dfd42ec07622f9c7108a7d7 66846d526b0bc4328735c3c4dd9c390a9325da5b5dfd42ec07622f9c7108a7d7 diff --git a/swift/ql/.gitattributes b/swift/ql/.gitattributes index 3d8b66e43480..a1e00251e800 100644 --- a/swift/ql/.gitattributes +++ b/swift/ql/.gitattributes @@ -856,8 +856,6 @@ /test/extractor-tests/generated/pattern/TypedPattern/MISSING_SOURCE.txt linguist-generated /test/extractor-tests/generated/stmt/BraceStmt/MISSING_SOURCE.txt linguist-generated /test/extractor-tests/generated/stmt/BreakStmt/MISSING_SOURCE.txt linguist-generated -/test/extractor-tests/generated/stmt/CaseLabelItem/MISSING_SOURCE.txt linguist-generated -/test/extractor-tests/generated/stmt/CaseStmt/MISSING_SOURCE.txt linguist-generated /test/extractor-tests/generated/stmt/ConditionElement/MISSING_SOURCE.txt linguist-generated /test/extractor-tests/generated/stmt/ContinueStmt/MISSING_SOURCE.txt linguist-generated /test/extractor-tests/generated/stmt/DeferStmt/MISSING_SOURCE.txt linguist-generated @@ -872,7 +870,14 @@ /test/extractor-tests/generated/stmt/RepeatWhileStmt/MISSING_SOURCE.txt linguist-generated /test/extractor-tests/generated/stmt/ReturnStmt/MISSING_SOURCE.txt linguist-generated /test/extractor-tests/generated/stmt/StmtCondition/MISSING_SOURCE.txt linguist-generated -/test/extractor-tests/generated/stmt/SwitchStmt/MISSING_SOURCE.txt linguist-generated +/test/extractor-tests/generated/stmt/SwitchStmt/CaseLabelItem.ql linguist-generated +/test/extractor-tests/generated/stmt/SwitchStmt/CaseLabelItem_getGuard.ql linguist-generated +/test/extractor-tests/generated/stmt/SwitchStmt/CaseStmt.ql linguist-generated +/test/extractor-tests/generated/stmt/SwitchStmt/CaseStmt_getLabel.ql linguist-generated +/test/extractor-tests/generated/stmt/SwitchStmt/CaseStmt_getVariable.ql linguist-generated +/test/extractor-tests/generated/stmt/SwitchStmt/SwitchStmt.ql linguist-generated +/test/extractor-tests/generated/stmt/SwitchStmt/SwitchStmt_getCase.ql linguist-generated +/test/extractor-tests/generated/stmt/SwitchStmt/SwitchStmt_getLabel.ql linguist-generated /test/extractor-tests/generated/stmt/ThrowStmt/MISSING_SOURCE.txt linguist-generated /test/extractor-tests/generated/stmt/WhileStmt/MISSING_SOURCE.txt linguist-generated /test/extractor-tests/generated/stmt/YieldStmt/MISSING_SOURCE.txt linguist-generated diff --git a/swift/ql/lib/codeql/swift/elements/pattern/NamedPattern.qll b/swift/ql/lib/codeql/swift/elements/pattern/NamedPattern.qll index 39b7ade299e9..689ebb8ab295 100644 --- a/swift/ql/lib/codeql/swift/elements/pattern/NamedPattern.qll +++ b/swift/ql/lib/codeql/swift/elements/pattern/NamedPattern.qll @@ -9,19 +9,16 @@ private import codeql.swift.elements.decl.VarDecl */ class NamedPattern extends Generated::NamedPattern { /** - * Holds if this named pattern has a corresponding `VarDecl`. - * This will be the case as long as the variable is subsequently used. + * Holds if this named pattern has a corresponding `VarDecl`, which is currently always true. + * + * DEPRECATED: unless there was a compilation error, this will always hold. */ - predicate hasVarDecl() { exists(this.getVarDecl()) } + deprecated predicate hasVarDecl() { exists(this.getVarDecl()) } /** - * Gets the `VarDecl` bound by this named pattern, if any. - * This will be the case as long as the variable is subsequently used. + * Gets the name of the variable bound by this pattern. */ - VarDecl getVarDecl() { - this.getImmediateEnclosingPattern*() = result.getImmediateParentPattern() and - pragma[only_bind_out](result.getName()) = pragma[only_bind_out](this.getName()) - } + string getName() { result = this.getVarDecl().getName() } override string toString() { result = this.getName() } } diff --git a/swift/ql/lib/codeql/swift/generated/ParentChild.qll b/swift/ql/lib/codeql/swift/generated/ParentChild.qll index 3b4020c6d5c4..26dfa3c94b3b 100644 --- a/swift/ql/lib/codeql/swift/generated/ParentChild.qll +++ b/swift/ql/lib/codeql/swift/generated/ParentChild.qll @@ -3472,21 +3472,25 @@ private module Impl { } private Element getImmediateChildOfCaseStmt(CaseStmt e, int index, string partialPredicateCall) { - exists(int b, int bStmt, int n, int nBody, int nLabel | + exists(int b, int bStmt, int n, int nLabel, int nVariable, int nBody | b = 0 and bStmt = b + 1 + max(int i | i = -1 or exists(getImmediateChildOfStmt(e, i, _)) | i) and n = bStmt and - nBody = n + 1 and - nLabel = nBody + 1 + max(int i | i = -1 or exists(e.getLabel(i)) | i) and + nLabel = n + 1 + max(int i | i = -1 or exists(e.getLabel(i)) | i) and + nVariable = nLabel + 1 + max(int i | i = -1 or exists(e.getVariable(i)) | i) and + nBody = nVariable + 1 and ( none() or result = getImmediateChildOfStmt(e, index - b, partialPredicateCall) or - index = n and result = e.getBody() and partialPredicateCall = "Body()" + result = e.getLabel(index - n) and + partialPredicateCall = "Label(" + (index - n).toString() + ")" + or + result = e.getVariable(index - nLabel) and + partialPredicateCall = "Variable(" + (index - nLabel).toString() + ")" or - result = e.getLabel(index - nBody) and - partialPredicateCall = "Label(" + (index - nBody).toString() + ")" + index = nVariable and result = e.getBody() and partialPredicateCall = "Body()" ) ) } diff --git a/swift/ql/lib/codeql/swift/generated/Raw.qll b/swift/ql/lib/codeql/swift/generated/Raw.qll index a9f9af032af6..dfbe654495c9 100644 --- a/swift/ql/lib/codeql/swift/generated/Raw.qll +++ b/swift/ql/lib/codeql/swift/generated/Raw.qll @@ -2454,9 +2454,9 @@ module Raw { override string toString() { result = "NamedPattern" } /** - * Gets the name of this named pattern. + * Gets the variable declaration of this named pattern. */ - string getName() { named_patterns(this, result) } + VarDecl getVarDecl() { named_patterns(this, result) } } /** @@ -2608,11 +2608,6 @@ module Raw { class CaseStmt extends @case_stmt, Stmt { override string toString() { result = "CaseStmt" } - /** - * Gets the body of this case statement. - */ - Stmt getBody() { case_stmts(this, result) } - /** * Gets the `index`th label of this case statement (0-based). */ @@ -2622,6 +2617,11 @@ module Raw { * Gets the `index`th variable of this case statement (0-based). */ VarDecl getVariable(int index) { case_stmt_variables(this, index, result) } + + /** + * Gets the body of this case statement. + */ + Stmt getBody() { case_stmts(this, result) } } /** diff --git a/swift/ql/lib/codeql/swift/generated/pattern/NamedPattern.qll b/swift/ql/lib/codeql/swift/generated/pattern/NamedPattern.qll index 8e61419fa52a..81500f6afed7 100644 --- a/swift/ql/lib/codeql/swift/generated/pattern/NamedPattern.qll +++ b/swift/ql/lib/codeql/swift/generated/pattern/NamedPattern.qll @@ -2,16 +2,20 @@ private import codeql.swift.generated.Synth private import codeql.swift.generated.Raw import codeql.swift.elements.pattern.Pattern +import codeql.swift.elements.decl.VarDecl module Generated { class NamedPattern extends Synth::TNamedPattern, Pattern { override string getAPrimaryQlClass() { result = "NamedPattern" } /** - * Gets the name of this named pattern. + * Gets the variable declaration of this named pattern. */ - string getName() { - result = Synth::convertNamedPatternToRaw(this).(Raw::NamedPattern).getName() + VarDecl getVarDecl() { + result = + Synth::convertVarDeclFromRaw(Synth::convertNamedPatternToRaw(this) + .(Raw::NamedPattern) + .getVarDecl()) } } } diff --git a/swift/ql/lib/codeql/swift/generated/stmt/CaseStmt.qll b/swift/ql/lib/codeql/swift/generated/stmt/CaseStmt.qll index d0c2db1d7526..dd674278e92f 100644 --- a/swift/ql/lib/codeql/swift/generated/stmt/CaseStmt.qll +++ b/swift/ql/lib/codeql/swift/generated/stmt/CaseStmt.qll @@ -9,14 +9,6 @@ module Generated { class CaseStmt extends Synth::TCaseStmt, Stmt { override string getAPrimaryQlClass() { result = "CaseStmt" } - /** - * Gets the body of this case statement. - */ - Stmt getBody() { - result = - Synth::convertStmtFromRaw(Synth::convertCaseStmtToRaw(this).(Raw::CaseStmt).getBody()) - } - /** * Gets the `index`th label of this case statement (0-based). */ @@ -56,5 +48,13 @@ module Generated { * Gets the number of variables of this case statement. */ final int getNumberOfVariables() { result = count(int i | exists(this.getVariable(i))) } + + /** + * Gets the body of this case statement. + */ + Stmt getBody() { + result = + Synth::convertStmtFromRaw(Synth::convertCaseStmtToRaw(this).(Raw::CaseStmt).getBody()) + } } } diff --git a/swift/ql/lib/swift.dbscheme b/swift/ql/lib/swift.dbscheme index c0db61944f46..7c17e1f4b2d3 100644 --- a/swift/ql/lib/swift.dbscheme +++ b/swift/ql/lib/swift.dbscheme @@ -1671,7 +1671,7 @@ is_pattern_sub_patterns( //dir=pattern named_patterns( //dir=pattern unique int id: @named_pattern, - string name: string ref + int var_decl: @var_decl_or_none ref ); optional_some_patterns( //dir=pattern diff --git a/swift/ql/test/extractor-tests/generated/decl/ConcreteVarDecl/ConcreteVarDecl.expected b/swift/ql/test/extractor-tests/generated/decl/ConcreteVarDecl/ConcreteVarDecl.expected index 989ec1711dfb..803a4eadf4ee 100644 --- a/swift/ql/test/extractor-tests/generated/decl/ConcreteVarDecl/ConcreteVarDecl.expected +++ b/swift/ql/test/extractor-tests/generated/decl/ConcreteVarDecl/ConcreteVarDecl.expected @@ -1,3 +1,4 @@ +| var_decls.swift:2:7:2:7 | i | getModule: | file://:0:0:0:0 | var_decls | getNumberOfMembers: | 0 | getInterfaceType: | Int | getNumberOfAccessors: | 0 | getName: | i | getType: | Int | hasAttachedPropertyWrapperType: | no | hasParentPattern: | yes | hasParentInitializer: | no | hasPropertyWrapperBackingVarBinding: | no | hasPropertyWrapperBackingVar: | no | hasPropertyWrapperProjectionVarBinding: | no | hasPropertyWrapperProjectionVar: | no | getIntroducerInt: | 0 | | var_decls.swift:2:12:2:12 | $i$generator | getModule: | file://:0:0:0:0 | var_decls | getNumberOfMembers: | 0 | getInterfaceType: | IndexingIterator> | getNumberOfAccessors: | 0 | getName: | $i$generator | getType: | IndexingIterator> | hasAttachedPropertyWrapperType: | no | hasParentPattern: | yes | hasParentInitializer: | yes | hasPropertyWrapperBackingVarBinding: | no | hasPropertyWrapperBackingVar: | no | hasPropertyWrapperProjectionVarBinding: | no | hasPropertyWrapperProjectionVar: | no | getIntroducerInt: | 1 | | var_decls.swift:4:7:4:7 | i | getModule: | file://:0:0:0:0 | var_decls | getNumberOfMembers: | 0 | getInterfaceType: | Int | getNumberOfAccessors: | 0 | getName: | i | getType: | Int | hasAttachedPropertyWrapperType: | no | hasParentPattern: | yes | hasParentInitializer: | yes | hasPropertyWrapperBackingVarBinding: | no | hasPropertyWrapperBackingVar: | no | hasPropertyWrapperProjectionVarBinding: | no | hasPropertyWrapperProjectionVar: | no | getIntroducerInt: | 1 | | var_decls.swift:7:5:7:5 | numbers | getModule: | file://:0:0:0:0 | var_decls | getNumberOfMembers: | 0 | getInterfaceType: | [Int] | getNumberOfAccessors: | 0 | getName: | numbers | getType: | [Int] | hasAttachedPropertyWrapperType: | no | hasParentPattern: | yes | hasParentInitializer: | yes | hasPropertyWrapperBackingVarBinding: | no | hasPropertyWrapperBackingVar: | no | hasPropertyWrapperProjectionVarBinding: | no | hasPropertyWrapperProjectionVar: | no | getIntroducerInt: | 1 | @@ -21,3 +22,8 @@ | var_decls.swift:57:36:57:36 | $w4 | getModule: | file://:0:0:0:0 | var_decls | getNumberOfMembers: | 0 | getInterfaceType: | Bool | getNumberOfAccessors: | 2 | getName: | $w4 | getType: | Bool | hasAttachedPropertyWrapperType: | no | hasParentPattern: | yes | hasParentInitializer: | no | hasPropertyWrapperBackingVarBinding: | no | hasPropertyWrapperBackingVar: | no | hasPropertyWrapperProjectionVarBinding: | no | hasPropertyWrapperProjectionVar: | no | getIntroducerInt: | 1 | | var_decls.swift:57:36:57:36 | _w4 | getModule: | file://:0:0:0:0 | var_decls | getNumberOfMembers: | 0 | getInterfaceType: | WrapperWithProjectedAndInit | getNumberOfAccessors: | 0 | getName: | _w4 | getType: | WrapperWithProjectedAndInit | hasAttachedPropertyWrapperType: | no | hasParentPattern: | yes | hasParentInitializer: | yes | hasPropertyWrapperBackingVarBinding: | no | hasPropertyWrapperBackingVar: | no | hasPropertyWrapperProjectionVarBinding: | no | hasPropertyWrapperProjectionVar: | no | getIntroducerInt: | 1 | | var_decls.swift:57:36:57:36 | w4 | getModule: | file://:0:0:0:0 | var_decls | getNumberOfMembers: | 0 | getInterfaceType: | Int | getNumberOfAccessors: | 2 | getName: | w4 | getType: | Int | hasAttachedPropertyWrapperType: | yes | hasParentPattern: | yes | hasParentInitializer: | yes | hasPropertyWrapperBackingVarBinding: | yes | hasPropertyWrapperBackingVar: | yes | hasPropertyWrapperProjectionVarBinding: | yes | hasPropertyWrapperProjectionVar: | yes | getIntroducerInt: | 1 | +| var_decls.swift:65:19:65:19 | case_variable | getModule: | file://:0:0:0:0 | var_decls | getNumberOfMembers: | 0 | getInterfaceType: | Int | getNumberOfAccessors: | 0 | getName: | case_variable | getType: | Int | hasAttachedPropertyWrapperType: | no | hasParentPattern: | yes | hasParentInitializer: | no | hasPropertyWrapperBackingVarBinding: | no | hasPropertyWrapperBackingVar: | no | hasPropertyWrapperProjectionVarBinding: | no | hasPropertyWrapperProjectionVar: | no | getIntroducerInt: | 0 | +| var_decls.swift:65:19:65:19 | case_variable | getModule: | file://:0:0:0:0 | var_decls | getNumberOfMembers: | 0 | getInterfaceType: | Int | getNumberOfAccessors: | 0 | getName: | case_variable | getType: | Int | hasAttachedPropertyWrapperType: | no | hasParentPattern: | yes | hasParentInitializer: | no | hasPropertyWrapperBackingVarBinding: | no | hasPropertyWrapperBackingVar: | no | hasPropertyWrapperProjectionVarBinding: | no | hasPropertyWrapperProjectionVar: | no | getIntroducerInt: | 0 | +| var_decls.swift:65:34:65:34 | $match | getModule: | file://:0:0:0:0 | var_decls | getNumberOfMembers: | 0 | getInterfaceType: | Int | getNumberOfAccessors: | 0 | getName: | $match | getType: | Int | hasAttachedPropertyWrapperType: | no | hasParentPattern: | no | hasParentInitializer: | no | hasPropertyWrapperBackingVarBinding: | no | hasPropertyWrapperBackingVar: | no | hasPropertyWrapperProjectionVarBinding: | no | hasPropertyWrapperProjectionVar: | no | getIntroducerInt: | 0 | +| var_decls.swift:67:15:67:15 | $match | getModule: | file://:0:0:0:0 | var_decls | getNumberOfMembers: | 0 | getInterfaceType: | Int | getNumberOfAccessors: | 0 | getName: | $match | getType: | Int | hasAttachedPropertyWrapperType: | no | hasParentPattern: | no | hasParentInitializer: | no | hasPropertyWrapperBackingVarBinding: | no | hasPropertyWrapperBackingVar: | no | hasPropertyWrapperProjectionVarBinding: | no | hasPropertyWrapperProjectionVar: | no | getIntroducerInt: | 0 | +| var_decls.swift:67:22:67:22 | unused_case_variable | getModule: | file://:0:0:0:0 | var_decls | getNumberOfMembers: | 0 | getInterfaceType: | Int | getNumberOfAccessors: | 0 | getName: | unused_case_variable | getType: | Int | hasAttachedPropertyWrapperType: | no | hasParentPattern: | yes | hasParentInitializer: | no | hasPropertyWrapperBackingVarBinding: | no | hasPropertyWrapperBackingVar: | no | hasPropertyWrapperProjectionVarBinding: | no | hasPropertyWrapperProjectionVar: | no | getIntroducerInt: | 0 | diff --git a/swift/ql/test/extractor-tests/generated/decl/ConcreteVarDecl/ConcreteVarDecl_getParentPattern.expected b/swift/ql/test/extractor-tests/generated/decl/ConcreteVarDecl/ConcreteVarDecl_getParentPattern.expected index 569528b31179..ba75564602f1 100644 --- a/swift/ql/test/extractor-tests/generated/decl/ConcreteVarDecl/ConcreteVarDecl_getParentPattern.expected +++ b/swift/ql/test/extractor-tests/generated/decl/ConcreteVarDecl/ConcreteVarDecl_getParentPattern.expected @@ -1,3 +1,4 @@ +| var_decls.swift:2:7:2:7 | i | var_decls.swift:2:7:2:7 | i | | var_decls.swift:2:12:2:12 | $i$generator | var_decls.swift:2:12:2:12 | $i$generator | | var_decls.swift:4:7:4:7 | i | var_decls.swift:4:7:4:7 | i | | var_decls.swift:7:5:7:5 | numbers | var_decls.swift:7:5:7:5 | numbers | @@ -21,3 +22,6 @@ | var_decls.swift:57:36:57:36 | $w4 | var_decls.swift:57:36:57:36 | ... as ... | | var_decls.swift:57:36:57:36 | _w4 | var_decls.swift:57:36:57:36 | ... as ... | | var_decls.swift:57:36:57:36 | w4 | var_decls.swift:57:36:57:36 | w4 | +| var_decls.swift:65:19:65:19 | case_variable | var_decls.swift:65:8:65:35 | .value(...) | +| var_decls.swift:65:19:65:19 | case_variable | var_decls.swift:65:8:65:35 | .value(...) | +| var_decls.swift:67:22:67:22 | unused_case_variable | var_decls.swift:67:8:67:42 | .value(...) | diff --git a/swift/ql/test/extractor-tests/generated/decl/ConcreteVarDecl/var_decls.swift b/swift/ql/test/extractor-tests/generated/decl/ConcreteVarDecl/var_decls.swift index 0bb5dc93edda..bec1244158d2 100644 --- a/swift/ql/test/extractor-tests/generated/decl/ConcreteVarDecl/var_decls.swift +++ b/swift/ql/test/extractor-tests/generated/decl/ConcreteVarDecl/var_decls.swift @@ -56,3 +56,16 @@ func f3() { @WrapperWithProjected var w3 = 3 @WrapperWithProjectedAndInit var w4 = 4 } + +enum E { + case value(Int, Int) +} + +switch E.value(42, 0) { + case .value(let case_variable, 0): + _ = case_variable + case .value(0, let unused_case_variable): + break + default: + break +} diff --git a/swift/ql/test/extractor-tests/generated/stmt/CaseLabelItem/MISSING_SOURCE.txt b/swift/ql/test/extractor-tests/generated/stmt/CaseLabelItem/MISSING_SOURCE.txt deleted file mode 100644 index 25daf3d23a21..000000000000 --- a/swift/ql/test/extractor-tests/generated/stmt/CaseLabelItem/MISSING_SOURCE.txt +++ /dev/null @@ -1,4 +0,0 @@ -// generated by codegen/codegen.py - -After a source file is added in this directory and codegen/codegen.py is run again, test queries -will appear and this file will be deleted diff --git a/swift/ql/test/extractor-tests/generated/stmt/CaseStmt/MISSING_SOURCE.txt b/swift/ql/test/extractor-tests/generated/stmt/CaseStmt/MISSING_SOURCE.txt deleted file mode 100644 index 25daf3d23a21..000000000000 --- a/swift/ql/test/extractor-tests/generated/stmt/CaseStmt/MISSING_SOURCE.txt +++ /dev/null @@ -1,4 +0,0 @@ -// generated by codegen/codegen.py - -After a source file is added in this directory and codegen/codegen.py is run again, test queries -will appear and this file will be deleted diff --git a/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/CaseLabelItem.expected b/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/CaseLabelItem.expected new file mode 100644 index 000000000000..0254cddd8e09 --- /dev/null +++ b/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/CaseLabelItem.expected @@ -0,0 +1,13 @@ +| switch.swift:3:9:3:9 | =~ ... | getPattern: | switch.swift:3:9:3:9 | =~ ... | hasGuard: | no | +| switch.swift:6:9:6:9 | =~ ... | getPattern: | switch.swift:6:9:6:9 | =~ ... | hasGuard: | no | +| switch.swift:6:12:6:12 | =~ ... | getPattern: | switch.swift:6:12:6:12 | =~ ... | hasGuard: | no | +| switch.swift:8:9:8:26 | x where ... | getPattern: | switch.swift:8:13:8:13 | x | hasGuard: | yes | +| switch.swift:10:4:10:4 | _ | getPattern: | switch.swift:10:4:10:4 | _ | hasGuard: | no | +| switch.swift:22:8:22:9 | .one | getPattern: | switch.swift:22:8:22:9 | .one | hasGuard: | no | +| switch.swift:24:8:24:40 | .two(...) where ... | getPattern: | switch.swift:24:8:24:25 | .two(...) | hasGuard: | yes | +| switch.swift:26:8:26:25 | .two(...) | getPattern: | switch.swift:26:8:26:25 | .two(...) | hasGuard: | no | +| switch.swift:28:8:28:23 | .three(...) | getPattern: | switch.swift:28:8:28:23 | .three(...) | hasGuard: | no | +| switch.swift:33:8:33:21 | .two(...) | getPattern: | switch.swift:33:8:33:21 | .two(...) | hasGuard: | no | +| switch.swift:35:13:35:13 | =~ ... | getPattern: | switch.swift:35:13:35:13 | =~ ... | hasGuard: | no | +| switch.swift:37:8:37:8 | _ | getPattern: | switch.swift:37:8:37:8 | _ | hasGuard: | no | +| switch.swift:40:3:40:3 | _ | getPattern: | switch.swift:40:3:40:3 | _ | hasGuard: | no | diff --git a/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/CaseLabelItem.ql b/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/CaseLabelItem.ql new file mode 100644 index 000000000000..d6b42f09b8ac --- /dev/null +++ b/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/CaseLabelItem.ql @@ -0,0 +1,11 @@ +// generated by codegen/codegen.py +import codeql.swift.elements +import TestUtils + +from CaseLabelItem x, Pattern getPattern, string hasGuard +where + toBeTested(x) and + not x.isUnknown() and + getPattern = x.getPattern() and + if x.hasGuard() then hasGuard = "yes" else hasGuard = "no" +select x, "getPattern:", getPattern, "hasGuard:", hasGuard diff --git a/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/CaseLabelItem_getGuard.expected b/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/CaseLabelItem_getGuard.expected new file mode 100644 index 000000000000..347668754636 --- /dev/null +++ b/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/CaseLabelItem_getGuard.expected @@ -0,0 +1,2 @@ +| switch.swift:8:9:8:26 | x where ... | switch.swift:8:21:8:26 | ... .>=(_:_:) ... | +| switch.swift:24:8:24:40 | .two(...) where ... | switch.swift:24:33:24:40 | ... .==(_:_:) ... | diff --git a/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/CaseLabelItem_getGuard.ql b/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/CaseLabelItem_getGuard.ql new file mode 100644 index 000000000000..30a264b73b9b --- /dev/null +++ b/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/CaseLabelItem_getGuard.ql @@ -0,0 +1,7 @@ +// generated by codegen/codegen.py +import codeql.swift.elements +import TestUtils + +from CaseLabelItem x +where toBeTested(x) and not x.isUnknown() +select x, x.getGuard() diff --git a/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/CaseStmt.expected b/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/CaseStmt.expected new file mode 100644 index 000000000000..ed701018d38c --- /dev/null +++ b/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/CaseStmt.expected @@ -0,0 +1,12 @@ +| switch.swift:3:4:5:7 | case ... | getNumberOfLabels: | 1 | getNumberOfVariables: | 0 | getBody: | switch.swift:4:7:5:7 | { ... } | +| switch.swift:6:4:7:20 | case ... | getNumberOfLabels: | 2 | getNumberOfVariables: | 0 | getBody: | switch.swift:7:7:7:20 | { ... } | +| switch.swift:8:4:9:18 | case ... | getNumberOfLabels: | 1 | getNumberOfVariables: | 1 | getBody: | switch.swift:9:7:9:18 | { ... } | +| switch.swift:10:4:11:22 | case ... | getNumberOfLabels: | 1 | getNumberOfVariables: | 0 | getBody: | switch.swift:11:7:11:22 | { ... } | +| switch.swift:22:3:23:5 | case ... | getNumberOfLabels: | 1 | getNumberOfVariables: | 0 | getBody: | switch.swift:23:5:23:5 | { ... } | +| switch.swift:24:3:25:5 | case ... | getNumberOfLabels: | 1 | getNumberOfVariables: | 2 | getBody: | switch.swift:25:5:25:5 | { ... } | +| switch.swift:26:3:27:5 | case ... | getNumberOfLabels: | 1 | getNumberOfVariables: | 2 | getBody: | switch.swift:27:5:27:5 | { ... } | +| switch.swift:28:3:29:5 | case ... | getNumberOfLabels: | 1 | getNumberOfVariables: | 1 | getBody: | switch.swift:29:5:29:5 | { ... } | +| switch.swift:33:3:39:5 | case ... | getNumberOfLabels: | 1 | getNumberOfVariables: | 1 | getBody: | switch.swift:34:5:39:5 | { ... } | +| switch.swift:35:8:36:16 | case ... | getNumberOfLabels: | 1 | getNumberOfVariables: | 0 | getBody: | switch.swift:36:10:36:16 | { ... } | +| switch.swift:37:8:38:16 | case ... | getNumberOfLabels: | 1 | getNumberOfVariables: | 0 | getBody: | switch.swift:38:10:38:16 | { ... } | +| switch.swift:40:3:41:5 | case ... | getNumberOfLabels: | 1 | getNumberOfVariables: | 0 | getBody: | switch.swift:41:5:41:5 | { ... } | diff --git a/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/CaseStmt.ql b/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/CaseStmt.ql new file mode 100644 index 000000000000..4e25a4152dd7 --- /dev/null +++ b/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/CaseStmt.ql @@ -0,0 +1,13 @@ +// generated by codegen/codegen.py +import codeql.swift.elements +import TestUtils + +from CaseStmt x, int getNumberOfLabels, int getNumberOfVariables, Stmt getBody +where + toBeTested(x) and + not x.isUnknown() and + getNumberOfLabels = x.getNumberOfLabels() and + getNumberOfVariables = x.getNumberOfVariables() and + getBody = x.getBody() +select x, "getNumberOfLabels:", getNumberOfLabels, "getNumberOfVariables:", getNumberOfVariables, + "getBody:", getBody diff --git a/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/CaseStmt_getLabel.expected b/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/CaseStmt_getLabel.expected new file mode 100644 index 000000000000..240872c9ece0 --- /dev/null +++ b/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/CaseStmt_getLabel.expected @@ -0,0 +1,13 @@ +| switch.swift:3:4:5:7 | case ... | 0 | switch.swift:3:9:3:9 | =~ ... | +| switch.swift:6:4:7:20 | case ... | 0 | switch.swift:6:9:6:9 | =~ ... | +| switch.swift:6:4:7:20 | case ... | 1 | switch.swift:6:12:6:12 | =~ ... | +| switch.swift:8:4:9:18 | case ... | 0 | switch.swift:8:9:8:26 | x where ... | +| switch.swift:10:4:11:22 | case ... | 0 | switch.swift:10:4:10:4 | _ | +| switch.swift:22:3:23:5 | case ... | 0 | switch.swift:22:8:22:9 | .one | +| switch.swift:24:3:25:5 | case ... | 0 | switch.swift:24:8:24:40 | .two(...) where ... | +| switch.swift:26:3:27:5 | case ... | 0 | switch.swift:26:8:26:25 | .two(...) | +| switch.swift:28:3:29:5 | case ... | 0 | switch.swift:28:8:28:23 | .three(...) | +| switch.swift:33:3:39:5 | case ... | 0 | switch.swift:33:8:33:21 | .two(...) | +| switch.swift:35:8:36:16 | case ... | 0 | switch.swift:35:13:35:13 | =~ ... | +| switch.swift:37:8:38:16 | case ... | 0 | switch.swift:37:8:37:8 | _ | +| switch.swift:40:3:41:5 | case ... | 0 | switch.swift:40:3:40:3 | _ | diff --git a/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/CaseStmt_getLabel.ql b/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/CaseStmt_getLabel.ql new file mode 100644 index 000000000000..fe65417e85c2 --- /dev/null +++ b/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/CaseStmt_getLabel.ql @@ -0,0 +1,7 @@ +// generated by codegen/codegen.py +import codeql.swift.elements +import TestUtils + +from CaseStmt x, int index +where toBeTested(x) and not x.isUnknown() +select x, index, x.getLabel(index) diff --git a/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/CaseStmt_getVariable.expected b/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/CaseStmt_getVariable.expected new file mode 100644 index 000000000000..6e1b31a48091 --- /dev/null +++ b/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/CaseStmt_getVariable.expected @@ -0,0 +1,7 @@ +| switch.swift:8:4:9:18 | case ... | 0 | switch.swift:8:13:8:13 | x | +| switch.swift:24:3:25:5 | case ... | 0 | switch.swift:24:17:24:17 | a | +| switch.swift:24:3:25:5 | case ... | 1 | switch.swift:24:24:24:24 | b | +| switch.swift:26:3:27:5 | case ... | 0 | switch.swift:26:17:26:17 | c | +| switch.swift:26:3:27:5 | case ... | 1 | switch.swift:26:24:26:24 | d | +| switch.swift:28:3:29:5 | case ... | 0 | switch.swift:28:22:28:22 | e | +| switch.swift:33:3:39:5 | case ... | 0 | switch.swift:33:17:33:17 | a | diff --git a/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/CaseStmt_getVariable.ql b/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/CaseStmt_getVariable.ql new file mode 100644 index 000000000000..21b050eea59b --- /dev/null +++ b/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/CaseStmt_getVariable.ql @@ -0,0 +1,7 @@ +// generated by codegen/codegen.py +import codeql.swift.elements +import TestUtils + +from CaseStmt x, int index +where toBeTested(x) and not x.isUnknown() +select x, index, x.getVariable(index) diff --git a/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/MISSING_SOURCE.txt b/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/MISSING_SOURCE.txt deleted file mode 100644 index 25daf3d23a21..000000000000 --- a/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/MISSING_SOURCE.txt +++ /dev/null @@ -1,4 +0,0 @@ -// generated by codegen/codegen.py - -After a source file is added in this directory and codegen/codegen.py is run again, test queries -will appear and this file will be deleted diff --git a/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/SwitchStmt.expected b/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/SwitchStmt.expected new file mode 100644 index 000000000000..e7258f337dac --- /dev/null +++ b/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/SwitchStmt.expected @@ -0,0 +1,4 @@ +| switch.swift:2:1:12:1 | switch index { ... } | hasLabel: | no | getExpr: | switch.swift:2:8:2:8 | index | getNumberOfCases: | 4 | +| switch.swift:21:1:30:1 | switch x { ... } | hasLabel: | no | getExpr: | switch.swift:21:8:21:8 | x | getNumberOfCases: | 4 | +| switch.swift:32:1:42:1 | switch x { ... } | hasLabel: | yes | getExpr: | switch.swift:32:15:32:15 | x | getNumberOfCases: | 2 | +| switch.swift:34:5:39:5 | switch a { ... } | hasLabel: | yes | getExpr: | switch.swift:34:19:34:19 | a | getNumberOfCases: | 2 | diff --git a/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/SwitchStmt.ql b/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/SwitchStmt.ql new file mode 100644 index 000000000000..7e2fc2ae7340 --- /dev/null +++ b/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/SwitchStmt.ql @@ -0,0 +1,12 @@ +// generated by codegen/codegen.py +import codeql.swift.elements +import TestUtils + +from SwitchStmt x, string hasLabel, Expr getExpr, int getNumberOfCases +where + toBeTested(x) and + not x.isUnknown() and + (if x.hasLabel() then hasLabel = "yes" else hasLabel = "no") and + getExpr = x.getExpr() and + getNumberOfCases = x.getNumberOfCases() +select x, "hasLabel:", hasLabel, "getExpr:", getExpr, "getNumberOfCases:", getNumberOfCases diff --git a/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/SwitchStmt_getCase.expected b/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/SwitchStmt_getCase.expected new file mode 100644 index 000000000000..93c4db76adc1 --- /dev/null +++ b/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/SwitchStmt_getCase.expected @@ -0,0 +1,12 @@ +| switch.swift:2:1:12:1 | switch index { ... } | 0 | switch.swift:3:4:5:7 | case ... | +| switch.swift:2:1:12:1 | switch index { ... } | 1 | switch.swift:6:4:7:20 | case ... | +| switch.swift:2:1:12:1 | switch index { ... } | 2 | switch.swift:8:4:9:18 | case ... | +| switch.swift:2:1:12:1 | switch index { ... } | 3 | switch.swift:10:4:11:22 | case ... | +| switch.swift:21:1:30:1 | switch x { ... } | 0 | switch.swift:22:3:23:5 | case ... | +| switch.swift:21:1:30:1 | switch x { ... } | 1 | switch.swift:24:3:25:5 | case ... | +| switch.swift:21:1:30:1 | switch x { ... } | 2 | switch.swift:26:3:27:5 | case ... | +| switch.swift:21:1:30:1 | switch x { ... } | 3 | switch.swift:28:3:29:5 | case ... | +| switch.swift:32:1:42:1 | switch x { ... } | 0 | switch.swift:33:3:39:5 | case ... | +| switch.swift:32:1:42:1 | switch x { ... } | 1 | switch.swift:40:3:41:5 | case ... | +| switch.swift:34:5:39:5 | switch a { ... } | 0 | switch.swift:35:8:36:16 | case ... | +| switch.swift:34:5:39:5 | switch a { ... } | 1 | switch.swift:37:8:38:16 | case ... | diff --git a/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/SwitchStmt_getCase.ql b/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/SwitchStmt_getCase.ql new file mode 100644 index 000000000000..791580913d1c --- /dev/null +++ b/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/SwitchStmt_getCase.ql @@ -0,0 +1,7 @@ +// generated by codegen/codegen.py +import codeql.swift.elements +import TestUtils + +from SwitchStmt x, int index +where toBeTested(x) and not x.isUnknown() +select x, index, x.getCase(index) diff --git a/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/SwitchStmt_getLabel.expected b/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/SwitchStmt_getLabel.expected new file mode 100644 index 000000000000..99df95b02495 --- /dev/null +++ b/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/SwitchStmt_getLabel.expected @@ -0,0 +1,2 @@ +| switch.swift:32:1:42:1 | switch x { ... } | outer | +| switch.swift:34:5:39:5 | switch a { ... } | inner | diff --git a/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/SwitchStmt_getLabel.ql b/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/SwitchStmt_getLabel.ql new file mode 100644 index 000000000000..8a8a7e1ccd35 --- /dev/null +++ b/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/SwitchStmt_getLabel.ql @@ -0,0 +1,7 @@ +// generated by codegen/codegen.py +import codeql.swift.elements +import TestUtils + +from SwitchStmt x +where toBeTested(x) and not x.isUnknown() +select x, x.getLabel() diff --git a/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/switch.swift b/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/switch.swift new file mode 100644 index 000000000000..d74e83d9d171 --- /dev/null +++ b/swift/ql/test/extractor-tests/generated/stmt/SwitchStmt/switch.swift @@ -0,0 +1,42 @@ +let index = 42 +switch index { + case 1: + print("1") + fallthrough + case 5, 10: + print("5, 10") + case let x where x >= 42: + print("big") + default: + print("default") +} + +enum X { + case one + case two(_: Int, _: String) + case three(s: String) +} + +let x = X.two(42, "foo") +switch x { + case .one: + break + case .two(let a, let b) where a == b.count: + break + case .two(let c, let d): + break + case .three(s: let e): + break +} + +outer: switch x { + case .two(let a, _): + inner: switch a { + case 0: + break outer + default: + break inner + } + default: + break +} diff --git a/swift/ql/test/extractor-tests/updates/PrintAst.expected b/swift/ql/test/extractor-tests/updates/PrintAst.expected index 3be7d651de58..664b84da07bd 100644 --- a/swift/ql/test/extractor-tests/updates/PrintAst.expected +++ b/swift/ql/test/extractor-tests/updates/PrintAst.expected @@ -92,26 +92,26 @@ v5.8.swift: # 19| getElement(0): [SwitchStmt] switch arr { ... } # 19| getExpr(): [DeclRefExpr] arr # 20| getCase(0): [CaseStmt] case ... -# 21| getBody(): [BraceStmt] { ... } -# 21| getElement(0): [IntegerLiteralExpr] 0 # 20| getLabel(0): [CaseLabelItem] ... is ... # 20| getPattern(): [IsPattern] ... is ... # 20| getCastTypeRepr(): [TypeRepr] [Int] # 20| getSubPattern(): [NamedPattern] ints # 20| getPattern().getFullyUnresolved(): [BindingPattern] let ... +# 20| getVariable(0): [ConcreteVarDecl] ints +# 20| Type = [Int] +# 21| getBody(): [BraceStmt] { ... } +# 21| getElement(0): [IntegerLiteralExpr] 0 # 22| getCase(1): [CaseStmt] case ... -# 23| getBody(): [BraceStmt] { ... } -# 23| getElement(0): [IntegerLiteralExpr] 1 # 22| getLabel(0): [CaseLabelItem] ... is ... # 22| getPattern(): [IsPattern] ... is ... # 22| getCastTypeRepr(): [TypeRepr] [Bool] +# 23| getBody(): [BraceStmt] { ... } +# 23| getElement(0): [IntegerLiteralExpr] 1 # 24| getCase(2): [CaseStmt] case ... -# 25| getBody(): [BraceStmt] { ... } -# 25| getElement(0): [IntegerLiteralExpr] 2 # 24| getLabel(0): [CaseLabelItem] _ # 24| getPattern(): [AnyPattern] _ -# 20| [ConcreteVarDecl] ints -# 20| Type = [Int] +# 25| getBody(): [BraceStmt] { ... } +# 25| getElement(0): [IntegerLiteralExpr] 2 # 29| [StructDecl] Button # 30| getMember(0): [PatternBindingDecl] var ... = ... #-----| getInit(0): [NilLiteralExpr] nil diff --git a/swift/ql/test/library-tests/ast/PrintAst.expected b/swift/ql/test/library-tests/ast/PrintAst.expected index e7b2a6894033..c9287292b362 100644 --- a/swift/ql/test/library-tests/ast/PrintAst.expected +++ b/swift/ql/test/library-tests/ast/PrintAst.expected @@ -159,9 +159,6 @@ cfg.swift: # 31| getArgument(2): [Argument] terminator: default terminator # 31| getExpr(): [DefaultArgumentExpr] default terminator # 33| getCatch(0): [CaseStmt] case ... -# 33| getBody(): [BraceStmt] { ... } -# 34| getElement(0): [ReturnStmt] return ... -# 34| getResult(): [IntegerLiteralExpr] 0 # 33| getLabel(0): [CaseLabelItem] ... is ... # 33| getPattern(): [IsPattern] ... is ... # 33| getSubPattern(): [EnumElementPattern] .error1 @@ -172,17 +169,25 @@ cfg.swift: # 33| getFunction(): [DeclRefExpr] isZero(x:) # 33| getArgument(0): [Argument] x: x # 33| getExpr(): [DeclRefExpr] x +# 33| getBody(): [BraceStmt] { ... } +# 34| getElement(0): [ReturnStmt] return ... +# 34| getResult(): [IntegerLiteralExpr] 0 # 35| getCatch(1): [CaseStmt] case ... -# 35| getBody(): [BraceStmt] { ... } -# 36| getElement(0): [ReturnStmt] return ... -# 36| getResult(): [DeclRefExpr] withParam # 35| getLabel(0): [CaseLabelItem] ... is ... # 35| getPattern(): [IsPattern] ... is ... # 35| getSubPattern(): [EnumElementPattern] .error3(...) # 35| getSubPattern(): [TuplePattern] (...) # 35| getElement(0): [NamedPattern] withParam # 35| getElement(0).getFullyUnresolved(): [BindingPattern] let ... +# 35| getVariable(0): [ConcreteVarDecl] withParam +# 35| Type = Int +# 35| getBody(): [BraceStmt] { ... } +# 36| getElement(0): [ReturnStmt] return ... +# 36| getResult(): [DeclRefExpr] withParam # 37| getCatch(2): [CaseStmt] case ... +# 37| getLabel(0): [CaseLabelItem] ... is ... +# 37| getPattern(): [IsPattern] ... is ... +# 37| getCastTypeRepr(): [TypeRepr] MyError # 37| getBody(): [BraceStmt] { ... } # 38| getElement(0): [CallExpr] call to print(_:separator:terminator:) # 38| getFunction(): [DeclRefExpr] print(_:separator:terminator:) @@ -195,10 +200,12 @@ cfg.swift: # 38| getExpr(): [DefaultArgumentExpr] default separator # 38| getArgument(2): [Argument] terminator: default terminator # 38| getExpr(): [DefaultArgumentExpr] default terminator -# 37| getLabel(0): [CaseLabelItem] ... is ... -# 37| getPattern(): [IsPattern] ... is ... -# 37| getCastTypeRepr(): [TypeRepr] MyError # 39| getCatch(3): [CaseStmt] case ... +# 39| getLabel(0): [CaseLabelItem] error +# 39| getPattern(): [NamedPattern] error +# 39| getPattern().getFullyUnresolved(): [BindingPattern] let ... +# 39| getVariable(0): [ConcreteVarDecl] error +# 39| Type = Error # 39| getBody(): [BraceStmt] { ... } # 40| getElement(0): [CallExpr] call to print(_:separator:terminator:) # 40| getFunction(): [DeclRefExpr] print(_:separator:terminator:) @@ -237,9 +244,6 @@ cfg.swift: # 40| getExpr(): [DefaultArgumentExpr] default separator # 40| getArgument(2): [Argument] terminator: default terminator # 40| getExpr(): [DefaultArgumentExpr] default terminator -# 39| getLabel(0): [CaseLabelItem] error -# 39| getPattern(): [NamedPattern] error -# 39| getPattern().getFullyUnresolved(): [BindingPattern] let ... # 42| getElement(1): [ReturnStmt] return ... # 42| getResult(): [IntegerLiteralExpr] 0 # 35| [ConcreteVarDecl] withParam @@ -726,11 +730,6 @@ cfg.swift: # 140| getElement(1): [SwitchStmt] switch x { ... } # 140| getExpr(): [DeclRefExpr] x # 141| getCase(0): [CaseStmt] case ... -# 142| getBody(): [BraceStmt] { ... } -# 142| getElement(0): [ReturnStmt] return ... -# 142| getResult(): [BooleanLiteralExpr] true -# 143| getElement(1): [ReturnStmt] return ... -# 143| getResult(): [BooleanLiteralExpr] true # 141| getLabel(0): [CaseLabelItem] =~ ... # 141| getPattern(): [ExprPattern] =~ ... # 141| getSubExpr(): [BinaryExpr] ... ~=(_:_:) ... @@ -747,10 +746,12 @@ cfg.swift: # 141| getExpr(): [IntegerLiteralExpr] 1 # 141| getArgument(1): [Argument] : $match # 141| getExpr(): [DeclRefExpr] $match +# 142| getBody(): [BraceStmt] { ... } +# 142| getElement(0): [ReturnStmt] return ... +# 142| getResult(): [BooleanLiteralExpr] true +# 143| getElement(1): [ReturnStmt] return ... +# 143| getResult(): [BooleanLiteralExpr] true # 144| getCase(1): [CaseStmt] case ... -# 145| getBody(): [BraceStmt] { ... } -# 145| getElement(0): [ReturnStmt] return ... -# 145| getResult(): [BooleanLiteralExpr] true # 144| getLabel(0): [CaseLabelItem] =~ ... where ... # 144| getPattern(): [ExprPattern] =~ ... # 144| getSubExpr(): [BinaryExpr] ... ~=(_:_:) ... @@ -789,12 +790,15 @@ cfg.swift: # 144| getArgument(1): [Argument] : 5 # 144| getExpr(): [IntegerLiteralExpr] 5 # 144| getCapture(0): [CapturedDecl] x +# 145| getBody(): [BraceStmt] { ... } +# 145| getElement(0): [ReturnStmt] return ... +# 145| getResult(): [BooleanLiteralExpr] true # 146| getCase(2): [CaseStmt] case ... +# 146| getLabel(0): [CaseLabelItem] _ +# 146| getPattern(): [AnyPattern] _ # 147| getBody(): [BraceStmt] { ... } # 147| getElement(0): [ReturnStmt] return ... # 147| getResult(): [BooleanLiteralExpr] false -# 146| getLabel(0): [CaseLabelItem] _ -# 146| getPattern(): [AnyPattern] _ # 150| getElement(2): [PatternBindingDecl] var ... = ... # 150| getInit(0): [CallExpr] call to C.init(n:) # 150| getFunction(): [MethodLookupExpr] C.init(n:) @@ -2451,6 +2455,8 @@ cfg.swift: # 369| getCapture(0): [CapturedDecl] z # 368| [ConcreteVarDecl] z # 368| Type = Int +# 368| [ConcreteVarDecl] t +# 368| Type = String # 373| [NamedFunction] testTupleElement(t:) # 373| InterfaceType = ((a: Int, Int, c: Int)) -> Int # 373| getParam(0): [ParamDecl] t @@ -2758,38 +2764,38 @@ cfg.swift: #-----| getElement(1): [SwitchStmt] switch a { ... } #-----| getExpr(): [DeclRefExpr] a #-----| getCase(0): [CaseStmt] case ... +#-----| getLabel(0): [CaseLabelItem] .A +#-----| getPattern(): [EnumElementPattern] .A #-----| getBody(): [BraceStmt] { ... } #-----| getElement(0): [AssignExpr] ... = ... #-----| getDest(): [DeclRefExpr] index_a #-----| getSource(): [IntegerLiteralExpr] 0 -#-----| getLabel(0): [CaseLabelItem] .A -#-----| getPattern(): [EnumElementPattern] .A #-----| getCase(1): [CaseStmt] case ... +#-----| getLabel(0): [CaseLabelItem] .B +#-----| getPattern(): [EnumElementPattern] .B #-----| getBody(): [BraceStmt] { ... } #-----| getElement(0): [AssignExpr] ... = ... #-----| getDest(): [DeclRefExpr] index_a #-----| getSource(): [IntegerLiteralExpr] 1 -#-----| getLabel(0): [CaseLabelItem] .B -#-----| getPattern(): [EnumElementPattern] .B #-----| getElement(2): [PatternBindingDecl] var ... = ... #-----| getPattern(0): [TypedPattern] ... as ... #-----| getSubPattern(): [NamedPattern] index_b #-----| getElement(3): [SwitchStmt] switch b { ... } #-----| getExpr(): [DeclRefExpr] b #-----| getCase(0): [CaseStmt] case ... +#-----| getLabel(0): [CaseLabelItem] .A +#-----| getPattern(): [EnumElementPattern] .A #-----| getBody(): [BraceStmt] { ... } #-----| getElement(0): [AssignExpr] ... = ... #-----| getDest(): [DeclRefExpr] index_b #-----| getSource(): [IntegerLiteralExpr] 0 -#-----| getLabel(0): [CaseLabelItem] .A -#-----| getPattern(): [EnumElementPattern] .A #-----| getCase(1): [CaseStmt] case ... +#-----| getLabel(0): [CaseLabelItem] .B +#-----| getPattern(): [EnumElementPattern] .B #-----| getBody(): [BraceStmt] { ... } #-----| getElement(0): [AssignExpr] ... = ... #-----| getDest(): [DeclRefExpr] index_b #-----| getSource(): [IntegerLiteralExpr] 1 -#-----| getLabel(0): [CaseLabelItem] .B -#-----| getPattern(): [EnumElementPattern] .B #-----| getElement(4): [ReturnStmt] return ... #-----| getResult(): [BinaryExpr] ... .==(_:_:) ... #-----| getFunction(): [MethodLookupExpr] .==(_:_:) @@ -2827,19 +2833,19 @@ cfg.swift: #-----| getElement(1): [SwitchStmt] switch self { ... } #-----| getExpr(): [DeclRefExpr] self #-----| getCase(0): [CaseStmt] case ... +#-----| getLabel(0): [CaseLabelItem] .A +#-----| getPattern(): [EnumElementPattern] .A #-----| getBody(): [BraceStmt] { ... } #-----| getElement(0): [AssignExpr] ... = ... #-----| getDest(): [DeclRefExpr] discriminator #-----| getSource(): [IntegerLiteralExpr] 0 -#-----| getLabel(0): [CaseLabelItem] .A -#-----| getPattern(): [EnumElementPattern] .A #-----| getCase(1): [CaseStmt] case ... +#-----| getLabel(0): [CaseLabelItem] .B +#-----| getPattern(): [EnumElementPattern] .B #-----| getBody(): [BraceStmt] { ... } #-----| getElement(0): [AssignExpr] ... = ... #-----| getDest(): [DeclRefExpr] discriminator #-----| getSource(): [IntegerLiteralExpr] 1 -#-----| getLabel(0): [CaseLabelItem] .B -#-----| getPattern(): [EnumElementPattern] .B #-----| getElement(2): [CallExpr] call to combine(_:) #-----| getFunction(): [MethodLookupExpr] .combine(_:) #-----| getBase(): [DeclRefExpr] hasher @@ -3551,80 +3557,80 @@ declarations.swift: #-----| getElement(1): [SwitchStmt] switch a { ... } #-----| getExpr(): [DeclRefExpr] a #-----| getCase(0): [CaseStmt] case ... +#-----| getLabel(0): [CaseLabelItem] .value1 +#-----| getPattern(): [EnumElementPattern] .value1 #-----| getBody(): [BraceStmt] { ... } #-----| getElement(0): [AssignExpr] ... = ... #-----| getDest(): [DeclRefExpr] index_a #-----| getSource(): [IntegerLiteralExpr] 0 -#-----| getLabel(0): [CaseLabelItem] .value1 -#-----| getPattern(): [EnumElementPattern] .value1 #-----| getCase(1): [CaseStmt] case ... +#-----| getLabel(0): [CaseLabelItem] .value2 +#-----| getPattern(): [EnumElementPattern] .value2 #-----| getBody(): [BraceStmt] { ... } #-----| getElement(0): [AssignExpr] ... = ... #-----| getDest(): [DeclRefExpr] index_a #-----| getSource(): [IntegerLiteralExpr] 1 -#-----| getLabel(0): [CaseLabelItem] .value2 -#-----| getPattern(): [EnumElementPattern] .value2 #-----| getCase(2): [CaseStmt] case ... +#-----| getLabel(0): [CaseLabelItem] .value3 +#-----| getPattern(): [EnumElementPattern] .value3 #-----| getBody(): [BraceStmt] { ... } #-----| getElement(0): [AssignExpr] ... = ... #-----| getDest(): [DeclRefExpr] index_a #-----| getSource(): [IntegerLiteralExpr] 2 -#-----| getLabel(0): [CaseLabelItem] .value3 -#-----| getPattern(): [EnumElementPattern] .value3 #-----| getCase(3): [CaseStmt] case ... +#-----| getLabel(0): [CaseLabelItem] .value4 +#-----| getPattern(): [EnumElementPattern] .value4 #-----| getBody(): [BraceStmt] { ... } #-----| getElement(0): [AssignExpr] ... = ... #-----| getDest(): [DeclRefExpr] index_a #-----| getSource(): [IntegerLiteralExpr] 3 -#-----| getLabel(0): [CaseLabelItem] .value4 -#-----| getPattern(): [EnumElementPattern] .value4 #-----| getCase(4): [CaseStmt] case ... +#-----| getLabel(0): [CaseLabelItem] .value5 +#-----| getPattern(): [EnumElementPattern] .value5 #-----| getBody(): [BraceStmt] { ... } #-----| getElement(0): [AssignExpr] ... = ... #-----| getDest(): [DeclRefExpr] index_a #-----| getSource(): [IntegerLiteralExpr] 4 -#-----| getLabel(0): [CaseLabelItem] .value5 -#-----| getPattern(): [EnumElementPattern] .value5 #-----| getElement(2): [PatternBindingDecl] var ... = ... #-----| getPattern(0): [TypedPattern] ... as ... #-----| getSubPattern(): [NamedPattern] index_b #-----| getElement(3): [SwitchStmt] switch b { ... } #-----| getExpr(): [DeclRefExpr] b #-----| getCase(0): [CaseStmt] case ... +#-----| getLabel(0): [CaseLabelItem] .value1 +#-----| getPattern(): [EnumElementPattern] .value1 #-----| getBody(): [BraceStmt] { ... } #-----| getElement(0): [AssignExpr] ... = ... #-----| getDest(): [DeclRefExpr] index_b #-----| getSource(): [IntegerLiteralExpr] 0 -#-----| getLabel(0): [CaseLabelItem] .value1 -#-----| getPattern(): [EnumElementPattern] .value1 #-----| getCase(1): [CaseStmt] case ... +#-----| getLabel(0): [CaseLabelItem] .value2 +#-----| getPattern(): [EnumElementPattern] .value2 #-----| getBody(): [BraceStmt] { ... } #-----| getElement(0): [AssignExpr] ... = ... #-----| getDest(): [DeclRefExpr] index_b #-----| getSource(): [IntegerLiteralExpr] 1 -#-----| getLabel(0): [CaseLabelItem] .value2 -#-----| getPattern(): [EnumElementPattern] .value2 #-----| getCase(2): [CaseStmt] case ... +#-----| getLabel(0): [CaseLabelItem] .value3 +#-----| getPattern(): [EnumElementPattern] .value3 #-----| getBody(): [BraceStmt] { ... } #-----| getElement(0): [AssignExpr] ... = ... #-----| getDest(): [DeclRefExpr] index_b #-----| getSource(): [IntegerLiteralExpr] 2 -#-----| getLabel(0): [CaseLabelItem] .value3 -#-----| getPattern(): [EnumElementPattern] .value3 #-----| getCase(3): [CaseStmt] case ... +#-----| getLabel(0): [CaseLabelItem] .value4 +#-----| getPattern(): [EnumElementPattern] .value4 #-----| getBody(): [BraceStmt] { ... } #-----| getElement(0): [AssignExpr] ... = ... #-----| getDest(): [DeclRefExpr] index_b #-----| getSource(): [IntegerLiteralExpr] 3 -#-----| getLabel(0): [CaseLabelItem] .value4 -#-----| getPattern(): [EnumElementPattern] .value4 #-----| getCase(4): [CaseStmt] case ... +#-----| getLabel(0): [CaseLabelItem] .value5 +#-----| getPattern(): [EnumElementPattern] .value5 #-----| getBody(): [BraceStmt] { ... } #-----| getElement(0): [AssignExpr] ... = ... #-----| getDest(): [DeclRefExpr] index_b #-----| getSource(): [IntegerLiteralExpr] 4 -#-----| getLabel(0): [CaseLabelItem] .value5 -#-----| getPattern(): [EnumElementPattern] .value5 #-----| getElement(4): [ReturnStmt] return ... #-----| getResult(): [BinaryExpr] ... .==(_:_:) ... #-----| getFunction(): [MethodLookupExpr] .==(_:_:) @@ -3662,40 +3668,40 @@ declarations.swift: #-----| getElement(1): [SwitchStmt] switch self { ... } #-----| getExpr(): [DeclRefExpr] self #-----| getCase(0): [CaseStmt] case ... +#-----| getLabel(0): [CaseLabelItem] .value1 +#-----| getPattern(): [EnumElementPattern] .value1 #-----| getBody(): [BraceStmt] { ... } #-----| getElement(0): [AssignExpr] ... = ... #-----| getDest(): [DeclRefExpr] discriminator #-----| getSource(): [IntegerLiteralExpr] 0 -#-----| getLabel(0): [CaseLabelItem] .value1 -#-----| getPattern(): [EnumElementPattern] .value1 #-----| getCase(1): [CaseStmt] case ... +#-----| getLabel(0): [CaseLabelItem] .value2 +#-----| getPattern(): [EnumElementPattern] .value2 #-----| getBody(): [BraceStmt] { ... } #-----| getElement(0): [AssignExpr] ... = ... #-----| getDest(): [DeclRefExpr] discriminator #-----| getSource(): [IntegerLiteralExpr] 1 -#-----| getLabel(0): [CaseLabelItem] .value2 -#-----| getPattern(): [EnumElementPattern] .value2 #-----| getCase(2): [CaseStmt] case ... +#-----| getLabel(0): [CaseLabelItem] .value3 +#-----| getPattern(): [EnumElementPattern] .value3 #-----| getBody(): [BraceStmt] { ... } #-----| getElement(0): [AssignExpr] ... = ... #-----| getDest(): [DeclRefExpr] discriminator #-----| getSource(): [IntegerLiteralExpr] 2 -#-----| getLabel(0): [CaseLabelItem] .value3 -#-----| getPattern(): [EnumElementPattern] .value3 #-----| getCase(3): [CaseStmt] case ... +#-----| getLabel(0): [CaseLabelItem] .value4 +#-----| getPattern(): [EnumElementPattern] .value4 #-----| getBody(): [BraceStmt] { ... } #-----| getElement(0): [AssignExpr] ... = ... #-----| getDest(): [DeclRefExpr] discriminator #-----| getSource(): [IntegerLiteralExpr] 3 -#-----| getLabel(0): [CaseLabelItem] .value4 -#-----| getPattern(): [EnumElementPattern] .value4 #-----| getCase(4): [CaseStmt] case ... +#-----| getLabel(0): [CaseLabelItem] .value5 +#-----| getPattern(): [EnumElementPattern] .value5 #-----| getBody(): [BraceStmt] { ... } #-----| getElement(0): [AssignExpr] ... = ... #-----| getDest(): [DeclRefExpr] discriminator #-----| getSource(): [IntegerLiteralExpr] 4 -#-----| getLabel(0): [CaseLabelItem] .value5 -#-----| getPattern(): [EnumElementPattern] .value5 #-----| getElement(2): [CallExpr] call to combine(_:) #-----| getFunction(): [MethodLookupExpr] .combine(_:) #-----| getBase(): [DeclRefExpr] hasher @@ -4550,24 +4556,24 @@ expressions.swift: #-----| getElement(1): [SwitchStmt] switch a { ... } #-----| getExpr(): [DeclRefExpr] a #-----| getCase(0): [CaseStmt] case ... +#-----| getLabel(0): [CaseLabelItem] .failed +#-----| getPattern(): [EnumElementPattern] .failed #-----| getBody(): [BraceStmt] { ... } #-----| getElement(0): [AssignExpr] ... = ... #-----| getDest(): [DeclRefExpr] index_a #-----| getSource(): [IntegerLiteralExpr] 0 -#-----| getLabel(0): [CaseLabelItem] .failed -#-----| getPattern(): [EnumElementPattern] .failed #-----| getElement(2): [PatternBindingDecl] var ... = ... #-----| getPattern(0): [TypedPattern] ... as ... #-----| getSubPattern(): [NamedPattern] index_b #-----| getElement(3): [SwitchStmt] switch b { ... } #-----| getExpr(): [DeclRefExpr] b #-----| getCase(0): [CaseStmt] case ... +#-----| getLabel(0): [CaseLabelItem] .failed +#-----| getPattern(): [EnumElementPattern] .failed #-----| getBody(): [BraceStmt] { ... } #-----| getElement(0): [AssignExpr] ... = ... #-----| getDest(): [DeclRefExpr] index_b #-----| getSource(): [IntegerLiteralExpr] 0 -#-----| getLabel(0): [CaseLabelItem] .failed -#-----| getPattern(): [EnumElementPattern] .failed #-----| getElement(4): [ReturnStmt] return ... #-----| getResult(): [BinaryExpr] ... .==(_:_:) ... #-----| getFunction(): [MethodLookupExpr] .==(_:_:) @@ -4605,12 +4611,12 @@ expressions.swift: #-----| getElement(1): [SwitchStmt] switch self { ... } #-----| getExpr(): [DeclRefExpr] self #-----| getCase(0): [CaseStmt] case ... +#-----| getLabel(0): [CaseLabelItem] .failed +#-----| getPattern(): [EnumElementPattern] .failed #-----| getBody(): [BraceStmt] { ... } #-----| getElement(0): [AssignExpr] ... = ... #-----| getDest(): [DeclRefExpr] discriminator #-----| getSource(): [IntegerLiteralExpr] 0 -#-----| getLabel(0): [CaseLabelItem] .failed -#-----| getPattern(): [EnumElementPattern] .failed #-----| getElement(2): [CallExpr] call to combine(_:) #-----| getFunction(): [MethodLookupExpr] .combine(_:) #-----| getBase(): [DeclRefExpr] hasher @@ -5837,18 +5843,20 @@ patterns.swift: # 11| getElement(1): [SwitchStmt] switch point { ... } # 11| getExpr(): [DeclRefExpr] point # 12| getCase(0): [CaseStmt] case ... -# 12| getBody(): [BraceStmt] { ... } -# 12| getElement(0): [StringLiteralExpr] binding # 12| getLabel(0): [CaseLabelItem] (...) # 12| getPattern(): [TuplePattern] (...) # 12| getElement(0): [NamedPattern] xx # 12| getElement(1): [NamedPattern] yy # 12| getPattern().getFullyUnresolved(): [BindingPattern] let ... +# 12| getVariable(0): [ConcreteVarDecl] xx +# 12| Type = Int +# 12| getVariable(1): [ConcreteVarDecl] yy +# 12| Type = Int +# 12| getBody(): [BraceStmt] { ... } +# 12| getElement(0): [StringLiteralExpr] binding # 15| getElement(2): [SwitchStmt] switch 3 { ... } # 15| getExpr(): [IntegerLiteralExpr] 3 # 16| getCase(0): [CaseStmt] case ... -# 16| getBody(): [BraceStmt] { ... } -# 16| getElement(0): [StringLiteralExpr] expr # 16| getLabel(0): [CaseLabelItem] =~ ... # 16| getPattern(): [ExprPattern] =~ ... # 16| getSubExpr(): [BinaryExpr] ... ~=(_:_:) ... @@ -5865,11 +5873,13 @@ patterns.swift: # 16| getExpr(): [IntegerLiteralExpr] 2 # 16| getArgument(1): [Argument] : $match # 16| getExpr(): [DeclRefExpr] $match +# 16| getBody(): [BraceStmt] { ... } +# 16| getElement(0): [StringLiteralExpr] expr # 17| getCase(1): [CaseStmt] case ... -# 17| getBody(): [BraceStmt] { ... } -# 17| getElement(0): [StringLiteralExpr] # 17| getLabel(0): [CaseLabelItem] _ # 17| getPattern(): [AnyPattern] _ +# 17| getBody(): [BraceStmt] { ... } +# 17| getElement(0): [StringLiteralExpr] # 20| getElement(3): [EnumDecl] Foo # 21| getMember(0): [EnumCaseDecl] case ... # 21| getMember(1): [EnumElementDecl] bar @@ -5889,19 +5899,23 @@ patterns.swift: # 26| getElement(5): [SwitchStmt] switch v { ... } # 26| getExpr(): [DeclRefExpr] v # 27| getCase(0): [CaseStmt] case ... -# 27| getBody(): [BraceStmt] { ... } -# 27| getElement(0): [StringLiteralExpr] bar # 27| getLabel(0): [CaseLabelItem] .bar # 27| getPattern(): [EnumElementPattern] .bar +# 27| getBody(): [BraceStmt] { ... } +# 27| getElement(0): [StringLiteralExpr] bar # 28| getCase(1): [CaseStmt] case ... -# 28| getBody(): [BraceStmt] { ... } -# 28| getElement(0): [DeclRefExpr] i # 28| getLabel(0): [CaseLabelItem] .baz(...) # 28| getPattern(): [EnumElementPattern] .baz(...) # 28| getSubPattern(): [TuplePattern] (...) # 28| getElement(0): [NamedPattern] i # 28| getElement(1): [NamedPattern] s # 28| getPattern().getFullyUnresolved(): [BindingPattern] let ... +# 28| getVariable(0): [ConcreteVarDecl] i +# 28| Type = Int +# 28| getVariable(1): [ConcreteVarDecl] s +# 28| Type = String +# 28| getBody(): [BraceStmt] { ... } +# 28| getElement(0): [DeclRefExpr] i # 31| getElement(6): [PatternBindingDecl] var ... = ... # 31| getInit(0): [NilLiteralExpr] nil # 31| getPattern(0): [TypedPattern] ... as ... @@ -5910,17 +5924,19 @@ patterns.swift: # 33| getElement(7): [SwitchStmt] switch w { ... } # 33| getExpr(): [DeclRefExpr] w # 34| getCase(0): [CaseStmt] case ... -# 34| getBody(): [BraceStmt] { ... } -# 34| getElement(0): [DeclRefExpr] n # 34| getLabel(0): [CaseLabelItem] let ...? # 34| getPattern(): [OptionalSomePattern] let ...? # 34| getSubPattern(): [NamedPattern] n # 34| getPattern().getFullyUnresolved(): [BindingPattern] let ... +# 34| getVariable(0): [ConcreteVarDecl] n +# 34| Type = Int +# 34| getBody(): [BraceStmt] { ... } +# 34| getElement(0): [DeclRefExpr] n # 35| getCase(1): [CaseStmt] case ... -# 35| getBody(): [BraceStmt] { ... } -# 35| getElement(0): [StringLiteralExpr] none # 35| getLabel(0): [CaseLabelItem] _ # 35| getPattern(): [AnyPattern] _ +# 35| getBody(): [BraceStmt] { ... } +# 35| getElement(0): [StringLiteralExpr] none # 38| getElement(8): [PatternBindingDecl] var ... = ... # 38| getInit(0): [StringLiteralExpr] any # 38| getInit(0).getFullyConverted(): [ErasureExpr] (Any) ... @@ -5930,53 +5946,47 @@ patterns.swift: # 40| getElement(9): [SwitchStmt] switch a { ... } # 40| getExpr(): [DeclRefExpr] a # 41| getCase(0): [CaseStmt] case ... -# 41| getBody(): [BraceStmt] { ... } -# 41| getElement(0): [StringLiteralExpr] is pattern # 41| getLabel(0): [CaseLabelItem] ... is ... # 41| getPattern(): [IsPattern] ... is ... # 41| getCastTypeRepr(): [TypeRepr] Int +# 41| getBody(): [BraceStmt] { ... } +# 41| getElement(0): [StringLiteralExpr] is pattern # 42| getCase(1): [CaseStmt] case ... -# 42| getBody(): [BraceStmt] { ... } -# 42| getElement(0): [StringLiteralExpr] as pattern # 42| getLabel(0): [CaseLabelItem] ... is ... # 42| getPattern(): [IsPattern] ... is ... # 42| getCastTypeRepr(): [TypeRepr] String # 42| getSubPattern(): [NamedPattern] x # 42| getPattern().getFullyUnresolved(): [BindingPattern] let ... +# 42| getVariable(0): [ConcreteVarDecl] x +# 42| Type = String +# 42| getBody(): [BraceStmt] { ... } +# 42| getElement(0): [StringLiteralExpr] as pattern # 43| getCase(2): [CaseStmt] case ... -# 43| getBody(): [BraceStmt] { ... } -# 43| getElement(0): [StringLiteralExpr] other # 43| getLabel(0): [CaseLabelItem] _ # 43| getPattern(): [AnyPattern] _ +# 43| getBody(): [BraceStmt] { ... } +# 43| getElement(0): [StringLiteralExpr] other # 46| getElement(10): [PatternBindingDecl] var ... = ... # 46| getInit(0): [BooleanLiteralExpr] true # 46| getPattern(0): [NamedPattern] b # 48| getElement(11): [SwitchStmt] switch b { ... } # 48| getExpr(): [DeclRefExpr] b # 49| getCase(0): [CaseStmt] case ... -# 49| getBody(): [BraceStmt] { ... } -# 49| getElement(0): [StringLiteralExpr] true # 49| getLabel(0): [CaseLabelItem] true # 49| getPattern(): [BoolPattern] true +# 49| getBody(): [BraceStmt] { ... } +# 49| getElement(0): [StringLiteralExpr] true # 50| getCase(1): [CaseStmt] case ... -# 50| getBody(): [BraceStmt] { ... } -# 50| getElement(0): [StringLiteralExpr] false # 50| getLabel(0): [CaseLabelItem] false # 50| getPattern(): [BoolPattern] false -# 12| [ConcreteVarDecl] xx -# 12| Type = Int -# 12| [ConcreteVarDecl] yy -# 12| Type = Int +# 50| getBody(): [BraceStmt] { ... } +# 50| getElement(0): [StringLiteralExpr] false # 16| [ConcreteVarDecl] $match # 16| Type = Int # 28| [ConcreteVarDecl] i # 28| Type = Int -# 28| [ConcreteVarDecl] s -# 28| Type = String # 34| [ConcreteVarDecl] n # 34| Type = Int -# 42| [ConcreteVarDecl] x -# 42| Type = String # 54| [NamedFunction] bound_and_unbound() # 54| InterfaceType = () -> () # 54| getBody(): [BraceStmt] { ... } @@ -6047,8 +6057,6 @@ patterns.swift: # 60| getElement(3): [SwitchStmt] switch a { ... } # 60| getExpr(): [DeclRefExpr] a # 61| getCase(0): [CaseStmt] case ... -# 61| getBody(): [BraceStmt] { ... } -# 61| getElement(0): [StringLiteralExpr] equals c # 61| getLabel(0): [CaseLabelItem] =~ ... # 61| getPattern(): [ExprPattern] =~ ... # 61| getSubExpr(): [BinaryExpr] ... ~=(_:_:) ... @@ -6057,29 +6065,35 @@ patterns.swift: # 61| getExpr(): [DeclRefExpr] c # 61| getArgument(1): [Argument] : $match # 61| getExpr(): [DeclRefExpr] $match +# 61| getBody(): [BraceStmt] { ... } +# 61| getElement(0): [StringLiteralExpr] equals c # 62| getCase(1): [CaseStmt] case ... -# 62| getBody(): [BraceStmt] { ... } -# 62| getElement(0): [StringLiteralExpr] binds c # 62| getLabel(0): [CaseLabelItem] c # 62| getPattern(): [NamedPattern] c # 62| getPattern().getFullyUnresolved(): [BindingPattern] let ... +# 62| getVariable(0): [ConcreteVarDecl] c +# 62| Type = Int +# 62| getBody(): [BraceStmt] { ... } +# 62| getElement(0): [StringLiteralExpr] binds c # 63| getCase(2): [CaseStmt] case ... -# 63| getBody(): [BraceStmt] { ... } -# 63| getElement(0): [StringLiteralExpr] default # 63| getLabel(0): [CaseLabelItem] _ # 63| getPattern(): [AnyPattern] _ +# 63| getBody(): [BraceStmt] { ... } +# 63| getElement(0): [StringLiteralExpr] default # 57| [ConcreteVarDecl] a # 57| Type = Int +# 57| [ConcreteVarDecl] b +# 57| Type = Int # 57| [ConcreteVarDecl] c # 57| Type = Int # 58| [ConcreteVarDecl] $match # 58| Type = Int # 58| [ConcreteVarDecl] b # 58| Type = Int +# 58| [ConcreteVarDecl] c +# 58| Type = Int # 61| [ConcreteVarDecl] $match # 61| Type = Int -# 62| [ConcreteVarDecl] c -# 62| Type = Int # 67| [NamedFunction] source() # 67| InterfaceType = () -> Int # 67| getBody(): [BraceStmt] { ... } @@ -6128,22 +6142,35 @@ patterns.swift: # 80| getExpr(): [DeclRefExpr] a # 80| getExpr().getFullyConverted(): [LoadExpr] (MyEnum) ... # 81| getCase(0): [CaseStmt] case ... -# 82| getBody(): [BraceStmt] { ... } -# 82| getElement(0): [TupleExpr] (...) # 81| getLabel(0): [CaseLabelItem] .myNone # 81| getPattern(): [EnumElementPattern] .myNone +# 82| getBody(): [BraceStmt] { ... } +# 82| getElement(0): [TupleExpr] (...) # 83| getCase(1): [CaseStmt] case ... -# 84| getBody(): [BraceStmt] { ... } -# 84| getElement(0): [CallExpr] call to sink(arg:) -# 84| getFunction(): [DeclRefExpr] sink(arg:) -# 84| getArgument(0): [Argument] arg: a -# 84| getExpr(): [DeclRefExpr] a # 83| getLabel(0): [CaseLabelItem] .mySingle(...) # 83| getPattern(): [EnumElementPattern] .mySingle(...) # 83| getSubPattern(): [NamedPattern] a # 83| getSubPattern().getFullyUnresolved(): [ParenPattern] (...) # 83| getSubPattern(): [BindingPattern] let ... +# 83| getVariable(0): [ConcreteVarDecl] a +# 83| Type = (Int) +# 84| getBody(): [BraceStmt] { ... } +# 84| getElement(0): [CallExpr] call to sink(arg:) +# 84| getFunction(): [DeclRefExpr] sink(arg:) +# 84| getArgument(0): [Argument] arg: a +# 84| getExpr(): [DeclRefExpr] a # 85| getCase(2): [CaseStmt] case ... +# 85| getLabel(0): [CaseLabelItem] .myPair(...) +# 85| getPattern(): [EnumElementPattern] .myPair(...) +# 85| getSubPattern(): [TuplePattern] (...) +# 85| getElement(0): [NamedPattern] a +# 85| getElement(0).getFullyUnresolved(): [BindingPattern] let ... +# 85| getElement(1): [NamedPattern] b +# 85| getElement(1).getFullyUnresolved(): [BindingPattern] let ... +# 85| getVariable(0): [ConcreteVarDecl] a +# 85| Type = Int +# 85| getVariable(1): [ConcreteVarDecl] b +# 85| Type = Int # 86| getBody(): [BraceStmt] { ... } # 86| getElement(0): [CallExpr] call to sink(arg:) # 86| getFunction(): [DeclRefExpr] sink(arg:) @@ -6153,25 +6180,20 @@ patterns.swift: # 87| getFunction(): [DeclRefExpr] sink(arg:) # 87| getArgument(0): [Argument] arg: b # 87| getExpr(): [DeclRefExpr] b -# 85| getLabel(0): [CaseLabelItem] .myPair(...) -# 85| getPattern(): [EnumElementPattern] .myPair(...) -# 85| getSubPattern(): [TuplePattern] (...) -# 85| getElement(0): [NamedPattern] a -# 85| getElement(0).getFullyUnresolved(): [BindingPattern] let ... -# 85| getElement(1): [NamedPattern] b -# 85| getElement(1).getFullyUnresolved(): [BindingPattern] let ... # 88| getCase(3): [CaseStmt] case ... -# 89| getBody(): [BraceStmt] { ... } -# 89| getElement(0): [CallExpr] call to sink(arg:) -# 89| getFunction(): [DeclRefExpr] sink(arg:) -# 89| getArgument(0): [Argument] arg: a -# 89| getExpr(): [DeclRefExpr] a # 88| getLabel(0): [CaseLabelItem] .myCons(...) # 88| getPattern(): [EnumElementPattern] .myCons(...) # 88| getSubPattern(): [TuplePattern] (...) # 88| getElement(0): [NamedPattern] a # 88| getElement(1): [AnyPattern] _ # 88| getPattern().getFullyUnresolved(): [BindingPattern] let ... +# 88| getVariable(0): [ConcreteVarDecl] a +# 88| Type = Int +# 89| getBody(): [BraceStmt] { ... } +# 89| getElement(0): [CallExpr] call to sink(arg:) +# 89| getFunction(): [DeclRefExpr] sink(arg:) +# 89| getArgument(0): [Argument] arg: a +# 89| getExpr(): [DeclRefExpr] a # 92| getElement(2): [IfStmt] if ... then { ... } # 92| getCondition(): [StmtCondition] StmtCondition # 92| getElement(0): [ConditionElement] .mySingle(...) = ... @@ -6220,22 +6242,35 @@ patterns.swift: # 102| getExpr(): [DeclRefExpr] a # 102| getExpr().getFullyConverted(): [LoadExpr] (MyEnum) ... # 103| getCase(0): [CaseStmt] case ... -# 104| getBody(): [BraceStmt] { ... } -# 104| getElement(0): [TupleExpr] (...) # 103| getLabel(0): [CaseLabelItem] .myNone # 103| getPattern(): [EnumElementPattern] .myNone +# 104| getBody(): [BraceStmt] { ... } +# 104| getElement(0): [TupleExpr] (...) # 105| getCase(1): [CaseStmt] case ... -# 106| getBody(): [BraceStmt] { ... } -# 106| getElement(0): [CallExpr] call to sink(arg:) -# 106| getFunction(): [DeclRefExpr] sink(arg:) -# 106| getArgument(0): [Argument] arg: a -# 106| getExpr(): [DeclRefExpr] a # 105| getLabel(0): [CaseLabelItem] .mySingle(...) # 105| getPattern(): [EnumElementPattern] .mySingle(...) # 105| getSubPattern(): [NamedPattern] a # 105| getSubPattern().getFullyUnresolved(): [ParenPattern] (...) # 105| getSubPattern(): [BindingPattern] let ... +# 105| getVariable(0): [ConcreteVarDecl] a +# 105| Type = (Int) +# 106| getBody(): [BraceStmt] { ... } +# 106| getElement(0): [CallExpr] call to sink(arg:) +# 106| getFunction(): [DeclRefExpr] sink(arg:) +# 106| getArgument(0): [Argument] arg: a +# 106| getExpr(): [DeclRefExpr] a # 107| getCase(2): [CaseStmt] case ... +# 107| getLabel(0): [CaseLabelItem] .myPair(...) +# 107| getPattern(): [EnumElementPattern] .myPair(...) +# 107| getSubPattern(): [TuplePattern] (...) +# 107| getElement(0): [NamedPattern] a +# 107| getElement(0).getFullyUnresolved(): [BindingPattern] let ... +# 107| getElement(1): [NamedPattern] b +# 107| getElement(1).getFullyUnresolved(): [BindingPattern] let ... +# 107| getVariable(0): [ConcreteVarDecl] a +# 107| Type = Int +# 107| getVariable(1): [ConcreteVarDecl] b +# 107| Type = Int # 108| getBody(): [BraceStmt] { ... } # 108| getElement(0): [CallExpr] call to sink(arg:) # 108| getFunction(): [DeclRefExpr] sink(arg:) @@ -6245,25 +6280,20 @@ patterns.swift: # 109| getFunction(): [DeclRefExpr] sink(arg:) # 109| getArgument(0): [Argument] arg: b # 109| getExpr(): [DeclRefExpr] b -# 107| getLabel(0): [CaseLabelItem] .myPair(...) -# 107| getPattern(): [EnumElementPattern] .myPair(...) -# 107| getSubPattern(): [TuplePattern] (...) -# 107| getElement(0): [NamedPattern] a -# 107| getElement(0).getFullyUnresolved(): [BindingPattern] let ... -# 107| getElement(1): [NamedPattern] b -# 107| getElement(1).getFullyUnresolved(): [BindingPattern] let ... # 110| getCase(3): [CaseStmt] case ... -# 111| getBody(): [BraceStmt] { ... } -# 111| getElement(0): [CallExpr] call to sink(arg:) -# 111| getFunction(): [DeclRefExpr] sink(arg:) -# 111| getArgument(0): [Argument] arg: a -# 111| getExpr(): [DeclRefExpr] a # 110| getLabel(0): [CaseLabelItem] .myCons(...) # 110| getPattern(): [EnumElementPattern] .myCons(...) # 110| getSubPattern(): [TuplePattern] (...) # 110| getElement(0): [NamedPattern] a # 110| getElement(1): [AnyPattern] _ # 110| getPattern().getFullyUnresolved(): [BindingPattern] let ... +# 110| getVariable(0): [ConcreteVarDecl] a +# 110| Type = Int +# 111| getBody(): [BraceStmt] { ... } +# 111| getElement(0): [CallExpr] call to sink(arg:) +# 111| getFunction(): [DeclRefExpr] sink(arg:) +# 111| getArgument(0): [Argument] arg: a +# 111| getExpr(): [DeclRefExpr] a # 114| getElement(6): [IfStmt] if ... then { ... } # 114| getCondition(): [StmtCondition] StmtCondition # 114| getElement(0): [ConditionElement] .mySingle(...) = ... @@ -6314,22 +6344,35 @@ patterns.swift: # 124| getExpr(): [DeclRefExpr] a # 124| getExpr().getFullyConverted(): [LoadExpr] (MyEnum) ... # 125| getCase(0): [CaseStmt] case ... -# 126| getBody(): [BraceStmt] { ... } -# 126| getElement(0): [TupleExpr] (...) # 125| getLabel(0): [CaseLabelItem] .myNone # 125| getPattern(): [EnumElementPattern] .myNone +# 126| getBody(): [BraceStmt] { ... } +# 126| getElement(0): [TupleExpr] (...) # 127| getCase(1): [CaseStmt] case ... -# 128| getBody(): [BraceStmt] { ... } -# 128| getElement(0): [CallExpr] call to sink(arg:) -# 128| getFunction(): [DeclRefExpr] sink(arg:) -# 128| getArgument(0): [Argument] arg: a -# 128| getExpr(): [DeclRefExpr] a # 127| getLabel(0): [CaseLabelItem] .mySingle(...) # 127| getPattern(): [EnumElementPattern] .mySingle(...) # 127| getSubPattern(): [NamedPattern] a # 127| getSubPattern().getFullyUnresolved(): [ParenPattern] (...) # 127| getSubPattern(): [BindingPattern] let ... +# 127| getVariable(0): [ConcreteVarDecl] a +# 127| Type = (Int) +# 128| getBody(): [BraceStmt] { ... } +# 128| getElement(0): [CallExpr] call to sink(arg:) +# 128| getFunction(): [DeclRefExpr] sink(arg:) +# 128| getArgument(0): [Argument] arg: a +# 128| getExpr(): [DeclRefExpr] a # 129| getCase(2): [CaseStmt] case ... +# 129| getLabel(0): [CaseLabelItem] .myPair(...) +# 129| getPattern(): [EnumElementPattern] .myPair(...) +# 129| getSubPattern(): [TuplePattern] (...) +# 129| getElement(0): [NamedPattern] a +# 129| getElement(0).getFullyUnresolved(): [BindingPattern] let ... +# 129| getElement(1): [NamedPattern] b +# 129| getElement(1).getFullyUnresolved(): [BindingPattern] let ... +# 129| getVariable(0): [ConcreteVarDecl] a +# 129| Type = Int +# 129| getVariable(1): [ConcreteVarDecl] b +# 129| Type = Int # 130| getBody(): [BraceStmt] { ... } # 130| getElement(0): [CallExpr] call to sink(arg:) # 130| getFunction(): [DeclRefExpr] sink(arg:) @@ -6339,25 +6382,20 @@ patterns.swift: # 131| getFunction(): [DeclRefExpr] sink(arg:) # 131| getArgument(0): [Argument] arg: b # 131| getExpr(): [DeclRefExpr] b -# 129| getLabel(0): [CaseLabelItem] .myPair(...) -# 129| getPattern(): [EnumElementPattern] .myPair(...) -# 129| getSubPattern(): [TuplePattern] (...) -# 129| getElement(0): [NamedPattern] a -# 129| getElement(0).getFullyUnresolved(): [BindingPattern] let ... -# 129| getElement(1): [NamedPattern] b -# 129| getElement(1).getFullyUnresolved(): [BindingPattern] let ... # 132| getCase(3): [CaseStmt] case ... -# 133| getBody(): [BraceStmt] { ... } -# 133| getElement(0): [CallExpr] call to sink(arg:) -# 133| getFunction(): [DeclRefExpr] sink(arg:) -# 133| getArgument(0): [Argument] arg: a -# 133| getExpr(): [DeclRefExpr] a # 132| getLabel(0): [CaseLabelItem] .myCons(...) # 132| getPattern(): [EnumElementPattern] .myCons(...) # 132| getSubPattern(): [TuplePattern] (...) # 132| getElement(0): [NamedPattern] a # 132| getElement(1): [AnyPattern] _ # 132| getPattern().getFullyUnresolved(): [BindingPattern] let ... +# 132| getVariable(0): [ConcreteVarDecl] a +# 132| Type = Int +# 133| getBody(): [BraceStmt] { ... } +# 133| getElement(0): [CallExpr] call to sink(arg:) +# 133| getFunction(): [DeclRefExpr] sink(arg:) +# 133| getArgument(0): [Argument] arg: a +# 133| getExpr(): [DeclRefExpr] a # 136| getElement(10): [IfStmt] if ... then { ... } # 136| getCondition(): [StmtCondition] StmtCondition # 136| getElement(0): [ConditionElement] .mySingle(...) = ... @@ -6409,22 +6447,35 @@ patterns.swift: # 146| getElement(13): [SwitchStmt] switch b { ... } # 146| getExpr(): [DeclRefExpr] b # 147| getCase(0): [CaseStmt] case ... -# 148| getBody(): [BraceStmt] { ... } -# 148| getElement(0): [TupleExpr] (...) # 147| getLabel(0): [CaseLabelItem] .myNone # 147| getPattern(): [EnumElementPattern] .myNone +# 148| getBody(): [BraceStmt] { ... } +# 148| getElement(0): [TupleExpr] (...) # 149| getCase(1): [CaseStmt] case ... -# 150| getBody(): [BraceStmt] { ... } -# 150| getElement(0): [CallExpr] call to sink(arg:) -# 150| getFunction(): [DeclRefExpr] sink(arg:) -# 150| getArgument(0): [Argument] arg: a -# 150| getExpr(): [DeclRefExpr] a # 149| getLabel(0): [CaseLabelItem] .mySingle(...) # 149| getPattern(): [EnumElementPattern] .mySingle(...) # 149| getSubPattern(): [NamedPattern] a # 149| getSubPattern().getFullyUnresolved(): [ParenPattern] (...) # 149| getSubPattern(): [BindingPattern] let ... +# 149| getVariable(0): [ConcreteVarDecl] a +# 149| Type = (Int) +# 150| getBody(): [BraceStmt] { ... } +# 150| getElement(0): [CallExpr] call to sink(arg:) +# 150| getFunction(): [DeclRefExpr] sink(arg:) +# 150| getArgument(0): [Argument] arg: a +# 150| getExpr(): [DeclRefExpr] a # 151| getCase(2): [CaseStmt] case ... +# 151| getLabel(0): [CaseLabelItem] .myPair(...) +# 151| getPattern(): [EnumElementPattern] .myPair(...) +# 151| getSubPattern(): [TuplePattern] (...) +# 151| getElement(0): [NamedPattern] a +# 151| getElement(0).getFullyUnresolved(): [BindingPattern] let ... +# 151| getElement(1): [NamedPattern] b +# 151| getElement(1).getFullyUnresolved(): [BindingPattern] let ... +# 151| getVariable(0): [ConcreteVarDecl] a +# 151| Type = Int +# 151| getVariable(1): [ConcreteVarDecl] b +# 151| Type = Int # 152| getBody(): [BraceStmt] { ... } # 152| getElement(0): [CallExpr] call to sink(arg:) # 152| getFunction(): [DeclRefExpr] sink(arg:) @@ -6434,14 +6485,22 @@ patterns.swift: # 153| getFunction(): [DeclRefExpr] sink(arg:) # 153| getArgument(0): [Argument] arg: b # 153| getExpr(): [DeclRefExpr] b -# 151| getLabel(0): [CaseLabelItem] .myPair(...) -# 151| getPattern(): [EnumElementPattern] .myPair(...) -# 151| getSubPattern(): [TuplePattern] (...) -# 151| getElement(0): [NamedPattern] a -# 151| getElement(0).getFullyUnresolved(): [BindingPattern] let ... -# 151| getElement(1): [NamedPattern] b -# 151| getElement(1).getFullyUnresolved(): [BindingPattern] let ... # 154| getCase(3): [CaseStmt] case ... +# 154| getLabel(0): [CaseLabelItem] .myCons(...) +# 154| getPattern(): [EnumElementPattern] .myCons(...) +# 154| getSubPattern(): [TuplePattern] (...) +# 154| getElement(0): [NamedPattern] a +# 154| getElement(1): [EnumElementPattern] .myPair(...) +# 154| getSubPattern(): [TuplePattern] (...) +# 154| getElement(0): [NamedPattern] b +# 154| getElement(1): [NamedPattern] c +# 154| getPattern().getFullyUnresolved(): [BindingPattern] let ... +# 154| getVariable(0): [ConcreteVarDecl] a +# 154| Type = Int +# 154| getVariable(1): [ConcreteVarDecl] b +# 154| Type = Int +# 154| getVariable(2): [ConcreteVarDecl] c +# 154| Type = Int # 155| getBody(): [BraceStmt] { ... } # 155| getElement(0): [CallExpr] call to sink(arg:) # 155| getFunction(): [DeclRefExpr] sink(arg:) @@ -6455,27 +6514,20 @@ patterns.swift: # 157| getFunction(): [DeclRefExpr] sink(arg:) # 157| getArgument(0): [Argument] arg: c # 157| getExpr(): [DeclRefExpr] c -# 154| getLabel(0): [CaseLabelItem] .myCons(...) -# 154| getPattern(): [EnumElementPattern] .myCons(...) -# 154| getSubPattern(): [TuplePattern] (...) -# 154| getElement(0): [NamedPattern] a -# 154| getElement(1): [EnumElementPattern] .myPair(...) -# 154| getSubPattern(): [TuplePattern] (...) -# 154| getElement(0): [NamedPattern] b -# 154| getElement(1): [NamedPattern] c -# 154| getPattern().getFullyUnresolved(): [BindingPattern] let ... # 158| getCase(4): [CaseStmt] case ... -# 159| getBody(): [BraceStmt] { ... } -# 159| getElement(0): [CallExpr] call to sink(arg:) -# 159| getFunction(): [DeclRefExpr] sink(arg:) -# 159| getArgument(0): [Argument] arg: a -# 159| getExpr(): [DeclRefExpr] a # 158| getLabel(0): [CaseLabelItem] .myCons(...) # 158| getPattern(): [EnumElementPattern] .myCons(...) # 158| getSubPattern(): [TuplePattern] (...) # 158| getElement(0): [NamedPattern] a # 158| getElement(1): [AnyPattern] _ # 158| getPattern().getFullyUnresolved(): [BindingPattern] let ... +# 158| getVariable(0): [ConcreteVarDecl] a +# 158| Type = Int +# 159| getBody(): [BraceStmt] { ... } +# 159| getElement(0): [CallExpr] call to sink(arg:) +# 159| getFunction(): [DeclRefExpr] sink(arg:) +# 159| getArgument(0): [Argument] arg: a +# 159| getExpr(): [DeclRefExpr] a # 162| getElement(14): [IfStmt] if ... then { ... } # 162| getCondition(): [StmtCondition] StmtCondition # 162| getElement(0): [ConditionElement] .mySingle(...) = ... @@ -6549,6 +6601,30 @@ patterns.swift: # 173| getElement(0).getFullyConverted(): [LoadExpr] (MyEnum) ... # 173| getElement(1): [DeclRefExpr] b # 174| getCase(0): [CaseStmt] case ... +# 174| getLabel(0): [CaseLabelItem] (...) +# 174| getPattern(): [TuplePattern] (...) +# 174| getElement(0): [EnumElementPattern] .myPair(...) +# 174| getSubPattern(): [TuplePattern] (...) +# 174| getElement(0): [NamedPattern] a +# 174| getElement(1): [NamedPattern] b +# 174| getElement(1): [EnumElementPattern] .myCons(...) +# 174| getSubPattern(): [TuplePattern] (...) +# 174| getElement(0): [NamedPattern] c +# 174| getElement(1): [EnumElementPattern] .myPair(...) +# 174| getSubPattern(): [TuplePattern] (...) +# 174| getElement(0): [NamedPattern] d +# 174| getElement(1): [NamedPattern] e +# 174| getPattern().getFullyUnresolved(): [BindingPattern] let ... +# 174| getVariable(0): [ConcreteVarDecl] a +# 174| Type = Int +# 174| getVariable(1): [ConcreteVarDecl] b +# 174| Type = Int +# 174| getVariable(2): [ConcreteVarDecl] c +# 174| Type = Int +# 174| getVariable(3): [ConcreteVarDecl] d +# 174| Type = Int +# 174| getVariable(4): [ConcreteVarDecl] e +# 174| Type = Int # 175| getBody(): [BraceStmt] { ... } # 175| getElement(0): [CallExpr] call to sink(arg:) # 175| getFunction(): [DeclRefExpr] sink(arg:) @@ -6570,25 +6646,11 @@ patterns.swift: # 179| getFunction(): [DeclRefExpr] sink(arg:) # 179| getArgument(0): [Argument] arg: e # 179| getExpr(): [DeclRefExpr] e -# 174| getLabel(0): [CaseLabelItem] (...) -# 174| getPattern(): [TuplePattern] (...) -# 174| getElement(0): [EnumElementPattern] .myPair(...) -# 174| getSubPattern(): [TuplePattern] (...) -# 174| getElement(0): [NamedPattern] a -# 174| getElement(1): [NamedPattern] b -# 174| getElement(1): [EnumElementPattern] .myCons(...) -# 174| getSubPattern(): [TuplePattern] (...) -# 174| getElement(0): [NamedPattern] c -# 174| getElement(1): [EnumElementPattern] .myPair(...) -# 174| getSubPattern(): [TuplePattern] (...) -# 174| getElement(0): [NamedPattern] d -# 174| getElement(1): [NamedPattern] e -# 174| getPattern().getFullyUnresolved(): [BindingPattern] let ... # 180| getCase(1): [CaseStmt] case ... -# 181| getBody(): [BraceStmt] { ... } -# 181| getElement(0): [TupleExpr] (...) # 180| getLabel(0): [CaseLabelItem] _ # 180| getPattern(): [AnyPattern] _ +# 181| getBody(): [BraceStmt] { ... } +# 181| getElement(0): [TupleExpr] (...) # 83| [ConcreteVarDecl] a # 83| Type = (Int) # 85| [ConcreteVarDecl] a @@ -6773,6 +6835,11 @@ statements.swift: # 20| getArgument(0): [Argument] : 11 # 20| getExpr(): [IntegerLiteralExpr] 11 # 21| getCatch(0): [CaseStmt] case ... +# 21| getLabel(0): [CaseLabelItem] error +# 21| getPattern(): [NamedPattern] error +# 21| getPattern().getFullyUnresolved(): [BindingPattern] let ... +# 21| getVariable(0): [ConcreteVarDecl] error +# 21| Type = Error # 21| getBody(): [BraceStmt] { ... } # 22| getElement(0): [CallExpr] call to print(_:separator:terminator:) # 22| getFunction(): [DeclRefExpr] print(_:separator:terminator:) @@ -6785,9 +6852,6 @@ statements.swift: # 22| getExpr(): [DefaultArgumentExpr] default separator # 22| getArgument(2): [Argument] terminator: default terminator # 22| getExpr(): [DefaultArgumentExpr] default terminator -# 21| getLabel(0): [CaseLabelItem] error -# 21| getPattern(): [NamedPattern] error -# 21| getPattern().getFullyUnresolved(): [BindingPattern] let ... # 25| getElement(6): [DoCatchStmt] do { ... } catch { ... } # 25| getBody(): [BraceStmt] { ... } # 26| getElement(0): [TryExpr] try ... @@ -6796,6 +6860,9 @@ statements.swift: # 26| getArgument(0): [Argument] : 11 # 26| getExpr(): [IntegerLiteralExpr] 11 # 27| getCatch(0): [CaseStmt] case ... +# 27| getLabel(0): [CaseLabelItem] ... is ... +# 27| getPattern(): [IsPattern] ... is ... +# 27| getSubPattern(): [EnumElementPattern] .failed # 27| getBody(): [BraceStmt] { ... } # 28| getElement(0): [CallExpr] call to print(_:separator:terminator:) # 28| getFunction(): [DeclRefExpr] print(_:separator:terminator:) @@ -6808,10 +6875,12 @@ statements.swift: # 28| getExpr(): [DefaultArgumentExpr] default separator # 28| getArgument(2): [Argument] terminator: default terminator # 28| getExpr(): [DefaultArgumentExpr] default terminator -# 27| getLabel(0): [CaseLabelItem] ... is ... -# 27| getPattern(): [IsPattern] ... is ... -# 27| getSubPattern(): [EnumElementPattern] .failed # 29| getCatch(1): [CaseStmt] case ... +# 29| getLabel(0): [CaseLabelItem] error +# 29| getPattern(): [NamedPattern] error +# 29| getPattern().getFullyUnresolved(): [BindingPattern] let ... +# 29| getVariable(0): [ConcreteVarDecl] error +# 29| Type = Error # 29| getBody(): [BraceStmt] { ... } # 30| getElement(0): [CallExpr] call to print(_:separator:terminator:) # 30| getFunction(): [DeclRefExpr] print(_:separator:terminator:) @@ -6824,17 +6893,10 @@ statements.swift: # 30| getExpr(): [DefaultArgumentExpr] default separator # 30| getArgument(2): [Argument] terminator: default terminator # 30| getExpr(): [DefaultArgumentExpr] default terminator -# 29| getLabel(0): [CaseLabelItem] error -# 29| getPattern(): [NamedPattern] error -# 29| getPattern().getFullyUnresolved(): [BindingPattern] let ... # 2| [ConcreteVarDecl] i # 2| Type = Int # 2| [ConcreteVarDecl] $i$generator # 2| Type = IndexingIterator> -# 21| [ConcreteVarDecl] error -# 21| Type = Error -# 29| [ConcreteVarDecl] error -# 29| Type = Error # 34| [EnumDecl] AnError # 35| getMember(0): [EnumCaseDecl] case ... # 35| getMember(1): [EnumElementDecl] failed @@ -6853,24 +6915,24 @@ statements.swift: #-----| getElement(1): [SwitchStmt] switch a { ... } #-----| getExpr(): [DeclRefExpr] a #-----| getCase(0): [CaseStmt] case ... +#-----| getLabel(0): [CaseLabelItem] .failed +#-----| getPattern(): [EnumElementPattern] .failed #-----| getBody(): [BraceStmt] { ... } #-----| getElement(0): [AssignExpr] ... = ... #-----| getDest(): [DeclRefExpr] index_a #-----| getSource(): [IntegerLiteralExpr] 0 -#-----| getLabel(0): [CaseLabelItem] .failed -#-----| getPattern(): [EnumElementPattern] .failed #-----| getElement(2): [PatternBindingDecl] var ... = ... #-----| getPattern(0): [TypedPattern] ... as ... #-----| getSubPattern(): [NamedPattern] index_b #-----| getElement(3): [SwitchStmt] switch b { ... } #-----| getExpr(): [DeclRefExpr] b #-----| getCase(0): [CaseStmt] case ... +#-----| getLabel(0): [CaseLabelItem] .failed +#-----| getPattern(): [EnumElementPattern] .failed #-----| getBody(): [BraceStmt] { ... } #-----| getElement(0): [AssignExpr] ... = ... #-----| getDest(): [DeclRefExpr] index_b #-----| getSource(): [IntegerLiteralExpr] 0 -#-----| getLabel(0): [CaseLabelItem] .failed -#-----| getPattern(): [EnumElementPattern] .failed #-----| getElement(4): [ReturnStmt] return ... #-----| getResult(): [BinaryExpr] ... .==(_:_:) ... #-----| getFunction(): [MethodLookupExpr] .==(_:_:) @@ -6908,12 +6970,12 @@ statements.swift: #-----| getElement(1): [SwitchStmt] switch self { ... } #-----| getExpr(): [DeclRefExpr] self #-----| getCase(0): [CaseStmt] case ... +#-----| getLabel(0): [CaseLabelItem] .failed +#-----| getPattern(): [EnumElementPattern] .failed #-----| getBody(): [BraceStmt] { ... } #-----| getElement(0): [AssignExpr] ... = ... #-----| getDest(): [DeclRefExpr] discriminator #-----| getSource(): [IntegerLiteralExpr] 0 -#-----| getLabel(0): [CaseLabelItem] .failed -#-----| getPattern(): [EnumElementPattern] .failed #-----| getElement(2): [CallExpr] call to combine(_:) #-----| getFunction(): [MethodLookupExpr] .combine(_:) #-----| getBase(): [DeclRefExpr] hasher @@ -6988,6 +7050,14 @@ statements.swift: # 53| getElement(0): [SwitchStmt] switch index { ... } # 53| getExpr(): [DeclRefExpr] index # 54| getCase(0): [CaseStmt] case ... +# 54| getLabel(0): [CaseLabelItem] =~ ... +# 54| getPattern(): [ExprPattern] =~ ... +# 54| getSubExpr(): [BinaryExpr] ... ~=(_:_:) ... +# 54| getFunction(): [DeclRefExpr] ~=(_:_:) +# 54| getArgument(0): [Argument] : 1 +# 54| getExpr(): [IntegerLiteralExpr] 1 +# 54| getArgument(1): [Argument] : $match +# 54| getExpr(): [DeclRefExpr] $match # 55| getBody(): [BraceStmt] { ... } # 55| getElement(0): [CallExpr] call to print(_:separator:terminator:) # 55| getFunction(): [DeclRefExpr] print(_:separator:terminator:) @@ -7001,28 +7071,7 @@ statements.swift: # 55| getArgument(2): [Argument] terminator: default terminator # 55| getExpr(): [DefaultArgumentExpr] default terminator # 56| getElement(1): [FallthroughStmt] fallthrough -# 54| getLabel(0): [CaseLabelItem] =~ ... -# 54| getPattern(): [ExprPattern] =~ ... -# 54| getSubExpr(): [BinaryExpr] ... ~=(_:_:) ... -# 54| getFunction(): [DeclRefExpr] ~=(_:_:) -# 54| getArgument(0): [Argument] : 1 -# 54| getExpr(): [IntegerLiteralExpr] 1 -# 54| getArgument(1): [Argument] : $match -# 54| getExpr(): [DeclRefExpr] $match # 57| getCase(1): [CaseStmt] case ... -# 58| getBody(): [BraceStmt] { ... } -# 58| getElement(0): [CallExpr] call to print(_:separator:terminator:) -# 58| getFunction(): [DeclRefExpr] print(_:separator:terminator:) -# 58| getArgument(0): [Argument] : [...] -# 58| getExpr(): [VarargExpansionExpr] [...] -# 58| getSubExpr(): [ArrayExpr] [...] -# 58| getElement(0): [StringLiteralExpr] 5, 10 -# 58| getElement(0).getFullyConverted(): [ErasureExpr] (Any) ... -# 58| getArgument(1): [Argument] separator: default separator -# 58| getExpr(): [DefaultArgumentExpr] default separator -# 58| getArgument(2): [Argument] terminator: default terminator -# 58| getExpr(): [DefaultArgumentExpr] default terminator -# 59| getElement(1): [BreakStmt] break # 57| getLabel(0): [CaseLabelItem] =~ ... # 57| getPattern(): [ExprPattern] =~ ... # 57| getSubExpr(): [BinaryExpr] ... ~=(_:_:) ... @@ -7039,7 +7088,22 @@ statements.swift: # 57| getExpr(): [IntegerLiteralExpr] 10 # 57| getArgument(1): [Argument] : $match # 57| getExpr(): [DeclRefExpr] $match +# 58| getBody(): [BraceStmt] { ... } +# 58| getElement(0): [CallExpr] call to print(_:separator:terminator:) +# 58| getFunction(): [DeclRefExpr] print(_:separator:terminator:) +# 58| getArgument(0): [Argument] : [...] +# 58| getExpr(): [VarargExpansionExpr] [...] +# 58| getSubExpr(): [ArrayExpr] [...] +# 58| getElement(0): [StringLiteralExpr] 5, 10 +# 58| getElement(0).getFullyConverted(): [ErasureExpr] (Any) ... +# 58| getArgument(1): [Argument] separator: default separator +# 58| getExpr(): [DefaultArgumentExpr] default separator +# 58| getArgument(2): [Argument] terminator: default terminator +# 58| getExpr(): [DefaultArgumentExpr] default terminator +# 59| getElement(1): [BreakStmt] break # 60| getCase(2): [CaseStmt] case ... +# 60| getLabel(0): [CaseLabelItem] _ +# 60| getPattern(): [AnyPattern] _ # 61| getBody(): [BraceStmt] { ... } # 61| getElement(0): [CallExpr] call to print(_:separator:terminator:) # 61| getFunction(): [DeclRefExpr] print(_:separator:terminator:) @@ -7052,8 +7116,6 @@ statements.swift: # 61| getExpr(): [DefaultArgumentExpr] default separator # 61| getArgument(2): [Argument] terminator: default terminator # 61| getExpr(): [DefaultArgumentExpr] default terminator -# 60| getLabel(0): [CaseLabelItem] _ -# 60| getPattern(): [AnyPattern] _ # 54| [ConcreteVarDecl] $match # 54| Type = Int # 57| [ConcreteVarDecl] $match @@ -7080,6 +7142,8 @@ statements.swift: # 65| getPattern().getFullyUnresolved(): [BindingPattern] let ... # 65| getInitializer(): [DeclRefExpr] x # 65| getThen(): [BraceStmt] { ... } +# 65| [ConcreteVarDecl] xx +# 65| Type = Int # 67| [TopLevelCodeDecl] { ... } # 67| getBody(): [BraceStmt] { ... } # 67| getElement(0): [IfStmt] if ... then { ... } diff --git a/swift/schema.py b/swift/schema.py index 2af9af439210..c90855726471 100644 --- a/swift/schema.py +++ b/swift/schema.py @@ -868,7 +868,7 @@ class IsPattern(Pattern): sub_pattern: optional[Pattern] | child class NamedPattern(Pattern): - name: string + var_decl: VarDecl class OptionalSomePattern(Pattern): sub_pattern: Pattern | child @@ -884,6 +884,7 @@ class TypedPattern(Pattern): type_repr: optional["TypeRepr"] | child @group("stmt") +@qltest.test_with("SwitchStmt") class CaseLabelItem(AstNode): pattern: Pattern | child guard: optional[Expr] | child @@ -948,10 +949,11 @@ class BreakStmt(Stmt): target_name: optional[string] target: optional[Stmt] +@qltest.test_with("SwitchStmt") class CaseStmt(Stmt): - body: Stmt | child labels: list[CaseLabelItem] | child - variables: list[VarDecl] + variables: list[VarDecl] | child + body: Stmt | child class ContinueStmt(Stmt): target_name: optional[string] From 2f0ee125844f80a918d860b37b7c1648a24c44db Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Mon, 23 Oct 2023 17:33:03 +0200 Subject: [PATCH 2/7] Swift: fix `patterns/bound_and_unbound.ql` test --- .../patterns/bound_and_unbound.expected | 6 ++---- .../extractor-tests/patterns/bound_and_unbound.ql | 12 +++--------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/swift/ql/test/extractor-tests/patterns/bound_and_unbound.expected b/swift/ql/test/extractor-tests/patterns/bound_and_unbound.expected index 80ae00d4850e..63e67600f7ee 100644 --- a/swift/ql/test/extractor-tests/patterns/bound_and_unbound.expected +++ b/swift/ql/test/extractor-tests/patterns/bound_and_unbound.expected @@ -1,4 +1,3 @@ -bound | patterns.swift:2:9:2:9 | an_int | | patterns.swift:3:9:3:9 | a_string | | patterns.swift:4:10:4:10 | x | @@ -19,8 +18,10 @@ bound | patterns.swift:55:16:55:16 | b | | patterns.swift:55:23:55:23 | c | | patterns.swift:57:13:57:13 | a | +| patterns.swift:57:16:57:16 | b | | patterns.swift:57:19:57:19 | c | | patterns.swift:58:21:58:21 | b | +| patterns.swift:58:28:58:28 | c | | patterns.swift:62:18:62:18 | c | | patterns.swift:78:9:78:9 | a | | patterns.swift:83:24:83:24 | a | @@ -61,6 +62,3 @@ bound | patterns.swift:174:38:174:38 | c | | patterns.swift:174:49:174:49 | d | | patterns.swift:174:52:174:52 | e | -unbound -| patterns.swift:57:16:57:16 | b | -| patterns.swift:58:28:58:28 | c | diff --git a/swift/ql/test/extractor-tests/patterns/bound_and_unbound.ql b/swift/ql/test/extractor-tests/patterns/bound_and_unbound.ql index 192938fea66f..742fbdf2d9c3 100644 --- a/swift/ql/test/extractor-tests/patterns/bound_and_unbound.ql +++ b/swift/ql/test/extractor-tests/patterns/bound_and_unbound.ql @@ -1,11 +1,5 @@ import swift -query predicate bound(NamedPattern p) { - p.getFile().getBaseName() = "patterns.swift" and - p.hasVarDecl() -} - -query predicate unbound(NamedPattern p) { - p.getFile().getBaseName() = "patterns.swift" and - not p.hasVarDecl() -} +from NamedPattern p +where p.getFile().getBaseName() = "patterns.swift" +select p From 91969393841b79f88132a4ef97a5987161d5821e Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Wed, 25 Oct 2023 10:38:17 +0200 Subject: [PATCH 3/7] Swift: canonicalize all `VarDecl`s --- swift/extractor/infra/SwiftDispatcher.h | 6 ++++++ swift/extractor/translators/StmtTranslator.cpp | 10 +--------- .../decl/ConcreteVarDecl/ConcreteVarDecl.expected | 1 - .../ConcreteVarDecl_getParentPattern.expected | 1 - 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/swift/extractor/infra/SwiftDispatcher.h b/swift/extractor/infra/SwiftDispatcher.h index c76ba31fad56..f6705a00b802 100644 --- a/swift/extractor/infra/SwiftDispatcher.h +++ b/swift/extractor/infra/SwiftDispatcher.h @@ -138,6 +138,12 @@ class SwiftDispatcher { // this will be treated on emission return undefined_label; } + if constexpr (std::derived_from) { + // canonicalize all VarDecls. For details, see doc of getCanonicalVarDecl + if (auto var = llvm::dyn_cast(e)) { + e = var->getCanonicalVarDecl(); + } + } auto& stored = store[e]; if (!stored.valid()) { auto inserted = fetching.insert(e); diff --git a/swift/extractor/translators/StmtTranslator.cpp b/swift/extractor/translators/StmtTranslator.cpp index f58a8c37d61d..5742db68a3e2 100644 --- a/swift/extractor/translators/StmtTranslator.cpp +++ b/swift/extractor/translators/StmtTranslator.cpp @@ -136,15 +136,7 @@ codeql::CaseStmt StmtTranslator::translateCaseStmt(const swift::CaseStmt& stmt) auto labels = stmt.getCaseLabelItems(); entry.body = dispatcher.fetchLabel(stmt.getBody()); entry.labels = dispatcher.fetchRepeatedLabels(labels); - // we don't use stmt.getCaseBodyVariables() because it's actually filled with copies of the - // variable declarations, which would lead to duplicate `DeclVar` entities. - // Instead we follow the same logic that's used to fill getCaseBodyVariables, looking at the first - // pattern and collecting variables from it. See - // https://github.com/apple/swift/blob/71fff6649b3ce57cc22954f141cf8b567be6de88/lib/Parse/ParseStmt.cpp#L2210 - if (!labels.empty() && labels.front().getPattern()) { - labels.front().getPattern()->forEachVariable( - [&](const swift::VarDecl* var) { entry.variables.push_back(dispatcher.fetchLabel(var)); }); - } + entry.variables = dispatcher.fetchRepeatedLabels(stmt.getCaseBodyVariablesOrEmptyArray()); return entry; } diff --git a/swift/ql/test/extractor-tests/generated/decl/ConcreteVarDecl/ConcreteVarDecl.expected b/swift/ql/test/extractor-tests/generated/decl/ConcreteVarDecl/ConcreteVarDecl.expected index 803a4eadf4ee..9e05b623dd76 100644 --- a/swift/ql/test/extractor-tests/generated/decl/ConcreteVarDecl/ConcreteVarDecl.expected +++ b/swift/ql/test/extractor-tests/generated/decl/ConcreteVarDecl/ConcreteVarDecl.expected @@ -23,7 +23,6 @@ | var_decls.swift:57:36:57:36 | _w4 | getModule: | file://:0:0:0:0 | var_decls | getNumberOfMembers: | 0 | getInterfaceType: | WrapperWithProjectedAndInit | getNumberOfAccessors: | 0 | getName: | _w4 | getType: | WrapperWithProjectedAndInit | hasAttachedPropertyWrapperType: | no | hasParentPattern: | yes | hasParentInitializer: | yes | hasPropertyWrapperBackingVarBinding: | no | hasPropertyWrapperBackingVar: | no | hasPropertyWrapperProjectionVarBinding: | no | hasPropertyWrapperProjectionVar: | no | getIntroducerInt: | 1 | | var_decls.swift:57:36:57:36 | w4 | getModule: | file://:0:0:0:0 | var_decls | getNumberOfMembers: | 0 | getInterfaceType: | Int | getNumberOfAccessors: | 2 | getName: | w4 | getType: | Int | hasAttachedPropertyWrapperType: | yes | hasParentPattern: | yes | hasParentInitializer: | yes | hasPropertyWrapperBackingVarBinding: | yes | hasPropertyWrapperBackingVar: | yes | hasPropertyWrapperProjectionVarBinding: | yes | hasPropertyWrapperProjectionVar: | yes | getIntroducerInt: | 1 | | var_decls.swift:65:19:65:19 | case_variable | getModule: | file://:0:0:0:0 | var_decls | getNumberOfMembers: | 0 | getInterfaceType: | Int | getNumberOfAccessors: | 0 | getName: | case_variable | getType: | Int | hasAttachedPropertyWrapperType: | no | hasParentPattern: | yes | hasParentInitializer: | no | hasPropertyWrapperBackingVarBinding: | no | hasPropertyWrapperBackingVar: | no | hasPropertyWrapperProjectionVarBinding: | no | hasPropertyWrapperProjectionVar: | no | getIntroducerInt: | 0 | -| var_decls.swift:65:19:65:19 | case_variable | getModule: | file://:0:0:0:0 | var_decls | getNumberOfMembers: | 0 | getInterfaceType: | Int | getNumberOfAccessors: | 0 | getName: | case_variable | getType: | Int | hasAttachedPropertyWrapperType: | no | hasParentPattern: | yes | hasParentInitializer: | no | hasPropertyWrapperBackingVarBinding: | no | hasPropertyWrapperBackingVar: | no | hasPropertyWrapperProjectionVarBinding: | no | hasPropertyWrapperProjectionVar: | no | getIntroducerInt: | 0 | | var_decls.swift:65:34:65:34 | $match | getModule: | file://:0:0:0:0 | var_decls | getNumberOfMembers: | 0 | getInterfaceType: | Int | getNumberOfAccessors: | 0 | getName: | $match | getType: | Int | hasAttachedPropertyWrapperType: | no | hasParentPattern: | no | hasParentInitializer: | no | hasPropertyWrapperBackingVarBinding: | no | hasPropertyWrapperBackingVar: | no | hasPropertyWrapperProjectionVarBinding: | no | hasPropertyWrapperProjectionVar: | no | getIntroducerInt: | 0 | | var_decls.swift:67:15:67:15 | $match | getModule: | file://:0:0:0:0 | var_decls | getNumberOfMembers: | 0 | getInterfaceType: | Int | getNumberOfAccessors: | 0 | getName: | $match | getType: | Int | hasAttachedPropertyWrapperType: | no | hasParentPattern: | no | hasParentInitializer: | no | hasPropertyWrapperBackingVarBinding: | no | hasPropertyWrapperBackingVar: | no | hasPropertyWrapperProjectionVarBinding: | no | hasPropertyWrapperProjectionVar: | no | getIntroducerInt: | 0 | | var_decls.swift:67:22:67:22 | unused_case_variable | getModule: | file://:0:0:0:0 | var_decls | getNumberOfMembers: | 0 | getInterfaceType: | Int | getNumberOfAccessors: | 0 | getName: | unused_case_variable | getType: | Int | hasAttachedPropertyWrapperType: | no | hasParentPattern: | yes | hasParentInitializer: | no | hasPropertyWrapperBackingVarBinding: | no | hasPropertyWrapperBackingVar: | no | hasPropertyWrapperProjectionVarBinding: | no | hasPropertyWrapperProjectionVar: | no | getIntroducerInt: | 0 | diff --git a/swift/ql/test/extractor-tests/generated/decl/ConcreteVarDecl/ConcreteVarDecl_getParentPattern.expected b/swift/ql/test/extractor-tests/generated/decl/ConcreteVarDecl/ConcreteVarDecl_getParentPattern.expected index ba75564602f1..e59322e36c1b 100644 --- a/swift/ql/test/extractor-tests/generated/decl/ConcreteVarDecl/ConcreteVarDecl_getParentPattern.expected +++ b/swift/ql/test/extractor-tests/generated/decl/ConcreteVarDecl/ConcreteVarDecl_getParentPattern.expected @@ -23,5 +23,4 @@ | var_decls.swift:57:36:57:36 | _w4 | var_decls.swift:57:36:57:36 | ... as ... | | var_decls.swift:57:36:57:36 | w4 | var_decls.swift:57:36:57:36 | w4 | | var_decls.swift:65:19:65:19 | case_variable | var_decls.swift:65:8:65:35 | .value(...) | -| var_decls.swift:65:19:65:19 | case_variable | var_decls.swift:65:8:65:35 | .value(...) | | var_decls.swift:67:22:67:22 | unused_case_variable | var_decls.swift:67:8:67:42 | .value(...) | From a245d0019ead01b5d6cd78eaf453374f52a20154 Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Wed, 25 Oct 2023 10:56:21 +0200 Subject: [PATCH 4/7] Swift: tiny cosmetic tweak --- swift/extractor/translators/StmtTranslator.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/swift/extractor/translators/StmtTranslator.cpp b/swift/extractor/translators/StmtTranslator.cpp index 5742db68a3e2..1d4466e79a2b 100644 --- a/swift/extractor/translators/StmtTranslator.cpp +++ b/swift/extractor/translators/StmtTranslator.cpp @@ -133,9 +133,8 @@ codeql::DoCatchStmt StmtTranslator::translateDoCatchStmt(const swift::DoCatchStm codeql::CaseStmt StmtTranslator::translateCaseStmt(const swift::CaseStmt& stmt) { auto entry = dispatcher.createEntry(stmt); - auto labels = stmt.getCaseLabelItems(); entry.body = dispatcher.fetchLabel(stmt.getBody()); - entry.labels = dispatcher.fetchRepeatedLabels(labels); + entry.labels = dispatcher.fetchRepeatedLabels(stmt.getCaseLabelItems()); entry.variables = dispatcher.fetchRepeatedLabels(stmt.getCaseBodyVariablesOrEmptyArray()); return entry; } From fb470e41409dc2dd87eb0089f51838f26f4ca95d Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Wed, 25 Oct 2023 12:14:44 +0200 Subject: [PATCH 5/7] Swift: remove useless commented-out line --- swift/extractor/translators/StmtTranslator.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/swift/extractor/translators/StmtTranslator.cpp b/swift/extractor/translators/StmtTranslator.cpp index 1d4466e79a2b..0afb1a551a66 100644 --- a/swift/extractor/translators/StmtTranslator.cpp +++ b/swift/extractor/translators/StmtTranslator.cpp @@ -73,7 +73,6 @@ codeql::ForEachStmt StmtTranslator::translateForEachStmt(const swift::ForEachStm auto entry = dispatcher.createEntry(stmt); fillLabeledStmt(stmt, entry); entry.body = dispatcher.fetchLabel(stmt.getBody()); - // entry.sequence = dispatcher.fetchLabel(stmt.getTypeCheckedSequence()); entry.pattern = dispatcher.fetchLabel(stmt.getPattern()); entry.iteratorVar = dispatcher.fetchLabel(stmt.getIteratorVar()); entry.where = dispatcher.fetchOptionalLabel(stmt.getWhere()); From 6538a7645d15c2fc92502dacd8738961ffd48b97 Mon Sep 17 00:00:00 2001 From: Mathias Vorreiter Pedersen Date: Fri, 27 Oct 2023 15:48:38 +0100 Subject: [PATCH 6/7] Swift: Add up and downgrade scripts. --- .../named_patterns.ql | 16 + .../old.dbscheme | 2636 +++++++++++++++++ .../swift.dbscheme | 2636 +++++++++++++++++ .../upgrade.properties | 4 + .../named_patterns.ql | 43 + .../old.dbscheme | 2636 +++++++++++++++++ .../swift.dbscheme | 2636 +++++++++++++++++ .../upgrade.properties | 4 + .../old.dbscheme | 0 .../swift.dbscheme | 2636 +++++++++++++++++ .../upgrade.properties | 2 + 11 files changed, 13249 insertions(+) create mode 100644 swift/downgrades/7c17e1f4b2d30f2da05bfa667c621ddd418eb151/named_patterns.ql create mode 100644 swift/downgrades/7c17e1f4b2d30f2da05bfa667c621ddd418eb151/old.dbscheme create mode 100644 swift/downgrades/7c17e1f4b2d30f2da05bfa667c621ddd418eb151/swift.dbscheme create mode 100644 swift/downgrades/7c17e1f4b2d30f2da05bfa667c621ddd418eb151/upgrade.properties create mode 100644 swift/ql/lib/upgrades/c0db61944f46ba5507f207ec2b1cff77ad0529a1/named_patterns.ql create mode 100644 swift/ql/lib/upgrades/c0db61944f46ba5507f207ec2b1cff77ad0529a1/old.dbscheme create mode 100644 swift/ql/lib/upgrades/c0db61944f46ba5507f207ec2b1cff77ad0529a1/swift.dbscheme create mode 100644 swift/ql/lib/upgrades/c0db61944f46ba5507f207ec2b1cff77ad0529a1/upgrade.properties create mode 100644 swift/ql/lib/upgrades/e69de29bb2d1d6434b8b29ae775ad8c2e48c5391/old.dbscheme create mode 100644 swift/ql/lib/upgrades/e69de29bb2d1d6434b8b29ae775ad8c2e48c5391/swift.dbscheme create mode 100644 swift/ql/lib/upgrades/e69de29bb2d1d6434b8b29ae775ad8c2e48c5391/upgrade.properties diff --git a/swift/downgrades/7c17e1f4b2d30f2da05bfa667c621ddd418eb151/named_patterns.ql b/swift/downgrades/7c17e1f4b2d30f2da05bfa667c621ddd418eb151/named_patterns.ql new file mode 100644 index 000000000000..ee35d896d807 --- /dev/null +++ b/swift/downgrades/7c17e1f4b2d30f2da05bfa667c621ddd418eb151/named_patterns.ql @@ -0,0 +1,16 @@ +// Change the second column in named_patterns from a @var_decl to a string +class NamedPattern extends @named_pattern { + VarDecl getVarDecl() { named_patterns(this, result) } + + string toString() { none() } +} + +class VarDecl extends @var_decl { + string getName() { var_decls(this, result, _) } + + string toString() { none() } +} + +from NamedPattern np, VarDecl d, string name +where d = np.getVarDecl() and name = d.getName() +select np, name diff --git a/swift/downgrades/7c17e1f4b2d30f2da05bfa667c621ddd418eb151/old.dbscheme b/swift/downgrades/7c17e1f4b2d30f2da05bfa667c621ddd418eb151/old.dbscheme new file mode 100644 index 000000000000..7c17e1f4b2d3 --- /dev/null +++ b/swift/downgrades/7c17e1f4b2d30f2da05bfa667c621ddd418eb151/old.dbscheme @@ -0,0 +1,2636 @@ +// generated by codegen/codegen.py + +// from prefix.dbscheme +/** + * The source location of the snapshot. + */ +sourceLocationPrefix( + string prefix: string ref +); + + +// from schema.py + +@element = + @callable +| @file +| @generic_context +| @locatable +| @location +| @type +; + +#keyset[id] +element_is_unknown( + int id: @element ref +); + +@callable = + @closure_expr +| @function +; + +#keyset[id] +callable_names( + int id: @callable ref, + string name: string ref +); + +#keyset[id] +callable_self_params( + int id: @callable ref, + int self_param: @param_decl_or_none ref +); + +#keyset[id, index] +callable_params( + int id: @callable ref, + int index: int ref, + int param: @param_decl_or_none ref +); + +#keyset[id] +callable_bodies( + int id: @callable ref, + int body: @brace_stmt_or_none ref +); + +#keyset[id, index] +callable_captures( + int id: @callable ref, + int index: int ref, + int capture: @captured_decl_or_none ref +); + +@file = + @db_file +; + +#keyset[id] +files( + int id: @file ref, + string name: string ref +); + +#keyset[id] +file_is_successfully_extracted( + int id: @file ref +); + +@locatable = + @argument +| @ast_node +| @comment +| @diagnostics +| @error_element +; + +#keyset[id] +locatable_locations( + int id: @locatable ref, + int location: @location_or_none ref +); + +@location = + @db_location +; + +#keyset[id] +locations( + int id: @location ref, + int file: @file_or_none ref, + int start_line: int ref, + int start_column: int ref, + int end_line: int ref, + int end_column: int ref +); + +@ast_node = + @availability_info +| @availability_spec +| @case_label_item +| @condition_element +| @decl +| @expr +| @key_path_component +| @pattern +| @stmt +| @stmt_condition +| @type_repr +; + +comments( + unique int id: @comment, + string text: string ref +); + +db_files( + unique int id: @db_file +); + +db_locations( + unique int id: @db_location +); + +diagnostics( + unique int id: @diagnostics, + string text: string ref, + int kind: int ref +); + +@error_element = + @error_expr +| @error_type +| @overloaded_decl_ref_expr +| @unresolved_decl_ref_expr +| @unresolved_dot_expr +| @unresolved_member_chain_result_expr +| @unresolved_member_expr +| @unresolved_pattern_expr +| @unresolved_specialize_expr +| @unresolved_type +| @unresolved_type_conversion_expr +| @unspecified_element +; + +availability_infos( + unique int id: @availability_info +); + +#keyset[id] +availability_info_is_unavailable( + int id: @availability_info ref +); + +#keyset[id, index] +availability_info_specs( + int id: @availability_info ref, + int index: int ref, + int spec: @availability_spec_or_none ref +); + +@availability_spec = + @other_availability_spec +| @platform_version_availability_spec +; + +key_path_components( + unique int id: @key_path_component, + int kind: int ref, + int component_type: @type_or_none ref +); + +#keyset[id, index] +key_path_component_subscript_arguments( + int id: @key_path_component ref, + int index: int ref, + int subscript_argument: @argument_or_none ref +); + +#keyset[id] +key_path_component_tuple_indices( + int id: @key_path_component ref, + int tuple_index: int ref +); + +#keyset[id] +key_path_component_decl_refs( + int id: @key_path_component ref, + int decl_ref: @value_decl_or_none ref +); + +unspecified_elements( + unique int id: @unspecified_element, + string property: string ref, + string error: string ref +); + +#keyset[id] +unspecified_element_parents( + int id: @unspecified_element ref, + int parent: @element ref +); + +#keyset[id] +unspecified_element_indices( + int id: @unspecified_element ref, + int index: int ref +); + +#keyset[id, index] +unspecified_element_children( + int id: @unspecified_element ref, + int index: int ref, + int child: @ast_node_or_none ref +); + +other_availability_specs( + unique int id: @other_availability_spec +); + +platform_version_availability_specs( + unique int id: @platform_version_availability_spec, + string platform: string ref, + string version: string ref +); + +@decl = + @captured_decl +| @enum_case_decl +| @extension_decl +| @if_config_decl +| @import_decl +| @missing_member_decl +| @operator_decl +| @pattern_binding_decl +| @pound_diagnostic_decl +| @precedence_group_decl +| @top_level_code_decl +| @value_decl +; + +#keyset[id] +decls( //dir=decl + int id: @decl ref, + int module: @module_decl_or_none ref +); + +#keyset[id, index] +decl_members( //dir=decl + int id: @decl ref, + int index: int ref, + int member: @decl_or_none ref +); + +@generic_context = + @extension_decl +| @function +| @generic_type_decl +| @subscript_decl +; + +#keyset[id, index] +generic_context_generic_type_params( //dir=decl + int id: @generic_context ref, + int index: int ref, + int generic_type_param: @generic_type_param_decl_or_none ref +); + +captured_decls( //dir=decl + unique int id: @captured_decl, + int decl: @value_decl_or_none ref +); + +#keyset[id] +captured_decl_is_direct( //dir=decl + int id: @captured_decl ref +); + +#keyset[id] +captured_decl_is_escaping( //dir=decl + int id: @captured_decl ref +); + +enum_case_decls( //dir=decl + unique int id: @enum_case_decl +); + +#keyset[id, index] +enum_case_decl_elements( //dir=decl + int id: @enum_case_decl ref, + int index: int ref, + int element: @enum_element_decl_or_none ref +); + +extension_decls( //dir=decl + unique int id: @extension_decl, + int extended_type_decl: @nominal_type_decl_or_none ref +); + +#keyset[id, index] +extension_decl_protocols( //dir=decl + int id: @extension_decl ref, + int index: int ref, + int protocol: @protocol_decl_or_none ref +); + +if_config_decls( //dir=decl + unique int id: @if_config_decl +); + +#keyset[id, index] +if_config_decl_active_elements( //dir=decl + int id: @if_config_decl ref, + int index: int ref, + int active_element: @ast_node_or_none ref +); + +import_decls( //dir=decl + unique int id: @import_decl +); + +#keyset[id] +import_decl_is_exported( //dir=decl + int id: @import_decl ref +); + +#keyset[id] +import_decl_imported_modules( //dir=decl + int id: @import_decl ref, + int imported_module: @module_decl_or_none ref +); + +#keyset[id, index] +import_decl_declarations( //dir=decl + int id: @import_decl ref, + int index: int ref, + int declaration: @value_decl_or_none ref +); + +missing_member_decls( //dir=decl + unique int id: @missing_member_decl, + string name: string ref +); + +@operator_decl = + @infix_operator_decl +| @postfix_operator_decl +| @prefix_operator_decl +; + +#keyset[id] +operator_decls( //dir=decl + int id: @operator_decl ref, + string name: string ref +); + +pattern_binding_decls( //dir=decl + unique int id: @pattern_binding_decl +); + +#keyset[id, index] +pattern_binding_decl_inits( //dir=decl + int id: @pattern_binding_decl ref, + int index: int ref, + int init: @expr_or_none ref +); + +#keyset[id, index] +pattern_binding_decl_patterns( //dir=decl + int id: @pattern_binding_decl ref, + int index: int ref, + int pattern: @pattern_or_none ref +); + +pound_diagnostic_decls( //dir=decl + unique int id: @pound_diagnostic_decl, + int kind: int ref, + int message: @string_literal_expr_or_none ref +); + +precedence_group_decls( //dir=decl + unique int id: @precedence_group_decl +); + +top_level_code_decls( //dir=decl + unique int id: @top_level_code_decl, + int body: @brace_stmt_or_none ref +); + +@value_decl = + @abstract_storage_decl +| @enum_element_decl +| @function +| @type_decl +; + +#keyset[id] +value_decls( //dir=decl + int id: @value_decl ref, + int interface_type: @type_or_none ref +); + +@abstract_storage_decl = + @subscript_decl +| @var_decl +; + +#keyset[id, index] +abstract_storage_decl_accessors( //dir=decl + int id: @abstract_storage_decl ref, + int index: int ref, + int accessor: @accessor_or_none ref +); + +enum_element_decls( //dir=decl + unique int id: @enum_element_decl, + string name: string ref +); + +#keyset[id, index] +enum_element_decl_params( //dir=decl + int id: @enum_element_decl ref, + int index: int ref, + int param: @param_decl_or_none ref +); + +@function = + @accessor_or_named_function +| @deinitializer +| @initializer +; + +infix_operator_decls( //dir=decl + unique int id: @infix_operator_decl +); + +#keyset[id] +infix_operator_decl_precedence_groups( //dir=decl + int id: @infix_operator_decl ref, + int precedence_group: @precedence_group_decl_or_none ref +); + +postfix_operator_decls( //dir=decl + unique int id: @postfix_operator_decl +); + +prefix_operator_decls( //dir=decl + unique int id: @prefix_operator_decl +); + +@type_decl = + @abstract_type_param_decl +| @generic_type_decl +| @module_decl +; + +#keyset[id] +type_decls( //dir=decl + int id: @type_decl ref, + string name: string ref +); + +#keyset[id, index] +type_decl_inherited_types( //dir=decl + int id: @type_decl ref, + int index: int ref, + int inherited_type: @type_or_none ref +); + +@abstract_type_param_decl = + @associated_type_decl +| @generic_type_param_decl +; + +@accessor_or_named_function = + @accessor +| @named_function +; + +deinitializers( //dir=decl + unique int id: @deinitializer +); + +@generic_type_decl = + @nominal_type_decl +| @opaque_type_decl +| @type_alias_decl +; + +initializers( //dir=decl + unique int id: @initializer +); + +module_decls( //dir=decl + unique int id: @module_decl +); + +#keyset[id] +module_decl_is_builtin_module( //dir=decl + int id: @module_decl ref +); + +#keyset[id] +module_decl_is_system_module( //dir=decl + int id: @module_decl ref +); + +module_decl_imported_modules( //dir=decl + int id: @module_decl ref, + int imported_module: @module_decl_or_none ref +); + +module_decl_exported_modules( //dir=decl + int id: @module_decl ref, + int exported_module: @module_decl_or_none ref +); + +subscript_decls( //dir=decl + unique int id: @subscript_decl, + int element_type: @type_or_none ref +); + +#keyset[id, index] +subscript_decl_params( //dir=decl + int id: @subscript_decl ref, + int index: int ref, + int param: @param_decl_or_none ref +); + +@var_decl = + @concrete_var_decl +| @param_decl +; + +#keyset[id] +var_decls( //dir=decl + int id: @var_decl ref, + string name: string ref, + int type_: @type_or_none ref +); + +#keyset[id] +var_decl_attached_property_wrapper_types( //dir=decl + int id: @var_decl ref, + int attached_property_wrapper_type: @type_or_none ref +); + +#keyset[id] +var_decl_parent_patterns( //dir=decl + int id: @var_decl ref, + int parent_pattern: @pattern_or_none ref +); + +#keyset[id] +var_decl_parent_initializers( //dir=decl + int id: @var_decl ref, + int parent_initializer: @expr_or_none ref +); + +#keyset[id] +var_decl_property_wrapper_backing_var_bindings( //dir=decl + int id: @var_decl ref, + int property_wrapper_backing_var_binding: @pattern_binding_decl_or_none ref +); + +#keyset[id] +var_decl_property_wrapper_backing_vars( //dir=decl + int id: @var_decl ref, + int property_wrapper_backing_var: @var_decl_or_none ref +); + +#keyset[id] +var_decl_property_wrapper_projection_var_bindings( //dir=decl + int id: @var_decl ref, + int property_wrapper_projection_var_binding: @pattern_binding_decl_or_none ref +); + +#keyset[id] +var_decl_property_wrapper_projection_vars( //dir=decl + int id: @var_decl ref, + int property_wrapper_projection_var: @var_decl_or_none ref +); + +accessors( //dir=decl + unique int id: @accessor +); + +#keyset[id] +accessor_is_getter( //dir=decl + int id: @accessor ref +); + +#keyset[id] +accessor_is_setter( //dir=decl + int id: @accessor ref +); + +#keyset[id] +accessor_is_will_set( //dir=decl + int id: @accessor ref +); + +#keyset[id] +accessor_is_did_set( //dir=decl + int id: @accessor ref +); + +#keyset[id] +accessor_is_read( //dir=decl + int id: @accessor ref +); + +#keyset[id] +accessor_is_modify( //dir=decl + int id: @accessor ref +); + +#keyset[id] +accessor_is_unsafe_address( //dir=decl + int id: @accessor ref +); + +#keyset[id] +accessor_is_unsafe_mutable_address( //dir=decl + int id: @accessor ref +); + +associated_type_decls( //dir=decl + unique int id: @associated_type_decl +); + +concrete_var_decls( //dir=decl + unique int id: @concrete_var_decl, + int introducer_int: int ref +); + +generic_type_param_decls( //dir=decl + unique int id: @generic_type_param_decl +); + +named_functions( //dir=decl + unique int id: @named_function +); + +@nominal_type_decl = + @class_decl +| @enum_decl +| @protocol_decl +| @struct_decl +; + +#keyset[id] +nominal_type_decls( //dir=decl + int id: @nominal_type_decl ref, + int type_: @type_or_none ref +); + +opaque_type_decls( //dir=decl + unique int id: @opaque_type_decl, + int naming_declaration: @value_decl_or_none ref +); + +#keyset[id, index] +opaque_type_decl_opaque_generic_params( //dir=decl + int id: @opaque_type_decl ref, + int index: int ref, + int opaque_generic_param: @generic_type_param_type_or_none ref +); + +param_decls( //dir=decl + unique int id: @param_decl +); + +#keyset[id] +param_decl_is_inout( //dir=decl + int id: @param_decl ref +); + +#keyset[id] +param_decl_property_wrapper_local_wrapped_var_bindings( //dir=decl + int id: @param_decl ref, + int property_wrapper_local_wrapped_var_binding: @pattern_binding_decl_or_none ref +); + +#keyset[id] +param_decl_property_wrapper_local_wrapped_vars( //dir=decl + int id: @param_decl ref, + int property_wrapper_local_wrapped_var: @var_decl_or_none ref +); + +type_alias_decls( //dir=decl + unique int id: @type_alias_decl, + int aliased_type: @type_or_none ref +); + +class_decls( //dir=decl + unique int id: @class_decl +); + +enum_decls( //dir=decl + unique int id: @enum_decl +); + +protocol_decls( //dir=decl + unique int id: @protocol_decl +); + +struct_decls( //dir=decl + unique int id: @struct_decl +); + +arguments( //dir=expr + unique int id: @argument, + string label: string ref, + int expr: @expr_or_none ref +); + +@expr = + @any_try_expr +| @applied_property_wrapper_expr +| @apply_expr +| @assign_expr +| @bind_optional_expr +| @capture_list_expr +| @closure_expr +| @collection_expr +| @decl_ref_expr +| @default_argument_expr +| @discard_assignment_expr +| @dot_syntax_base_ignored_expr +| @dynamic_type_expr +| @enum_is_case_expr +| @error_expr +| @explicit_cast_expr +| @force_value_expr +| @identity_expr +| @if_expr +| @implicit_conversion_expr +| @in_out_expr +| @key_path_application_expr +| @key_path_dot_expr +| @key_path_expr +| @lazy_initialization_expr +| @literal_expr +| @lookup_expr +| @make_temporarily_escapable_expr +| @obj_c_selector_expr +| @one_way_expr +| @opaque_value_expr +| @open_existential_expr +| @optional_evaluation_expr +| @other_initializer_ref_expr +| @overloaded_decl_ref_expr +| @property_wrapper_value_placeholder_expr +| @rebind_self_in_initializer_expr +| @sequence_expr +| @super_ref_expr +| @tap_expr +| @tuple_element_expr +| @tuple_expr +| @type_expr +| @unresolved_decl_ref_expr +| @unresolved_dot_expr +| @unresolved_member_expr +| @unresolved_pattern_expr +| @unresolved_specialize_expr +| @vararg_expansion_expr +; + +#keyset[id] +expr_types( //dir=expr + int id: @expr ref, + int type_: @type_or_none ref +); + +@any_try_expr = + @force_try_expr +| @optional_try_expr +| @try_expr +; + +#keyset[id] +any_try_exprs( //dir=expr + int id: @any_try_expr ref, + int sub_expr: @expr_or_none ref +); + +applied_property_wrapper_exprs( //dir=expr + unique int id: @applied_property_wrapper_expr, + int kind: int ref, + int value: @expr_or_none ref, + int param: @param_decl_or_none ref +); + +@apply_expr = + @binary_expr +| @call_expr +| @postfix_unary_expr +| @prefix_unary_expr +| @self_apply_expr +; + +#keyset[id] +apply_exprs( //dir=expr + int id: @apply_expr ref, + int function: @expr_or_none ref +); + +#keyset[id, index] +apply_expr_arguments( //dir=expr + int id: @apply_expr ref, + int index: int ref, + int argument: @argument_or_none ref +); + +assign_exprs( //dir=expr + unique int id: @assign_expr, + int dest: @expr_or_none ref, + int source: @expr_or_none ref +); + +bind_optional_exprs( //dir=expr + unique int id: @bind_optional_expr, + int sub_expr: @expr_or_none ref +); + +capture_list_exprs( //dir=expr + unique int id: @capture_list_expr, + int closure_body: @closure_expr_or_none ref +); + +#keyset[id, index] +capture_list_expr_binding_decls( //dir=expr + int id: @capture_list_expr ref, + int index: int ref, + int binding_decl: @pattern_binding_decl_or_none ref +); + +@closure_expr = + @auto_closure_expr +| @explicit_closure_expr +; + +@collection_expr = + @array_expr +| @dictionary_expr +; + +decl_ref_exprs( //dir=expr + unique int id: @decl_ref_expr, + int decl: @decl_or_none ref +); + +#keyset[id, index] +decl_ref_expr_replacement_types( //dir=expr + int id: @decl_ref_expr ref, + int index: int ref, + int replacement_type: @type_or_none ref +); + +#keyset[id] +decl_ref_expr_has_direct_to_storage_semantics( //dir=expr + int id: @decl_ref_expr ref +); + +#keyset[id] +decl_ref_expr_has_direct_to_implementation_semantics( //dir=expr + int id: @decl_ref_expr ref +); + +#keyset[id] +decl_ref_expr_has_ordinary_semantics( //dir=expr + int id: @decl_ref_expr ref +); + +#keyset[id] +decl_ref_expr_has_distributed_thunk_semantics( //dir=expr + int id: @decl_ref_expr ref +); + +default_argument_exprs( //dir=expr + unique int id: @default_argument_expr, + int param_decl: @param_decl_or_none ref, + int param_index: int ref +); + +#keyset[id] +default_argument_expr_caller_side_defaults( //dir=expr + int id: @default_argument_expr ref, + int caller_side_default: @expr_or_none ref +); + +discard_assignment_exprs( //dir=expr + unique int id: @discard_assignment_expr +); + +dot_syntax_base_ignored_exprs( //dir=expr + unique int id: @dot_syntax_base_ignored_expr, + int qualifier: @expr_or_none ref, + int sub_expr: @expr_or_none ref +); + +dynamic_type_exprs( //dir=expr + unique int id: @dynamic_type_expr, + int base: @expr_or_none ref +); + +enum_is_case_exprs( //dir=expr + unique int id: @enum_is_case_expr, + int sub_expr: @expr_or_none ref, + int element: @enum_element_decl_or_none ref +); + +error_exprs( //dir=expr + unique int id: @error_expr +); + +@explicit_cast_expr = + @checked_cast_expr +| @coerce_expr +; + +#keyset[id] +explicit_cast_exprs( //dir=expr + int id: @explicit_cast_expr ref, + int sub_expr: @expr_or_none ref +); + +force_value_exprs( //dir=expr + unique int id: @force_value_expr, + int sub_expr: @expr_or_none ref +); + +@identity_expr = + @await_expr +| @dot_self_expr +| @paren_expr +| @unresolved_member_chain_result_expr +; + +#keyset[id] +identity_exprs( //dir=expr + int id: @identity_expr ref, + int sub_expr: @expr_or_none ref +); + +if_exprs( //dir=expr + unique int id: @if_expr, + int condition: @expr_or_none ref, + int then_expr: @expr_or_none ref, + int else_expr: @expr_or_none ref +); + +@implicit_conversion_expr = + @abi_safe_conversion_expr +| @any_hashable_erasure_expr +| @archetype_to_super_expr +| @array_to_pointer_expr +| @bridge_from_obj_c_expr +| @bridge_to_obj_c_expr +| @class_metatype_to_object_expr +| @collection_upcast_conversion_expr +| @conditional_bridge_from_obj_c_expr +| @covariant_function_conversion_expr +| @covariant_return_conversion_expr +| @derived_to_base_expr +| @destructure_tuple_expr +| @differentiable_function_expr +| @differentiable_function_extract_original_expr +| @erasure_expr +| @existential_metatype_to_object_expr +| @foreign_object_conversion_expr +| @function_conversion_expr +| @in_out_to_pointer_expr +| @inject_into_optional_expr +| @linear_function_expr +| @linear_function_extract_original_expr +| @linear_to_differentiable_function_expr +| @load_expr +| @metatype_conversion_expr +| @pointer_to_pointer_expr +| @protocol_metatype_to_object_expr +| @string_to_pointer_expr +| @underlying_to_opaque_expr +| @unevaluated_instance_expr +| @unresolved_type_conversion_expr +; + +#keyset[id] +implicit_conversion_exprs( //dir=expr + int id: @implicit_conversion_expr ref, + int sub_expr: @expr_or_none ref +); + +in_out_exprs( //dir=expr + unique int id: @in_out_expr, + int sub_expr: @expr_or_none ref +); + +key_path_application_exprs( //dir=expr + unique int id: @key_path_application_expr, + int base: @expr_or_none ref, + int key_path: @expr_or_none ref +); + +key_path_dot_exprs( //dir=expr + unique int id: @key_path_dot_expr +); + +key_path_exprs( //dir=expr + unique int id: @key_path_expr +); + +#keyset[id] +key_path_expr_roots( //dir=expr + int id: @key_path_expr ref, + int root: @type_repr_or_none ref +); + +#keyset[id, index] +key_path_expr_components( //dir=expr + int id: @key_path_expr ref, + int index: int ref, + int component: @key_path_component_or_none ref +); + +lazy_initialization_exprs( //dir=expr + unique int id: @lazy_initialization_expr, + int sub_expr: @expr_or_none ref +); + +@literal_expr = + @builtin_literal_expr +| @interpolated_string_literal_expr +| @nil_literal_expr +| @object_literal_expr +| @regex_literal_expr +; + +@lookup_expr = + @dynamic_lookup_expr +| @member_ref_expr +| @subscript_expr +; + +#keyset[id] +lookup_exprs( //dir=expr + int id: @lookup_expr ref, + int base: @expr_or_none ref +); + +#keyset[id] +lookup_expr_members( //dir=expr + int id: @lookup_expr ref, + int member: @decl_or_none ref +); + +make_temporarily_escapable_exprs( //dir=expr + unique int id: @make_temporarily_escapable_expr, + int escaping_closure: @opaque_value_expr_or_none ref, + int nonescaping_closure: @expr_or_none ref, + int sub_expr: @expr_or_none ref +); + +obj_c_selector_exprs( //dir=expr + unique int id: @obj_c_selector_expr, + int sub_expr: @expr_or_none ref, + int method: @function_or_none ref +); + +one_way_exprs( //dir=expr + unique int id: @one_way_expr, + int sub_expr: @expr_or_none ref +); + +opaque_value_exprs( //dir=expr + unique int id: @opaque_value_expr +); + +open_existential_exprs( //dir=expr + unique int id: @open_existential_expr, + int sub_expr: @expr_or_none ref, + int existential: @expr_or_none ref, + int opaque_expr: @opaque_value_expr_or_none ref +); + +optional_evaluation_exprs( //dir=expr + unique int id: @optional_evaluation_expr, + int sub_expr: @expr_or_none ref +); + +other_initializer_ref_exprs( //dir=expr + unique int id: @other_initializer_ref_expr, + int initializer: @initializer_or_none ref +); + +overloaded_decl_ref_exprs( //dir=expr + unique int id: @overloaded_decl_ref_expr +); + +#keyset[id, index] +overloaded_decl_ref_expr_possible_declarations( //dir=expr + int id: @overloaded_decl_ref_expr ref, + int index: int ref, + int possible_declaration: @value_decl_or_none ref +); + +property_wrapper_value_placeholder_exprs( //dir=expr + unique int id: @property_wrapper_value_placeholder_expr, + int placeholder: @opaque_value_expr_or_none ref +); + +#keyset[id] +property_wrapper_value_placeholder_expr_wrapped_values( //dir=expr + int id: @property_wrapper_value_placeholder_expr ref, + int wrapped_value: @expr_or_none ref +); + +rebind_self_in_initializer_exprs( //dir=expr + unique int id: @rebind_self_in_initializer_expr, + int sub_expr: @expr_or_none ref, + int self: @var_decl_or_none ref +); + +sequence_exprs( //dir=expr + unique int id: @sequence_expr +); + +#keyset[id, index] +sequence_expr_elements( //dir=expr + int id: @sequence_expr ref, + int index: int ref, + int element: @expr_or_none ref +); + +super_ref_exprs( //dir=expr + unique int id: @super_ref_expr, + int self: @var_decl_or_none ref +); + +tap_exprs( //dir=expr + unique int id: @tap_expr, + int body: @brace_stmt_or_none ref, + int var: @var_decl_or_none ref +); + +#keyset[id] +tap_expr_sub_exprs( //dir=expr + int id: @tap_expr ref, + int sub_expr: @expr_or_none ref +); + +tuple_element_exprs( //dir=expr + unique int id: @tuple_element_expr, + int sub_expr: @expr_or_none ref, + int index: int ref +); + +tuple_exprs( //dir=expr + unique int id: @tuple_expr +); + +#keyset[id, index] +tuple_expr_elements( //dir=expr + int id: @tuple_expr ref, + int index: int ref, + int element: @expr_or_none ref +); + +type_exprs( //dir=expr + unique int id: @type_expr +); + +#keyset[id] +type_expr_type_reprs( //dir=expr + int id: @type_expr ref, + int type_repr: @type_repr_or_none ref +); + +unresolved_decl_ref_exprs( //dir=expr + unique int id: @unresolved_decl_ref_expr +); + +#keyset[id] +unresolved_decl_ref_expr_names( //dir=expr + int id: @unresolved_decl_ref_expr ref, + string name: string ref +); + +unresolved_dot_exprs( //dir=expr + unique int id: @unresolved_dot_expr, + int base: @expr_or_none ref, + string name: string ref +); + +unresolved_member_exprs( //dir=expr + unique int id: @unresolved_member_expr, + string name: string ref +); + +unresolved_pattern_exprs( //dir=expr + unique int id: @unresolved_pattern_expr, + int sub_pattern: @pattern_or_none ref +); + +unresolved_specialize_exprs( //dir=expr + unique int id: @unresolved_specialize_expr, + int sub_expr: @expr_or_none ref +); + +vararg_expansion_exprs( //dir=expr + unique int id: @vararg_expansion_expr, + int sub_expr: @expr_or_none ref +); + +abi_safe_conversion_exprs( //dir=expr + unique int id: @abi_safe_conversion_expr +); + +any_hashable_erasure_exprs( //dir=expr + unique int id: @any_hashable_erasure_expr +); + +archetype_to_super_exprs( //dir=expr + unique int id: @archetype_to_super_expr +); + +array_exprs( //dir=expr + unique int id: @array_expr +); + +#keyset[id, index] +array_expr_elements( //dir=expr + int id: @array_expr ref, + int index: int ref, + int element: @expr_or_none ref +); + +array_to_pointer_exprs( //dir=expr + unique int id: @array_to_pointer_expr +); + +auto_closure_exprs( //dir=expr + unique int id: @auto_closure_expr +); + +await_exprs( //dir=expr + unique int id: @await_expr +); + +binary_exprs( //dir=expr + unique int id: @binary_expr +); + +bridge_from_obj_c_exprs( //dir=expr + unique int id: @bridge_from_obj_c_expr +); + +bridge_to_obj_c_exprs( //dir=expr + unique int id: @bridge_to_obj_c_expr +); + +@builtin_literal_expr = + @boolean_literal_expr +| @magic_identifier_literal_expr +| @number_literal_expr +| @string_literal_expr +; + +call_exprs( //dir=expr + unique int id: @call_expr +); + +@checked_cast_expr = + @conditional_checked_cast_expr +| @forced_checked_cast_expr +| @is_expr +; + +class_metatype_to_object_exprs( //dir=expr + unique int id: @class_metatype_to_object_expr +); + +coerce_exprs( //dir=expr + unique int id: @coerce_expr +); + +collection_upcast_conversion_exprs( //dir=expr + unique int id: @collection_upcast_conversion_expr +); + +conditional_bridge_from_obj_c_exprs( //dir=expr + unique int id: @conditional_bridge_from_obj_c_expr +); + +covariant_function_conversion_exprs( //dir=expr + unique int id: @covariant_function_conversion_expr +); + +covariant_return_conversion_exprs( //dir=expr + unique int id: @covariant_return_conversion_expr +); + +derived_to_base_exprs( //dir=expr + unique int id: @derived_to_base_expr +); + +destructure_tuple_exprs( //dir=expr + unique int id: @destructure_tuple_expr +); + +dictionary_exprs( //dir=expr + unique int id: @dictionary_expr +); + +#keyset[id, index] +dictionary_expr_elements( //dir=expr + int id: @dictionary_expr ref, + int index: int ref, + int element: @expr_or_none ref +); + +differentiable_function_exprs( //dir=expr + unique int id: @differentiable_function_expr +); + +differentiable_function_extract_original_exprs( //dir=expr + unique int id: @differentiable_function_extract_original_expr +); + +dot_self_exprs( //dir=expr + unique int id: @dot_self_expr +); + +@dynamic_lookup_expr = + @dynamic_member_ref_expr +| @dynamic_subscript_expr +; + +erasure_exprs( //dir=expr + unique int id: @erasure_expr +); + +existential_metatype_to_object_exprs( //dir=expr + unique int id: @existential_metatype_to_object_expr +); + +explicit_closure_exprs( //dir=expr + unique int id: @explicit_closure_expr +); + +force_try_exprs( //dir=expr + unique int id: @force_try_expr +); + +foreign_object_conversion_exprs( //dir=expr + unique int id: @foreign_object_conversion_expr +); + +function_conversion_exprs( //dir=expr + unique int id: @function_conversion_expr +); + +in_out_to_pointer_exprs( //dir=expr + unique int id: @in_out_to_pointer_expr +); + +inject_into_optional_exprs( //dir=expr + unique int id: @inject_into_optional_expr +); + +interpolated_string_literal_exprs( //dir=expr + unique int id: @interpolated_string_literal_expr +); + +#keyset[id] +interpolated_string_literal_expr_interpolation_exprs( //dir=expr + int id: @interpolated_string_literal_expr ref, + int interpolation_expr: @opaque_value_expr_or_none ref +); + +#keyset[id] +interpolated_string_literal_expr_appending_exprs( //dir=expr + int id: @interpolated_string_literal_expr ref, + int appending_expr: @tap_expr_or_none ref +); + +linear_function_exprs( //dir=expr + unique int id: @linear_function_expr +); + +linear_function_extract_original_exprs( //dir=expr + unique int id: @linear_function_extract_original_expr +); + +linear_to_differentiable_function_exprs( //dir=expr + unique int id: @linear_to_differentiable_function_expr +); + +load_exprs( //dir=expr + unique int id: @load_expr +); + +member_ref_exprs( //dir=expr + unique int id: @member_ref_expr +); + +#keyset[id] +member_ref_expr_has_direct_to_storage_semantics( //dir=expr + int id: @member_ref_expr ref +); + +#keyset[id] +member_ref_expr_has_direct_to_implementation_semantics( //dir=expr + int id: @member_ref_expr ref +); + +#keyset[id] +member_ref_expr_has_ordinary_semantics( //dir=expr + int id: @member_ref_expr ref +); + +#keyset[id] +member_ref_expr_has_distributed_thunk_semantics( //dir=expr + int id: @member_ref_expr ref +); + +metatype_conversion_exprs( //dir=expr + unique int id: @metatype_conversion_expr +); + +nil_literal_exprs( //dir=expr + unique int id: @nil_literal_expr +); + +object_literal_exprs( //dir=expr + unique int id: @object_literal_expr, + int kind: int ref +); + +#keyset[id, index] +object_literal_expr_arguments( //dir=expr + int id: @object_literal_expr ref, + int index: int ref, + int argument: @argument_or_none ref +); + +optional_try_exprs( //dir=expr + unique int id: @optional_try_expr +); + +paren_exprs( //dir=expr + unique int id: @paren_expr +); + +pointer_to_pointer_exprs( //dir=expr + unique int id: @pointer_to_pointer_expr +); + +postfix_unary_exprs( //dir=expr + unique int id: @postfix_unary_expr +); + +prefix_unary_exprs( //dir=expr + unique int id: @prefix_unary_expr +); + +protocol_metatype_to_object_exprs( //dir=expr + unique int id: @protocol_metatype_to_object_expr +); + +regex_literal_exprs( //dir=expr + unique int id: @regex_literal_expr, + string pattern: string ref, + int version: int ref +); + +@self_apply_expr = + @dot_syntax_call_expr +| @initializer_ref_call_expr +; + +#keyset[id] +self_apply_exprs( //dir=expr + int id: @self_apply_expr ref, + int base: @expr_or_none ref +); + +string_to_pointer_exprs( //dir=expr + unique int id: @string_to_pointer_expr +); + +subscript_exprs( //dir=expr + unique int id: @subscript_expr +); + +#keyset[id, index] +subscript_expr_arguments( //dir=expr + int id: @subscript_expr ref, + int index: int ref, + int argument: @argument_or_none ref +); + +#keyset[id] +subscript_expr_has_direct_to_storage_semantics( //dir=expr + int id: @subscript_expr ref +); + +#keyset[id] +subscript_expr_has_direct_to_implementation_semantics( //dir=expr + int id: @subscript_expr ref +); + +#keyset[id] +subscript_expr_has_ordinary_semantics( //dir=expr + int id: @subscript_expr ref +); + +#keyset[id] +subscript_expr_has_distributed_thunk_semantics( //dir=expr + int id: @subscript_expr ref +); + +try_exprs( //dir=expr + unique int id: @try_expr +); + +underlying_to_opaque_exprs( //dir=expr + unique int id: @underlying_to_opaque_expr +); + +unevaluated_instance_exprs( //dir=expr + unique int id: @unevaluated_instance_expr +); + +unresolved_member_chain_result_exprs( //dir=expr + unique int id: @unresolved_member_chain_result_expr +); + +unresolved_type_conversion_exprs( //dir=expr + unique int id: @unresolved_type_conversion_expr +); + +boolean_literal_exprs( //dir=expr + unique int id: @boolean_literal_expr, + boolean value: boolean ref +); + +conditional_checked_cast_exprs( //dir=expr + unique int id: @conditional_checked_cast_expr +); + +dot_syntax_call_exprs( //dir=expr + unique int id: @dot_syntax_call_expr +); + +dynamic_member_ref_exprs( //dir=expr + unique int id: @dynamic_member_ref_expr +); + +dynamic_subscript_exprs( //dir=expr + unique int id: @dynamic_subscript_expr +); + +forced_checked_cast_exprs( //dir=expr + unique int id: @forced_checked_cast_expr +); + +initializer_ref_call_exprs( //dir=expr + unique int id: @initializer_ref_call_expr +); + +is_exprs( //dir=expr + unique int id: @is_expr +); + +magic_identifier_literal_exprs( //dir=expr + unique int id: @magic_identifier_literal_expr, + string kind: string ref +); + +@number_literal_expr = + @float_literal_expr +| @integer_literal_expr +; + +string_literal_exprs( //dir=expr + unique int id: @string_literal_expr, + string value: string ref +); + +float_literal_exprs( //dir=expr + unique int id: @float_literal_expr, + string string_value: string ref +); + +integer_literal_exprs( //dir=expr + unique int id: @integer_literal_expr, + string string_value: string ref +); + +@pattern = + @any_pattern +| @binding_pattern +| @bool_pattern +| @enum_element_pattern +| @expr_pattern +| @is_pattern +| @named_pattern +| @optional_some_pattern +| @paren_pattern +| @tuple_pattern +| @typed_pattern +; + +any_patterns( //dir=pattern + unique int id: @any_pattern +); + +binding_patterns( //dir=pattern + unique int id: @binding_pattern, + int sub_pattern: @pattern_or_none ref +); + +bool_patterns( //dir=pattern + unique int id: @bool_pattern, + boolean value: boolean ref +); + +enum_element_patterns( //dir=pattern + unique int id: @enum_element_pattern, + int element: @enum_element_decl_or_none ref +); + +#keyset[id] +enum_element_pattern_sub_patterns( //dir=pattern + int id: @enum_element_pattern ref, + int sub_pattern: @pattern_or_none ref +); + +expr_patterns( //dir=pattern + unique int id: @expr_pattern, + int sub_expr: @expr_or_none ref +); + +is_patterns( //dir=pattern + unique int id: @is_pattern +); + +#keyset[id] +is_pattern_cast_type_reprs( //dir=pattern + int id: @is_pattern ref, + int cast_type_repr: @type_repr_or_none ref +); + +#keyset[id] +is_pattern_sub_patterns( //dir=pattern + int id: @is_pattern ref, + int sub_pattern: @pattern_or_none ref +); + +named_patterns( //dir=pattern + unique int id: @named_pattern, + int var_decl: @var_decl_or_none ref +); + +optional_some_patterns( //dir=pattern + unique int id: @optional_some_pattern, + int sub_pattern: @pattern_or_none ref +); + +paren_patterns( //dir=pattern + unique int id: @paren_pattern, + int sub_pattern: @pattern_or_none ref +); + +tuple_patterns( //dir=pattern + unique int id: @tuple_pattern +); + +#keyset[id, index] +tuple_pattern_elements( //dir=pattern + int id: @tuple_pattern ref, + int index: int ref, + int element: @pattern_or_none ref +); + +typed_patterns( //dir=pattern + unique int id: @typed_pattern, + int sub_pattern: @pattern_or_none ref +); + +#keyset[id] +typed_pattern_type_reprs( //dir=pattern + int id: @typed_pattern ref, + int type_repr: @type_repr_or_none ref +); + +case_label_items( //dir=stmt + unique int id: @case_label_item, + int pattern: @pattern_or_none ref +); + +#keyset[id] +case_label_item_guards( //dir=stmt + int id: @case_label_item ref, + int guard: @expr_or_none ref +); + +condition_elements( //dir=stmt + unique int id: @condition_element +); + +#keyset[id] +condition_element_booleans( //dir=stmt + int id: @condition_element ref, + int boolean_: @expr_or_none ref +); + +#keyset[id] +condition_element_patterns( //dir=stmt + int id: @condition_element ref, + int pattern: @pattern_or_none ref +); + +#keyset[id] +condition_element_initializers( //dir=stmt + int id: @condition_element ref, + int initializer: @expr_or_none ref +); + +#keyset[id] +condition_element_availabilities( //dir=stmt + int id: @condition_element ref, + int availability: @availability_info_or_none ref +); + +@stmt = + @brace_stmt +| @break_stmt +| @case_stmt +| @continue_stmt +| @defer_stmt +| @fail_stmt +| @fallthrough_stmt +| @labeled_stmt +| @pound_assert_stmt +| @return_stmt +| @throw_stmt +| @yield_stmt +; + +stmt_conditions( //dir=stmt + unique int id: @stmt_condition +); + +#keyset[id, index] +stmt_condition_elements( //dir=stmt + int id: @stmt_condition ref, + int index: int ref, + int element: @condition_element_or_none ref +); + +brace_stmts( //dir=stmt + unique int id: @brace_stmt +); + +#keyset[id, index] +brace_stmt_elements( //dir=stmt + int id: @brace_stmt ref, + int index: int ref, + int element: @ast_node_or_none ref +); + +break_stmts( //dir=stmt + unique int id: @break_stmt +); + +#keyset[id] +break_stmt_target_names( //dir=stmt + int id: @break_stmt ref, + string target_name: string ref +); + +#keyset[id] +break_stmt_targets( //dir=stmt + int id: @break_stmt ref, + int target: @stmt_or_none ref +); + +case_stmts( //dir=stmt + unique int id: @case_stmt, + int body: @stmt_or_none ref +); + +#keyset[id, index] +case_stmt_labels( //dir=stmt + int id: @case_stmt ref, + int index: int ref, + int label: @case_label_item_or_none ref +); + +#keyset[id, index] +case_stmt_variables( //dir=stmt + int id: @case_stmt ref, + int index: int ref, + int variable: @var_decl_or_none ref +); + +continue_stmts( //dir=stmt + unique int id: @continue_stmt +); + +#keyset[id] +continue_stmt_target_names( //dir=stmt + int id: @continue_stmt ref, + string target_name: string ref +); + +#keyset[id] +continue_stmt_targets( //dir=stmt + int id: @continue_stmt ref, + int target: @stmt_or_none ref +); + +defer_stmts( //dir=stmt + unique int id: @defer_stmt, + int body: @brace_stmt_or_none ref +); + +fail_stmts( //dir=stmt + unique int id: @fail_stmt +); + +fallthrough_stmts( //dir=stmt + unique int id: @fallthrough_stmt, + int fallthrough_source: @case_stmt_or_none ref, + int fallthrough_dest: @case_stmt_or_none ref +); + +@labeled_stmt = + @do_catch_stmt +| @do_stmt +| @for_each_stmt +| @labeled_conditional_stmt +| @repeat_while_stmt +| @switch_stmt +; + +#keyset[id] +labeled_stmt_labels( //dir=stmt + int id: @labeled_stmt ref, + string label: string ref +); + +pound_assert_stmts( //dir=stmt + unique int id: @pound_assert_stmt, + int condition: @expr_or_none ref, + string message: string ref +); + +return_stmts( //dir=stmt + unique int id: @return_stmt +); + +#keyset[id] +return_stmt_results( //dir=stmt + int id: @return_stmt ref, + int result: @expr_or_none ref +); + +throw_stmts( //dir=stmt + unique int id: @throw_stmt, + int sub_expr: @expr_or_none ref +); + +yield_stmts( //dir=stmt + unique int id: @yield_stmt +); + +#keyset[id, index] +yield_stmt_results( //dir=stmt + int id: @yield_stmt ref, + int index: int ref, + int result: @expr_or_none ref +); + +do_catch_stmts( //dir=stmt + unique int id: @do_catch_stmt, + int body: @stmt_or_none ref +); + +#keyset[id, index] +do_catch_stmt_catches( //dir=stmt + int id: @do_catch_stmt ref, + int index: int ref, + int catch: @case_stmt_or_none ref +); + +do_stmts( //dir=stmt + unique int id: @do_stmt, + int body: @brace_stmt_or_none ref +); + +for_each_stmts( //dir=stmt + unique int id: @for_each_stmt, + int pattern: @pattern_or_none ref, + int body: @brace_stmt_or_none ref +); + +#keyset[id] +for_each_stmt_wheres( //dir=stmt + int id: @for_each_stmt ref, + int where: @expr_or_none ref +); + +#keyset[id] +for_each_stmt_iterator_vars( //dir=stmt + int id: @for_each_stmt ref, + int iteratorVar: @pattern_binding_decl_or_none ref +); + +#keyset[id] +for_each_stmt_next_calls( //dir=stmt + int id: @for_each_stmt ref, + int nextCall: @expr_or_none ref +); + +@labeled_conditional_stmt = + @guard_stmt +| @if_stmt +| @while_stmt +; + +#keyset[id] +labeled_conditional_stmts( //dir=stmt + int id: @labeled_conditional_stmt ref, + int condition: @stmt_condition_or_none ref +); + +repeat_while_stmts( //dir=stmt + unique int id: @repeat_while_stmt, + int condition: @expr_or_none ref, + int body: @stmt_or_none ref +); + +switch_stmts( //dir=stmt + unique int id: @switch_stmt, + int expr: @expr_or_none ref +); + +#keyset[id, index] +switch_stmt_cases( //dir=stmt + int id: @switch_stmt ref, + int index: int ref, + int case_: @case_stmt_or_none ref +); + +guard_stmts( //dir=stmt + unique int id: @guard_stmt, + int body: @brace_stmt_or_none ref +); + +if_stmts( //dir=stmt + unique int id: @if_stmt, + int then: @stmt_or_none ref +); + +#keyset[id] +if_stmt_elses( //dir=stmt + int id: @if_stmt ref, + int else: @stmt_or_none ref +); + +while_stmts( //dir=stmt + unique int id: @while_stmt, + int body: @stmt_or_none ref +); + +@type = + @any_function_type +| @any_generic_type +| @any_metatype_type +| @builtin_type +| @dependent_member_type +| @dynamic_self_type +| @error_type +| @existential_type +| @in_out_type +| @l_value_type +| @module_type +| @parameterized_protocol_type +| @protocol_composition_type +| @reference_storage_type +| @substitutable_type +| @sugar_type +| @tuple_type +| @unresolved_type +; + +#keyset[id] +types( //dir=type + int id: @type ref, + string name: string ref, + int canonical_type: @type_or_none ref +); + +type_reprs( //dir=type + unique int id: @type_repr, + int type_: @type_or_none ref +); + +@any_function_type = + @function_type +| @generic_function_type +; + +#keyset[id] +any_function_types( //dir=type + int id: @any_function_type ref, + int result: @type_or_none ref +); + +#keyset[id, index] +any_function_type_param_types( //dir=type + int id: @any_function_type ref, + int index: int ref, + int param_type: @type_or_none ref +); + +#keyset[id] +any_function_type_is_throwing( //dir=type + int id: @any_function_type ref +); + +#keyset[id] +any_function_type_is_async( //dir=type + int id: @any_function_type ref +); + +@any_generic_type = + @nominal_or_bound_generic_nominal_type +| @unbound_generic_type +; + +#keyset[id] +any_generic_types( //dir=type + int id: @any_generic_type ref, + int declaration: @generic_type_decl_or_none ref +); + +#keyset[id] +any_generic_type_parents( //dir=type + int id: @any_generic_type ref, + int parent: @type_or_none ref +); + +@any_metatype_type = + @existential_metatype_type +| @metatype_type +; + +@builtin_type = + @any_builtin_integer_type +| @builtin_bridge_object_type +| @builtin_default_actor_storage_type +| @builtin_executor_type +| @builtin_float_type +| @builtin_job_type +| @builtin_native_object_type +| @builtin_raw_pointer_type +| @builtin_raw_unsafe_continuation_type +| @builtin_unsafe_value_buffer_type +| @builtin_vector_type +; + +dependent_member_types( //dir=type + unique int id: @dependent_member_type, + int base_type: @type_or_none ref, + int associated_type_decl: @associated_type_decl_or_none ref +); + +dynamic_self_types( //dir=type + unique int id: @dynamic_self_type, + int static_self_type: @type_or_none ref +); + +error_types( //dir=type + unique int id: @error_type +); + +existential_types( //dir=type + unique int id: @existential_type, + int constraint: @type_or_none ref +); + +in_out_types( //dir=type + unique int id: @in_out_type, + int object_type: @type_or_none ref +); + +l_value_types( //dir=type + unique int id: @l_value_type, + int object_type: @type_or_none ref +); + +module_types( //dir=type + unique int id: @module_type, + int module: @module_decl_or_none ref +); + +parameterized_protocol_types( //dir=type + unique int id: @parameterized_protocol_type, + int base: @protocol_type_or_none ref +); + +#keyset[id, index] +parameterized_protocol_type_args( //dir=type + int id: @parameterized_protocol_type ref, + int index: int ref, + int arg: @type_or_none ref +); + +protocol_composition_types( //dir=type + unique int id: @protocol_composition_type +); + +#keyset[id, index] +protocol_composition_type_members( //dir=type + int id: @protocol_composition_type ref, + int index: int ref, + int member: @type_or_none ref +); + +@reference_storage_type = + @unmanaged_storage_type +| @unowned_storage_type +| @weak_storage_type +; + +#keyset[id] +reference_storage_types( //dir=type + int id: @reference_storage_type ref, + int referent_type: @type_or_none ref +); + +@substitutable_type = + @archetype_type +| @generic_type_param_type +; + +@sugar_type = + @paren_type +| @syntax_sugar_type +| @type_alias_type +; + +tuple_types( //dir=type + unique int id: @tuple_type +); + +#keyset[id, index] +tuple_type_types( //dir=type + int id: @tuple_type ref, + int index: int ref, + int type_: @type_or_none ref +); + +#keyset[id, index] +tuple_type_names( //dir=type + int id: @tuple_type ref, + int index: int ref, + string name: string ref +); + +unresolved_types( //dir=type + unique int id: @unresolved_type +); + +@any_builtin_integer_type = + @builtin_integer_literal_type +| @builtin_integer_type +; + +@archetype_type = + @opaque_type_archetype_type +| @opened_archetype_type +| @primary_archetype_type +; + +#keyset[id] +archetype_types( //dir=type + int id: @archetype_type ref, + int interface_type: @type_or_none ref +); + +#keyset[id] +archetype_type_superclasses( //dir=type + int id: @archetype_type ref, + int superclass: @type_or_none ref +); + +#keyset[id, index] +archetype_type_protocols( //dir=type + int id: @archetype_type ref, + int index: int ref, + int protocol: @protocol_decl_or_none ref +); + +builtin_bridge_object_types( //dir=type + unique int id: @builtin_bridge_object_type +); + +builtin_default_actor_storage_types( //dir=type + unique int id: @builtin_default_actor_storage_type +); + +builtin_executor_types( //dir=type + unique int id: @builtin_executor_type +); + +builtin_float_types( //dir=type + unique int id: @builtin_float_type +); + +builtin_job_types( //dir=type + unique int id: @builtin_job_type +); + +builtin_native_object_types( //dir=type + unique int id: @builtin_native_object_type +); + +builtin_raw_pointer_types( //dir=type + unique int id: @builtin_raw_pointer_type +); + +builtin_raw_unsafe_continuation_types( //dir=type + unique int id: @builtin_raw_unsafe_continuation_type +); + +builtin_unsafe_value_buffer_types( //dir=type + unique int id: @builtin_unsafe_value_buffer_type +); + +builtin_vector_types( //dir=type + unique int id: @builtin_vector_type +); + +existential_metatype_types( //dir=type + unique int id: @existential_metatype_type +); + +function_types( //dir=type + unique int id: @function_type +); + +generic_function_types( //dir=type + unique int id: @generic_function_type +); + +#keyset[id, index] +generic_function_type_generic_params( //dir=type + int id: @generic_function_type ref, + int index: int ref, + int generic_param: @generic_type_param_type_or_none ref +); + +generic_type_param_types( //dir=type + unique int id: @generic_type_param_type +); + +metatype_types( //dir=type + unique int id: @metatype_type +); + +@nominal_or_bound_generic_nominal_type = + @bound_generic_type +| @nominal_type +; + +paren_types( //dir=type + unique int id: @paren_type, + int type_: @type_or_none ref +); + +@syntax_sugar_type = + @dictionary_type +| @unary_syntax_sugar_type +; + +type_alias_types( //dir=type + unique int id: @type_alias_type, + int decl: @type_alias_decl_or_none ref +); + +unbound_generic_types( //dir=type + unique int id: @unbound_generic_type +); + +unmanaged_storage_types( //dir=type + unique int id: @unmanaged_storage_type +); + +unowned_storage_types( //dir=type + unique int id: @unowned_storage_type +); + +weak_storage_types( //dir=type + unique int id: @weak_storage_type +); + +@bound_generic_type = + @bound_generic_class_type +| @bound_generic_enum_type +| @bound_generic_struct_type +; + +#keyset[id, index] +bound_generic_type_arg_types( //dir=type + int id: @bound_generic_type ref, + int index: int ref, + int arg_type: @type_or_none ref +); + +builtin_integer_literal_types( //dir=type + unique int id: @builtin_integer_literal_type +); + +builtin_integer_types( //dir=type + unique int id: @builtin_integer_type +); + +#keyset[id] +builtin_integer_type_widths( //dir=type + int id: @builtin_integer_type ref, + int width: int ref +); + +dictionary_types( //dir=type + unique int id: @dictionary_type, + int key_type: @type_or_none ref, + int value_type: @type_or_none ref +); + +@nominal_type = + @class_type +| @enum_type +| @protocol_type +| @struct_type +; + +opaque_type_archetype_types( //dir=type + unique int id: @opaque_type_archetype_type, + int declaration: @opaque_type_decl_or_none ref +); + +opened_archetype_types( //dir=type + unique int id: @opened_archetype_type +); + +primary_archetype_types( //dir=type + unique int id: @primary_archetype_type +); + +@unary_syntax_sugar_type = + @array_slice_type +| @optional_type +| @variadic_sequence_type +; + +#keyset[id] +unary_syntax_sugar_types( //dir=type + int id: @unary_syntax_sugar_type ref, + int base_type: @type_or_none ref +); + +array_slice_types( //dir=type + unique int id: @array_slice_type +); + +bound_generic_class_types( //dir=type + unique int id: @bound_generic_class_type +); + +bound_generic_enum_types( //dir=type + unique int id: @bound_generic_enum_type +); + +bound_generic_struct_types( //dir=type + unique int id: @bound_generic_struct_type +); + +class_types( //dir=type + unique int id: @class_type +); + +enum_types( //dir=type + unique int id: @enum_type +); + +optional_types( //dir=type + unique int id: @optional_type +); + +protocol_types( //dir=type + unique int id: @protocol_type +); + +struct_types( //dir=type + unique int id: @struct_type +); + +variadic_sequence_types( //dir=type + unique int id: @variadic_sequence_type +); + +@accessor_or_none = + @accessor +| @unspecified_element +; + +@argument_or_none = + @argument +| @unspecified_element +; + +@associated_type_decl_or_none = + @associated_type_decl +| @unspecified_element +; + +@ast_node_or_none = + @ast_node +| @unspecified_element +; + +@availability_info_or_none = + @availability_info +| @unspecified_element +; + +@availability_spec_or_none = + @availability_spec +| @unspecified_element +; + +@brace_stmt_or_none = + @brace_stmt +| @unspecified_element +; + +@captured_decl_or_none = + @captured_decl +| @unspecified_element +; + +@case_label_item_or_none = + @case_label_item +| @unspecified_element +; + +@case_stmt_or_none = + @case_stmt +| @unspecified_element +; + +@closure_expr_or_none = + @closure_expr +| @unspecified_element +; + +@condition_element_or_none = + @condition_element +| @unspecified_element +; + +@decl_or_none = + @decl +| @unspecified_element +; + +@enum_element_decl_or_none = + @enum_element_decl +| @unspecified_element +; + +@expr_or_none = + @expr +| @unspecified_element +; + +@file_or_none = + @file +| @unspecified_element +; + +@function_or_none = + @function +| @unspecified_element +; + +@generic_type_decl_or_none = + @generic_type_decl +| @unspecified_element +; + +@generic_type_param_decl_or_none = + @generic_type_param_decl +| @unspecified_element +; + +@generic_type_param_type_or_none = + @generic_type_param_type +| @unspecified_element +; + +@initializer_or_none = + @initializer +| @unspecified_element +; + +@key_path_component_or_none = + @key_path_component +| @unspecified_element +; + +@location_or_none = + @location +| @unspecified_element +; + +@module_decl_or_none = + @module_decl +| @unspecified_element +; + +@nominal_type_decl_or_none = + @nominal_type_decl +| @unspecified_element +; + +@opaque_type_decl_or_none = + @opaque_type_decl +| @unspecified_element +; + +@opaque_value_expr_or_none = + @opaque_value_expr +| @unspecified_element +; + +@param_decl_or_none = + @param_decl +| @unspecified_element +; + +@pattern_or_none = + @pattern +| @unspecified_element +; + +@pattern_binding_decl_or_none = + @pattern_binding_decl +| @unspecified_element +; + +@precedence_group_decl_or_none = + @precedence_group_decl +| @unspecified_element +; + +@protocol_decl_or_none = + @protocol_decl +| @unspecified_element +; + +@protocol_type_or_none = + @protocol_type +| @unspecified_element +; + +@stmt_or_none = + @stmt +| @unspecified_element +; + +@stmt_condition_or_none = + @stmt_condition +| @unspecified_element +; + +@string_literal_expr_or_none = + @string_literal_expr +| @unspecified_element +; + +@tap_expr_or_none = + @tap_expr +| @unspecified_element +; + +@type_or_none = + @type +| @unspecified_element +; + +@type_alias_decl_or_none = + @type_alias_decl +| @unspecified_element +; + +@type_repr_or_none = + @type_repr +| @unspecified_element +; + +@value_decl_or_none = + @unspecified_element +| @value_decl +; + +@var_decl_or_none = + @unspecified_element +| @var_decl +; diff --git a/swift/downgrades/7c17e1f4b2d30f2da05bfa667c621ddd418eb151/swift.dbscheme b/swift/downgrades/7c17e1f4b2d30f2da05bfa667c621ddd418eb151/swift.dbscheme new file mode 100644 index 000000000000..c0db61944f46 --- /dev/null +++ b/swift/downgrades/7c17e1f4b2d30f2da05bfa667c621ddd418eb151/swift.dbscheme @@ -0,0 +1,2636 @@ +// generated by codegen/codegen.py + +// from prefix.dbscheme +/** + * The source location of the snapshot. + */ +sourceLocationPrefix( + string prefix: string ref +); + + +// from schema.py + +@element = + @callable +| @file +| @generic_context +| @locatable +| @location +| @type +; + +#keyset[id] +element_is_unknown( + int id: @element ref +); + +@callable = + @closure_expr +| @function +; + +#keyset[id] +callable_names( + int id: @callable ref, + string name: string ref +); + +#keyset[id] +callable_self_params( + int id: @callable ref, + int self_param: @param_decl_or_none ref +); + +#keyset[id, index] +callable_params( + int id: @callable ref, + int index: int ref, + int param: @param_decl_or_none ref +); + +#keyset[id] +callable_bodies( + int id: @callable ref, + int body: @brace_stmt_or_none ref +); + +#keyset[id, index] +callable_captures( + int id: @callable ref, + int index: int ref, + int capture: @captured_decl_or_none ref +); + +@file = + @db_file +; + +#keyset[id] +files( + int id: @file ref, + string name: string ref +); + +#keyset[id] +file_is_successfully_extracted( + int id: @file ref +); + +@locatable = + @argument +| @ast_node +| @comment +| @diagnostics +| @error_element +; + +#keyset[id] +locatable_locations( + int id: @locatable ref, + int location: @location_or_none ref +); + +@location = + @db_location +; + +#keyset[id] +locations( + int id: @location ref, + int file: @file_or_none ref, + int start_line: int ref, + int start_column: int ref, + int end_line: int ref, + int end_column: int ref +); + +@ast_node = + @availability_info +| @availability_spec +| @case_label_item +| @condition_element +| @decl +| @expr +| @key_path_component +| @pattern +| @stmt +| @stmt_condition +| @type_repr +; + +comments( + unique int id: @comment, + string text: string ref +); + +db_files( + unique int id: @db_file +); + +db_locations( + unique int id: @db_location +); + +diagnostics( + unique int id: @diagnostics, + string text: string ref, + int kind: int ref +); + +@error_element = + @error_expr +| @error_type +| @overloaded_decl_ref_expr +| @unresolved_decl_ref_expr +| @unresolved_dot_expr +| @unresolved_member_chain_result_expr +| @unresolved_member_expr +| @unresolved_pattern_expr +| @unresolved_specialize_expr +| @unresolved_type +| @unresolved_type_conversion_expr +| @unspecified_element +; + +availability_infos( + unique int id: @availability_info +); + +#keyset[id] +availability_info_is_unavailable( + int id: @availability_info ref +); + +#keyset[id, index] +availability_info_specs( + int id: @availability_info ref, + int index: int ref, + int spec: @availability_spec_or_none ref +); + +@availability_spec = + @other_availability_spec +| @platform_version_availability_spec +; + +key_path_components( + unique int id: @key_path_component, + int kind: int ref, + int component_type: @type_or_none ref +); + +#keyset[id, index] +key_path_component_subscript_arguments( + int id: @key_path_component ref, + int index: int ref, + int subscript_argument: @argument_or_none ref +); + +#keyset[id] +key_path_component_tuple_indices( + int id: @key_path_component ref, + int tuple_index: int ref +); + +#keyset[id] +key_path_component_decl_refs( + int id: @key_path_component ref, + int decl_ref: @value_decl_or_none ref +); + +unspecified_elements( + unique int id: @unspecified_element, + string property: string ref, + string error: string ref +); + +#keyset[id] +unspecified_element_parents( + int id: @unspecified_element ref, + int parent: @element ref +); + +#keyset[id] +unspecified_element_indices( + int id: @unspecified_element ref, + int index: int ref +); + +#keyset[id, index] +unspecified_element_children( + int id: @unspecified_element ref, + int index: int ref, + int child: @ast_node_or_none ref +); + +other_availability_specs( + unique int id: @other_availability_spec +); + +platform_version_availability_specs( + unique int id: @platform_version_availability_spec, + string platform: string ref, + string version: string ref +); + +@decl = + @captured_decl +| @enum_case_decl +| @extension_decl +| @if_config_decl +| @import_decl +| @missing_member_decl +| @operator_decl +| @pattern_binding_decl +| @pound_diagnostic_decl +| @precedence_group_decl +| @top_level_code_decl +| @value_decl +; + +#keyset[id] +decls( //dir=decl + int id: @decl ref, + int module: @module_decl_or_none ref +); + +#keyset[id, index] +decl_members( //dir=decl + int id: @decl ref, + int index: int ref, + int member: @decl_or_none ref +); + +@generic_context = + @extension_decl +| @function +| @generic_type_decl +| @subscript_decl +; + +#keyset[id, index] +generic_context_generic_type_params( //dir=decl + int id: @generic_context ref, + int index: int ref, + int generic_type_param: @generic_type_param_decl_or_none ref +); + +captured_decls( //dir=decl + unique int id: @captured_decl, + int decl: @value_decl_or_none ref +); + +#keyset[id] +captured_decl_is_direct( //dir=decl + int id: @captured_decl ref +); + +#keyset[id] +captured_decl_is_escaping( //dir=decl + int id: @captured_decl ref +); + +enum_case_decls( //dir=decl + unique int id: @enum_case_decl +); + +#keyset[id, index] +enum_case_decl_elements( //dir=decl + int id: @enum_case_decl ref, + int index: int ref, + int element: @enum_element_decl_or_none ref +); + +extension_decls( //dir=decl + unique int id: @extension_decl, + int extended_type_decl: @nominal_type_decl_or_none ref +); + +#keyset[id, index] +extension_decl_protocols( //dir=decl + int id: @extension_decl ref, + int index: int ref, + int protocol: @protocol_decl_or_none ref +); + +if_config_decls( //dir=decl + unique int id: @if_config_decl +); + +#keyset[id, index] +if_config_decl_active_elements( //dir=decl + int id: @if_config_decl ref, + int index: int ref, + int active_element: @ast_node_or_none ref +); + +import_decls( //dir=decl + unique int id: @import_decl +); + +#keyset[id] +import_decl_is_exported( //dir=decl + int id: @import_decl ref +); + +#keyset[id] +import_decl_imported_modules( //dir=decl + int id: @import_decl ref, + int imported_module: @module_decl_or_none ref +); + +#keyset[id, index] +import_decl_declarations( //dir=decl + int id: @import_decl ref, + int index: int ref, + int declaration: @value_decl_or_none ref +); + +missing_member_decls( //dir=decl + unique int id: @missing_member_decl, + string name: string ref +); + +@operator_decl = + @infix_operator_decl +| @postfix_operator_decl +| @prefix_operator_decl +; + +#keyset[id] +operator_decls( //dir=decl + int id: @operator_decl ref, + string name: string ref +); + +pattern_binding_decls( //dir=decl + unique int id: @pattern_binding_decl +); + +#keyset[id, index] +pattern_binding_decl_inits( //dir=decl + int id: @pattern_binding_decl ref, + int index: int ref, + int init: @expr_or_none ref +); + +#keyset[id, index] +pattern_binding_decl_patterns( //dir=decl + int id: @pattern_binding_decl ref, + int index: int ref, + int pattern: @pattern_or_none ref +); + +pound_diagnostic_decls( //dir=decl + unique int id: @pound_diagnostic_decl, + int kind: int ref, + int message: @string_literal_expr_or_none ref +); + +precedence_group_decls( //dir=decl + unique int id: @precedence_group_decl +); + +top_level_code_decls( //dir=decl + unique int id: @top_level_code_decl, + int body: @brace_stmt_or_none ref +); + +@value_decl = + @abstract_storage_decl +| @enum_element_decl +| @function +| @type_decl +; + +#keyset[id] +value_decls( //dir=decl + int id: @value_decl ref, + int interface_type: @type_or_none ref +); + +@abstract_storage_decl = + @subscript_decl +| @var_decl +; + +#keyset[id, index] +abstract_storage_decl_accessors( //dir=decl + int id: @abstract_storage_decl ref, + int index: int ref, + int accessor: @accessor_or_none ref +); + +enum_element_decls( //dir=decl + unique int id: @enum_element_decl, + string name: string ref +); + +#keyset[id, index] +enum_element_decl_params( //dir=decl + int id: @enum_element_decl ref, + int index: int ref, + int param: @param_decl_or_none ref +); + +@function = + @accessor_or_named_function +| @deinitializer +| @initializer +; + +infix_operator_decls( //dir=decl + unique int id: @infix_operator_decl +); + +#keyset[id] +infix_operator_decl_precedence_groups( //dir=decl + int id: @infix_operator_decl ref, + int precedence_group: @precedence_group_decl_or_none ref +); + +postfix_operator_decls( //dir=decl + unique int id: @postfix_operator_decl +); + +prefix_operator_decls( //dir=decl + unique int id: @prefix_operator_decl +); + +@type_decl = + @abstract_type_param_decl +| @generic_type_decl +| @module_decl +; + +#keyset[id] +type_decls( //dir=decl + int id: @type_decl ref, + string name: string ref +); + +#keyset[id, index] +type_decl_inherited_types( //dir=decl + int id: @type_decl ref, + int index: int ref, + int inherited_type: @type_or_none ref +); + +@abstract_type_param_decl = + @associated_type_decl +| @generic_type_param_decl +; + +@accessor_or_named_function = + @accessor +| @named_function +; + +deinitializers( //dir=decl + unique int id: @deinitializer +); + +@generic_type_decl = + @nominal_type_decl +| @opaque_type_decl +| @type_alias_decl +; + +initializers( //dir=decl + unique int id: @initializer +); + +module_decls( //dir=decl + unique int id: @module_decl +); + +#keyset[id] +module_decl_is_builtin_module( //dir=decl + int id: @module_decl ref +); + +#keyset[id] +module_decl_is_system_module( //dir=decl + int id: @module_decl ref +); + +module_decl_imported_modules( //dir=decl + int id: @module_decl ref, + int imported_module: @module_decl_or_none ref +); + +module_decl_exported_modules( //dir=decl + int id: @module_decl ref, + int exported_module: @module_decl_or_none ref +); + +subscript_decls( //dir=decl + unique int id: @subscript_decl, + int element_type: @type_or_none ref +); + +#keyset[id, index] +subscript_decl_params( //dir=decl + int id: @subscript_decl ref, + int index: int ref, + int param: @param_decl_or_none ref +); + +@var_decl = + @concrete_var_decl +| @param_decl +; + +#keyset[id] +var_decls( //dir=decl + int id: @var_decl ref, + string name: string ref, + int type_: @type_or_none ref +); + +#keyset[id] +var_decl_attached_property_wrapper_types( //dir=decl + int id: @var_decl ref, + int attached_property_wrapper_type: @type_or_none ref +); + +#keyset[id] +var_decl_parent_patterns( //dir=decl + int id: @var_decl ref, + int parent_pattern: @pattern_or_none ref +); + +#keyset[id] +var_decl_parent_initializers( //dir=decl + int id: @var_decl ref, + int parent_initializer: @expr_or_none ref +); + +#keyset[id] +var_decl_property_wrapper_backing_var_bindings( //dir=decl + int id: @var_decl ref, + int property_wrapper_backing_var_binding: @pattern_binding_decl_or_none ref +); + +#keyset[id] +var_decl_property_wrapper_backing_vars( //dir=decl + int id: @var_decl ref, + int property_wrapper_backing_var: @var_decl_or_none ref +); + +#keyset[id] +var_decl_property_wrapper_projection_var_bindings( //dir=decl + int id: @var_decl ref, + int property_wrapper_projection_var_binding: @pattern_binding_decl_or_none ref +); + +#keyset[id] +var_decl_property_wrapper_projection_vars( //dir=decl + int id: @var_decl ref, + int property_wrapper_projection_var: @var_decl_or_none ref +); + +accessors( //dir=decl + unique int id: @accessor +); + +#keyset[id] +accessor_is_getter( //dir=decl + int id: @accessor ref +); + +#keyset[id] +accessor_is_setter( //dir=decl + int id: @accessor ref +); + +#keyset[id] +accessor_is_will_set( //dir=decl + int id: @accessor ref +); + +#keyset[id] +accessor_is_did_set( //dir=decl + int id: @accessor ref +); + +#keyset[id] +accessor_is_read( //dir=decl + int id: @accessor ref +); + +#keyset[id] +accessor_is_modify( //dir=decl + int id: @accessor ref +); + +#keyset[id] +accessor_is_unsafe_address( //dir=decl + int id: @accessor ref +); + +#keyset[id] +accessor_is_unsafe_mutable_address( //dir=decl + int id: @accessor ref +); + +associated_type_decls( //dir=decl + unique int id: @associated_type_decl +); + +concrete_var_decls( //dir=decl + unique int id: @concrete_var_decl, + int introducer_int: int ref +); + +generic_type_param_decls( //dir=decl + unique int id: @generic_type_param_decl +); + +named_functions( //dir=decl + unique int id: @named_function +); + +@nominal_type_decl = + @class_decl +| @enum_decl +| @protocol_decl +| @struct_decl +; + +#keyset[id] +nominal_type_decls( //dir=decl + int id: @nominal_type_decl ref, + int type_: @type_or_none ref +); + +opaque_type_decls( //dir=decl + unique int id: @opaque_type_decl, + int naming_declaration: @value_decl_or_none ref +); + +#keyset[id, index] +opaque_type_decl_opaque_generic_params( //dir=decl + int id: @opaque_type_decl ref, + int index: int ref, + int opaque_generic_param: @generic_type_param_type_or_none ref +); + +param_decls( //dir=decl + unique int id: @param_decl +); + +#keyset[id] +param_decl_is_inout( //dir=decl + int id: @param_decl ref +); + +#keyset[id] +param_decl_property_wrapper_local_wrapped_var_bindings( //dir=decl + int id: @param_decl ref, + int property_wrapper_local_wrapped_var_binding: @pattern_binding_decl_or_none ref +); + +#keyset[id] +param_decl_property_wrapper_local_wrapped_vars( //dir=decl + int id: @param_decl ref, + int property_wrapper_local_wrapped_var: @var_decl_or_none ref +); + +type_alias_decls( //dir=decl + unique int id: @type_alias_decl, + int aliased_type: @type_or_none ref +); + +class_decls( //dir=decl + unique int id: @class_decl +); + +enum_decls( //dir=decl + unique int id: @enum_decl +); + +protocol_decls( //dir=decl + unique int id: @protocol_decl +); + +struct_decls( //dir=decl + unique int id: @struct_decl +); + +arguments( //dir=expr + unique int id: @argument, + string label: string ref, + int expr: @expr_or_none ref +); + +@expr = + @any_try_expr +| @applied_property_wrapper_expr +| @apply_expr +| @assign_expr +| @bind_optional_expr +| @capture_list_expr +| @closure_expr +| @collection_expr +| @decl_ref_expr +| @default_argument_expr +| @discard_assignment_expr +| @dot_syntax_base_ignored_expr +| @dynamic_type_expr +| @enum_is_case_expr +| @error_expr +| @explicit_cast_expr +| @force_value_expr +| @identity_expr +| @if_expr +| @implicit_conversion_expr +| @in_out_expr +| @key_path_application_expr +| @key_path_dot_expr +| @key_path_expr +| @lazy_initialization_expr +| @literal_expr +| @lookup_expr +| @make_temporarily_escapable_expr +| @obj_c_selector_expr +| @one_way_expr +| @opaque_value_expr +| @open_existential_expr +| @optional_evaluation_expr +| @other_initializer_ref_expr +| @overloaded_decl_ref_expr +| @property_wrapper_value_placeholder_expr +| @rebind_self_in_initializer_expr +| @sequence_expr +| @super_ref_expr +| @tap_expr +| @tuple_element_expr +| @tuple_expr +| @type_expr +| @unresolved_decl_ref_expr +| @unresolved_dot_expr +| @unresolved_member_expr +| @unresolved_pattern_expr +| @unresolved_specialize_expr +| @vararg_expansion_expr +; + +#keyset[id] +expr_types( //dir=expr + int id: @expr ref, + int type_: @type_or_none ref +); + +@any_try_expr = + @force_try_expr +| @optional_try_expr +| @try_expr +; + +#keyset[id] +any_try_exprs( //dir=expr + int id: @any_try_expr ref, + int sub_expr: @expr_or_none ref +); + +applied_property_wrapper_exprs( //dir=expr + unique int id: @applied_property_wrapper_expr, + int kind: int ref, + int value: @expr_or_none ref, + int param: @param_decl_or_none ref +); + +@apply_expr = + @binary_expr +| @call_expr +| @postfix_unary_expr +| @prefix_unary_expr +| @self_apply_expr +; + +#keyset[id] +apply_exprs( //dir=expr + int id: @apply_expr ref, + int function: @expr_or_none ref +); + +#keyset[id, index] +apply_expr_arguments( //dir=expr + int id: @apply_expr ref, + int index: int ref, + int argument: @argument_or_none ref +); + +assign_exprs( //dir=expr + unique int id: @assign_expr, + int dest: @expr_or_none ref, + int source: @expr_or_none ref +); + +bind_optional_exprs( //dir=expr + unique int id: @bind_optional_expr, + int sub_expr: @expr_or_none ref +); + +capture_list_exprs( //dir=expr + unique int id: @capture_list_expr, + int closure_body: @closure_expr_or_none ref +); + +#keyset[id, index] +capture_list_expr_binding_decls( //dir=expr + int id: @capture_list_expr ref, + int index: int ref, + int binding_decl: @pattern_binding_decl_or_none ref +); + +@closure_expr = + @auto_closure_expr +| @explicit_closure_expr +; + +@collection_expr = + @array_expr +| @dictionary_expr +; + +decl_ref_exprs( //dir=expr + unique int id: @decl_ref_expr, + int decl: @decl_or_none ref +); + +#keyset[id, index] +decl_ref_expr_replacement_types( //dir=expr + int id: @decl_ref_expr ref, + int index: int ref, + int replacement_type: @type_or_none ref +); + +#keyset[id] +decl_ref_expr_has_direct_to_storage_semantics( //dir=expr + int id: @decl_ref_expr ref +); + +#keyset[id] +decl_ref_expr_has_direct_to_implementation_semantics( //dir=expr + int id: @decl_ref_expr ref +); + +#keyset[id] +decl_ref_expr_has_ordinary_semantics( //dir=expr + int id: @decl_ref_expr ref +); + +#keyset[id] +decl_ref_expr_has_distributed_thunk_semantics( //dir=expr + int id: @decl_ref_expr ref +); + +default_argument_exprs( //dir=expr + unique int id: @default_argument_expr, + int param_decl: @param_decl_or_none ref, + int param_index: int ref +); + +#keyset[id] +default_argument_expr_caller_side_defaults( //dir=expr + int id: @default_argument_expr ref, + int caller_side_default: @expr_or_none ref +); + +discard_assignment_exprs( //dir=expr + unique int id: @discard_assignment_expr +); + +dot_syntax_base_ignored_exprs( //dir=expr + unique int id: @dot_syntax_base_ignored_expr, + int qualifier: @expr_or_none ref, + int sub_expr: @expr_or_none ref +); + +dynamic_type_exprs( //dir=expr + unique int id: @dynamic_type_expr, + int base: @expr_or_none ref +); + +enum_is_case_exprs( //dir=expr + unique int id: @enum_is_case_expr, + int sub_expr: @expr_or_none ref, + int element: @enum_element_decl_or_none ref +); + +error_exprs( //dir=expr + unique int id: @error_expr +); + +@explicit_cast_expr = + @checked_cast_expr +| @coerce_expr +; + +#keyset[id] +explicit_cast_exprs( //dir=expr + int id: @explicit_cast_expr ref, + int sub_expr: @expr_or_none ref +); + +force_value_exprs( //dir=expr + unique int id: @force_value_expr, + int sub_expr: @expr_or_none ref +); + +@identity_expr = + @await_expr +| @dot_self_expr +| @paren_expr +| @unresolved_member_chain_result_expr +; + +#keyset[id] +identity_exprs( //dir=expr + int id: @identity_expr ref, + int sub_expr: @expr_or_none ref +); + +if_exprs( //dir=expr + unique int id: @if_expr, + int condition: @expr_or_none ref, + int then_expr: @expr_or_none ref, + int else_expr: @expr_or_none ref +); + +@implicit_conversion_expr = + @abi_safe_conversion_expr +| @any_hashable_erasure_expr +| @archetype_to_super_expr +| @array_to_pointer_expr +| @bridge_from_obj_c_expr +| @bridge_to_obj_c_expr +| @class_metatype_to_object_expr +| @collection_upcast_conversion_expr +| @conditional_bridge_from_obj_c_expr +| @covariant_function_conversion_expr +| @covariant_return_conversion_expr +| @derived_to_base_expr +| @destructure_tuple_expr +| @differentiable_function_expr +| @differentiable_function_extract_original_expr +| @erasure_expr +| @existential_metatype_to_object_expr +| @foreign_object_conversion_expr +| @function_conversion_expr +| @in_out_to_pointer_expr +| @inject_into_optional_expr +| @linear_function_expr +| @linear_function_extract_original_expr +| @linear_to_differentiable_function_expr +| @load_expr +| @metatype_conversion_expr +| @pointer_to_pointer_expr +| @protocol_metatype_to_object_expr +| @string_to_pointer_expr +| @underlying_to_opaque_expr +| @unevaluated_instance_expr +| @unresolved_type_conversion_expr +; + +#keyset[id] +implicit_conversion_exprs( //dir=expr + int id: @implicit_conversion_expr ref, + int sub_expr: @expr_or_none ref +); + +in_out_exprs( //dir=expr + unique int id: @in_out_expr, + int sub_expr: @expr_or_none ref +); + +key_path_application_exprs( //dir=expr + unique int id: @key_path_application_expr, + int base: @expr_or_none ref, + int key_path: @expr_or_none ref +); + +key_path_dot_exprs( //dir=expr + unique int id: @key_path_dot_expr +); + +key_path_exprs( //dir=expr + unique int id: @key_path_expr +); + +#keyset[id] +key_path_expr_roots( //dir=expr + int id: @key_path_expr ref, + int root: @type_repr_or_none ref +); + +#keyset[id, index] +key_path_expr_components( //dir=expr + int id: @key_path_expr ref, + int index: int ref, + int component: @key_path_component_or_none ref +); + +lazy_initialization_exprs( //dir=expr + unique int id: @lazy_initialization_expr, + int sub_expr: @expr_or_none ref +); + +@literal_expr = + @builtin_literal_expr +| @interpolated_string_literal_expr +| @nil_literal_expr +| @object_literal_expr +| @regex_literal_expr +; + +@lookup_expr = + @dynamic_lookup_expr +| @member_ref_expr +| @subscript_expr +; + +#keyset[id] +lookup_exprs( //dir=expr + int id: @lookup_expr ref, + int base: @expr_or_none ref +); + +#keyset[id] +lookup_expr_members( //dir=expr + int id: @lookup_expr ref, + int member: @decl_or_none ref +); + +make_temporarily_escapable_exprs( //dir=expr + unique int id: @make_temporarily_escapable_expr, + int escaping_closure: @opaque_value_expr_or_none ref, + int nonescaping_closure: @expr_or_none ref, + int sub_expr: @expr_or_none ref +); + +obj_c_selector_exprs( //dir=expr + unique int id: @obj_c_selector_expr, + int sub_expr: @expr_or_none ref, + int method: @function_or_none ref +); + +one_way_exprs( //dir=expr + unique int id: @one_way_expr, + int sub_expr: @expr_or_none ref +); + +opaque_value_exprs( //dir=expr + unique int id: @opaque_value_expr +); + +open_existential_exprs( //dir=expr + unique int id: @open_existential_expr, + int sub_expr: @expr_or_none ref, + int existential: @expr_or_none ref, + int opaque_expr: @opaque_value_expr_or_none ref +); + +optional_evaluation_exprs( //dir=expr + unique int id: @optional_evaluation_expr, + int sub_expr: @expr_or_none ref +); + +other_initializer_ref_exprs( //dir=expr + unique int id: @other_initializer_ref_expr, + int initializer: @initializer_or_none ref +); + +overloaded_decl_ref_exprs( //dir=expr + unique int id: @overloaded_decl_ref_expr +); + +#keyset[id, index] +overloaded_decl_ref_expr_possible_declarations( //dir=expr + int id: @overloaded_decl_ref_expr ref, + int index: int ref, + int possible_declaration: @value_decl_or_none ref +); + +property_wrapper_value_placeholder_exprs( //dir=expr + unique int id: @property_wrapper_value_placeholder_expr, + int placeholder: @opaque_value_expr_or_none ref +); + +#keyset[id] +property_wrapper_value_placeholder_expr_wrapped_values( //dir=expr + int id: @property_wrapper_value_placeholder_expr ref, + int wrapped_value: @expr_or_none ref +); + +rebind_self_in_initializer_exprs( //dir=expr + unique int id: @rebind_self_in_initializer_expr, + int sub_expr: @expr_or_none ref, + int self: @var_decl_or_none ref +); + +sequence_exprs( //dir=expr + unique int id: @sequence_expr +); + +#keyset[id, index] +sequence_expr_elements( //dir=expr + int id: @sequence_expr ref, + int index: int ref, + int element: @expr_or_none ref +); + +super_ref_exprs( //dir=expr + unique int id: @super_ref_expr, + int self: @var_decl_or_none ref +); + +tap_exprs( //dir=expr + unique int id: @tap_expr, + int body: @brace_stmt_or_none ref, + int var: @var_decl_or_none ref +); + +#keyset[id] +tap_expr_sub_exprs( //dir=expr + int id: @tap_expr ref, + int sub_expr: @expr_or_none ref +); + +tuple_element_exprs( //dir=expr + unique int id: @tuple_element_expr, + int sub_expr: @expr_or_none ref, + int index: int ref +); + +tuple_exprs( //dir=expr + unique int id: @tuple_expr +); + +#keyset[id, index] +tuple_expr_elements( //dir=expr + int id: @tuple_expr ref, + int index: int ref, + int element: @expr_or_none ref +); + +type_exprs( //dir=expr + unique int id: @type_expr +); + +#keyset[id] +type_expr_type_reprs( //dir=expr + int id: @type_expr ref, + int type_repr: @type_repr_or_none ref +); + +unresolved_decl_ref_exprs( //dir=expr + unique int id: @unresolved_decl_ref_expr +); + +#keyset[id] +unresolved_decl_ref_expr_names( //dir=expr + int id: @unresolved_decl_ref_expr ref, + string name: string ref +); + +unresolved_dot_exprs( //dir=expr + unique int id: @unresolved_dot_expr, + int base: @expr_or_none ref, + string name: string ref +); + +unresolved_member_exprs( //dir=expr + unique int id: @unresolved_member_expr, + string name: string ref +); + +unresolved_pattern_exprs( //dir=expr + unique int id: @unresolved_pattern_expr, + int sub_pattern: @pattern_or_none ref +); + +unresolved_specialize_exprs( //dir=expr + unique int id: @unresolved_specialize_expr, + int sub_expr: @expr_or_none ref +); + +vararg_expansion_exprs( //dir=expr + unique int id: @vararg_expansion_expr, + int sub_expr: @expr_or_none ref +); + +abi_safe_conversion_exprs( //dir=expr + unique int id: @abi_safe_conversion_expr +); + +any_hashable_erasure_exprs( //dir=expr + unique int id: @any_hashable_erasure_expr +); + +archetype_to_super_exprs( //dir=expr + unique int id: @archetype_to_super_expr +); + +array_exprs( //dir=expr + unique int id: @array_expr +); + +#keyset[id, index] +array_expr_elements( //dir=expr + int id: @array_expr ref, + int index: int ref, + int element: @expr_or_none ref +); + +array_to_pointer_exprs( //dir=expr + unique int id: @array_to_pointer_expr +); + +auto_closure_exprs( //dir=expr + unique int id: @auto_closure_expr +); + +await_exprs( //dir=expr + unique int id: @await_expr +); + +binary_exprs( //dir=expr + unique int id: @binary_expr +); + +bridge_from_obj_c_exprs( //dir=expr + unique int id: @bridge_from_obj_c_expr +); + +bridge_to_obj_c_exprs( //dir=expr + unique int id: @bridge_to_obj_c_expr +); + +@builtin_literal_expr = + @boolean_literal_expr +| @magic_identifier_literal_expr +| @number_literal_expr +| @string_literal_expr +; + +call_exprs( //dir=expr + unique int id: @call_expr +); + +@checked_cast_expr = + @conditional_checked_cast_expr +| @forced_checked_cast_expr +| @is_expr +; + +class_metatype_to_object_exprs( //dir=expr + unique int id: @class_metatype_to_object_expr +); + +coerce_exprs( //dir=expr + unique int id: @coerce_expr +); + +collection_upcast_conversion_exprs( //dir=expr + unique int id: @collection_upcast_conversion_expr +); + +conditional_bridge_from_obj_c_exprs( //dir=expr + unique int id: @conditional_bridge_from_obj_c_expr +); + +covariant_function_conversion_exprs( //dir=expr + unique int id: @covariant_function_conversion_expr +); + +covariant_return_conversion_exprs( //dir=expr + unique int id: @covariant_return_conversion_expr +); + +derived_to_base_exprs( //dir=expr + unique int id: @derived_to_base_expr +); + +destructure_tuple_exprs( //dir=expr + unique int id: @destructure_tuple_expr +); + +dictionary_exprs( //dir=expr + unique int id: @dictionary_expr +); + +#keyset[id, index] +dictionary_expr_elements( //dir=expr + int id: @dictionary_expr ref, + int index: int ref, + int element: @expr_or_none ref +); + +differentiable_function_exprs( //dir=expr + unique int id: @differentiable_function_expr +); + +differentiable_function_extract_original_exprs( //dir=expr + unique int id: @differentiable_function_extract_original_expr +); + +dot_self_exprs( //dir=expr + unique int id: @dot_self_expr +); + +@dynamic_lookup_expr = + @dynamic_member_ref_expr +| @dynamic_subscript_expr +; + +erasure_exprs( //dir=expr + unique int id: @erasure_expr +); + +existential_metatype_to_object_exprs( //dir=expr + unique int id: @existential_metatype_to_object_expr +); + +explicit_closure_exprs( //dir=expr + unique int id: @explicit_closure_expr +); + +force_try_exprs( //dir=expr + unique int id: @force_try_expr +); + +foreign_object_conversion_exprs( //dir=expr + unique int id: @foreign_object_conversion_expr +); + +function_conversion_exprs( //dir=expr + unique int id: @function_conversion_expr +); + +in_out_to_pointer_exprs( //dir=expr + unique int id: @in_out_to_pointer_expr +); + +inject_into_optional_exprs( //dir=expr + unique int id: @inject_into_optional_expr +); + +interpolated_string_literal_exprs( //dir=expr + unique int id: @interpolated_string_literal_expr +); + +#keyset[id] +interpolated_string_literal_expr_interpolation_exprs( //dir=expr + int id: @interpolated_string_literal_expr ref, + int interpolation_expr: @opaque_value_expr_or_none ref +); + +#keyset[id] +interpolated_string_literal_expr_appending_exprs( //dir=expr + int id: @interpolated_string_literal_expr ref, + int appending_expr: @tap_expr_or_none ref +); + +linear_function_exprs( //dir=expr + unique int id: @linear_function_expr +); + +linear_function_extract_original_exprs( //dir=expr + unique int id: @linear_function_extract_original_expr +); + +linear_to_differentiable_function_exprs( //dir=expr + unique int id: @linear_to_differentiable_function_expr +); + +load_exprs( //dir=expr + unique int id: @load_expr +); + +member_ref_exprs( //dir=expr + unique int id: @member_ref_expr +); + +#keyset[id] +member_ref_expr_has_direct_to_storage_semantics( //dir=expr + int id: @member_ref_expr ref +); + +#keyset[id] +member_ref_expr_has_direct_to_implementation_semantics( //dir=expr + int id: @member_ref_expr ref +); + +#keyset[id] +member_ref_expr_has_ordinary_semantics( //dir=expr + int id: @member_ref_expr ref +); + +#keyset[id] +member_ref_expr_has_distributed_thunk_semantics( //dir=expr + int id: @member_ref_expr ref +); + +metatype_conversion_exprs( //dir=expr + unique int id: @metatype_conversion_expr +); + +nil_literal_exprs( //dir=expr + unique int id: @nil_literal_expr +); + +object_literal_exprs( //dir=expr + unique int id: @object_literal_expr, + int kind: int ref +); + +#keyset[id, index] +object_literal_expr_arguments( //dir=expr + int id: @object_literal_expr ref, + int index: int ref, + int argument: @argument_or_none ref +); + +optional_try_exprs( //dir=expr + unique int id: @optional_try_expr +); + +paren_exprs( //dir=expr + unique int id: @paren_expr +); + +pointer_to_pointer_exprs( //dir=expr + unique int id: @pointer_to_pointer_expr +); + +postfix_unary_exprs( //dir=expr + unique int id: @postfix_unary_expr +); + +prefix_unary_exprs( //dir=expr + unique int id: @prefix_unary_expr +); + +protocol_metatype_to_object_exprs( //dir=expr + unique int id: @protocol_metatype_to_object_expr +); + +regex_literal_exprs( //dir=expr + unique int id: @regex_literal_expr, + string pattern: string ref, + int version: int ref +); + +@self_apply_expr = + @dot_syntax_call_expr +| @initializer_ref_call_expr +; + +#keyset[id] +self_apply_exprs( //dir=expr + int id: @self_apply_expr ref, + int base: @expr_or_none ref +); + +string_to_pointer_exprs( //dir=expr + unique int id: @string_to_pointer_expr +); + +subscript_exprs( //dir=expr + unique int id: @subscript_expr +); + +#keyset[id, index] +subscript_expr_arguments( //dir=expr + int id: @subscript_expr ref, + int index: int ref, + int argument: @argument_or_none ref +); + +#keyset[id] +subscript_expr_has_direct_to_storage_semantics( //dir=expr + int id: @subscript_expr ref +); + +#keyset[id] +subscript_expr_has_direct_to_implementation_semantics( //dir=expr + int id: @subscript_expr ref +); + +#keyset[id] +subscript_expr_has_ordinary_semantics( //dir=expr + int id: @subscript_expr ref +); + +#keyset[id] +subscript_expr_has_distributed_thunk_semantics( //dir=expr + int id: @subscript_expr ref +); + +try_exprs( //dir=expr + unique int id: @try_expr +); + +underlying_to_opaque_exprs( //dir=expr + unique int id: @underlying_to_opaque_expr +); + +unevaluated_instance_exprs( //dir=expr + unique int id: @unevaluated_instance_expr +); + +unresolved_member_chain_result_exprs( //dir=expr + unique int id: @unresolved_member_chain_result_expr +); + +unresolved_type_conversion_exprs( //dir=expr + unique int id: @unresolved_type_conversion_expr +); + +boolean_literal_exprs( //dir=expr + unique int id: @boolean_literal_expr, + boolean value: boolean ref +); + +conditional_checked_cast_exprs( //dir=expr + unique int id: @conditional_checked_cast_expr +); + +dot_syntax_call_exprs( //dir=expr + unique int id: @dot_syntax_call_expr +); + +dynamic_member_ref_exprs( //dir=expr + unique int id: @dynamic_member_ref_expr +); + +dynamic_subscript_exprs( //dir=expr + unique int id: @dynamic_subscript_expr +); + +forced_checked_cast_exprs( //dir=expr + unique int id: @forced_checked_cast_expr +); + +initializer_ref_call_exprs( //dir=expr + unique int id: @initializer_ref_call_expr +); + +is_exprs( //dir=expr + unique int id: @is_expr +); + +magic_identifier_literal_exprs( //dir=expr + unique int id: @magic_identifier_literal_expr, + string kind: string ref +); + +@number_literal_expr = + @float_literal_expr +| @integer_literal_expr +; + +string_literal_exprs( //dir=expr + unique int id: @string_literal_expr, + string value: string ref +); + +float_literal_exprs( //dir=expr + unique int id: @float_literal_expr, + string string_value: string ref +); + +integer_literal_exprs( //dir=expr + unique int id: @integer_literal_expr, + string string_value: string ref +); + +@pattern = + @any_pattern +| @binding_pattern +| @bool_pattern +| @enum_element_pattern +| @expr_pattern +| @is_pattern +| @named_pattern +| @optional_some_pattern +| @paren_pattern +| @tuple_pattern +| @typed_pattern +; + +any_patterns( //dir=pattern + unique int id: @any_pattern +); + +binding_patterns( //dir=pattern + unique int id: @binding_pattern, + int sub_pattern: @pattern_or_none ref +); + +bool_patterns( //dir=pattern + unique int id: @bool_pattern, + boolean value: boolean ref +); + +enum_element_patterns( //dir=pattern + unique int id: @enum_element_pattern, + int element: @enum_element_decl_or_none ref +); + +#keyset[id] +enum_element_pattern_sub_patterns( //dir=pattern + int id: @enum_element_pattern ref, + int sub_pattern: @pattern_or_none ref +); + +expr_patterns( //dir=pattern + unique int id: @expr_pattern, + int sub_expr: @expr_or_none ref +); + +is_patterns( //dir=pattern + unique int id: @is_pattern +); + +#keyset[id] +is_pattern_cast_type_reprs( //dir=pattern + int id: @is_pattern ref, + int cast_type_repr: @type_repr_or_none ref +); + +#keyset[id] +is_pattern_sub_patterns( //dir=pattern + int id: @is_pattern ref, + int sub_pattern: @pattern_or_none ref +); + +named_patterns( //dir=pattern + unique int id: @named_pattern, + string name: string ref +); + +optional_some_patterns( //dir=pattern + unique int id: @optional_some_pattern, + int sub_pattern: @pattern_or_none ref +); + +paren_patterns( //dir=pattern + unique int id: @paren_pattern, + int sub_pattern: @pattern_or_none ref +); + +tuple_patterns( //dir=pattern + unique int id: @tuple_pattern +); + +#keyset[id, index] +tuple_pattern_elements( //dir=pattern + int id: @tuple_pattern ref, + int index: int ref, + int element: @pattern_or_none ref +); + +typed_patterns( //dir=pattern + unique int id: @typed_pattern, + int sub_pattern: @pattern_or_none ref +); + +#keyset[id] +typed_pattern_type_reprs( //dir=pattern + int id: @typed_pattern ref, + int type_repr: @type_repr_or_none ref +); + +case_label_items( //dir=stmt + unique int id: @case_label_item, + int pattern: @pattern_or_none ref +); + +#keyset[id] +case_label_item_guards( //dir=stmt + int id: @case_label_item ref, + int guard: @expr_or_none ref +); + +condition_elements( //dir=stmt + unique int id: @condition_element +); + +#keyset[id] +condition_element_booleans( //dir=stmt + int id: @condition_element ref, + int boolean_: @expr_or_none ref +); + +#keyset[id] +condition_element_patterns( //dir=stmt + int id: @condition_element ref, + int pattern: @pattern_or_none ref +); + +#keyset[id] +condition_element_initializers( //dir=stmt + int id: @condition_element ref, + int initializer: @expr_or_none ref +); + +#keyset[id] +condition_element_availabilities( //dir=stmt + int id: @condition_element ref, + int availability: @availability_info_or_none ref +); + +@stmt = + @brace_stmt +| @break_stmt +| @case_stmt +| @continue_stmt +| @defer_stmt +| @fail_stmt +| @fallthrough_stmt +| @labeled_stmt +| @pound_assert_stmt +| @return_stmt +| @throw_stmt +| @yield_stmt +; + +stmt_conditions( //dir=stmt + unique int id: @stmt_condition +); + +#keyset[id, index] +stmt_condition_elements( //dir=stmt + int id: @stmt_condition ref, + int index: int ref, + int element: @condition_element_or_none ref +); + +brace_stmts( //dir=stmt + unique int id: @brace_stmt +); + +#keyset[id, index] +brace_stmt_elements( //dir=stmt + int id: @brace_stmt ref, + int index: int ref, + int element: @ast_node_or_none ref +); + +break_stmts( //dir=stmt + unique int id: @break_stmt +); + +#keyset[id] +break_stmt_target_names( //dir=stmt + int id: @break_stmt ref, + string target_name: string ref +); + +#keyset[id] +break_stmt_targets( //dir=stmt + int id: @break_stmt ref, + int target: @stmt_or_none ref +); + +case_stmts( //dir=stmt + unique int id: @case_stmt, + int body: @stmt_or_none ref +); + +#keyset[id, index] +case_stmt_labels( //dir=stmt + int id: @case_stmt ref, + int index: int ref, + int label: @case_label_item_or_none ref +); + +#keyset[id, index] +case_stmt_variables( //dir=stmt + int id: @case_stmt ref, + int index: int ref, + int variable: @var_decl_or_none ref +); + +continue_stmts( //dir=stmt + unique int id: @continue_stmt +); + +#keyset[id] +continue_stmt_target_names( //dir=stmt + int id: @continue_stmt ref, + string target_name: string ref +); + +#keyset[id] +continue_stmt_targets( //dir=stmt + int id: @continue_stmt ref, + int target: @stmt_or_none ref +); + +defer_stmts( //dir=stmt + unique int id: @defer_stmt, + int body: @brace_stmt_or_none ref +); + +fail_stmts( //dir=stmt + unique int id: @fail_stmt +); + +fallthrough_stmts( //dir=stmt + unique int id: @fallthrough_stmt, + int fallthrough_source: @case_stmt_or_none ref, + int fallthrough_dest: @case_stmt_or_none ref +); + +@labeled_stmt = + @do_catch_stmt +| @do_stmt +| @for_each_stmt +| @labeled_conditional_stmt +| @repeat_while_stmt +| @switch_stmt +; + +#keyset[id] +labeled_stmt_labels( //dir=stmt + int id: @labeled_stmt ref, + string label: string ref +); + +pound_assert_stmts( //dir=stmt + unique int id: @pound_assert_stmt, + int condition: @expr_or_none ref, + string message: string ref +); + +return_stmts( //dir=stmt + unique int id: @return_stmt +); + +#keyset[id] +return_stmt_results( //dir=stmt + int id: @return_stmt ref, + int result: @expr_or_none ref +); + +throw_stmts( //dir=stmt + unique int id: @throw_stmt, + int sub_expr: @expr_or_none ref +); + +yield_stmts( //dir=stmt + unique int id: @yield_stmt +); + +#keyset[id, index] +yield_stmt_results( //dir=stmt + int id: @yield_stmt ref, + int index: int ref, + int result: @expr_or_none ref +); + +do_catch_stmts( //dir=stmt + unique int id: @do_catch_stmt, + int body: @stmt_or_none ref +); + +#keyset[id, index] +do_catch_stmt_catches( //dir=stmt + int id: @do_catch_stmt ref, + int index: int ref, + int catch: @case_stmt_or_none ref +); + +do_stmts( //dir=stmt + unique int id: @do_stmt, + int body: @brace_stmt_or_none ref +); + +for_each_stmts( //dir=stmt + unique int id: @for_each_stmt, + int pattern: @pattern_or_none ref, + int body: @brace_stmt_or_none ref +); + +#keyset[id] +for_each_stmt_wheres( //dir=stmt + int id: @for_each_stmt ref, + int where: @expr_or_none ref +); + +#keyset[id] +for_each_stmt_iterator_vars( //dir=stmt + int id: @for_each_stmt ref, + int iteratorVar: @pattern_binding_decl_or_none ref +); + +#keyset[id] +for_each_stmt_next_calls( //dir=stmt + int id: @for_each_stmt ref, + int nextCall: @expr_or_none ref +); + +@labeled_conditional_stmt = + @guard_stmt +| @if_stmt +| @while_stmt +; + +#keyset[id] +labeled_conditional_stmts( //dir=stmt + int id: @labeled_conditional_stmt ref, + int condition: @stmt_condition_or_none ref +); + +repeat_while_stmts( //dir=stmt + unique int id: @repeat_while_stmt, + int condition: @expr_or_none ref, + int body: @stmt_or_none ref +); + +switch_stmts( //dir=stmt + unique int id: @switch_stmt, + int expr: @expr_or_none ref +); + +#keyset[id, index] +switch_stmt_cases( //dir=stmt + int id: @switch_stmt ref, + int index: int ref, + int case_: @case_stmt_or_none ref +); + +guard_stmts( //dir=stmt + unique int id: @guard_stmt, + int body: @brace_stmt_or_none ref +); + +if_stmts( //dir=stmt + unique int id: @if_stmt, + int then: @stmt_or_none ref +); + +#keyset[id] +if_stmt_elses( //dir=stmt + int id: @if_stmt ref, + int else: @stmt_or_none ref +); + +while_stmts( //dir=stmt + unique int id: @while_stmt, + int body: @stmt_or_none ref +); + +@type = + @any_function_type +| @any_generic_type +| @any_metatype_type +| @builtin_type +| @dependent_member_type +| @dynamic_self_type +| @error_type +| @existential_type +| @in_out_type +| @l_value_type +| @module_type +| @parameterized_protocol_type +| @protocol_composition_type +| @reference_storage_type +| @substitutable_type +| @sugar_type +| @tuple_type +| @unresolved_type +; + +#keyset[id] +types( //dir=type + int id: @type ref, + string name: string ref, + int canonical_type: @type_or_none ref +); + +type_reprs( //dir=type + unique int id: @type_repr, + int type_: @type_or_none ref +); + +@any_function_type = + @function_type +| @generic_function_type +; + +#keyset[id] +any_function_types( //dir=type + int id: @any_function_type ref, + int result: @type_or_none ref +); + +#keyset[id, index] +any_function_type_param_types( //dir=type + int id: @any_function_type ref, + int index: int ref, + int param_type: @type_or_none ref +); + +#keyset[id] +any_function_type_is_throwing( //dir=type + int id: @any_function_type ref +); + +#keyset[id] +any_function_type_is_async( //dir=type + int id: @any_function_type ref +); + +@any_generic_type = + @nominal_or_bound_generic_nominal_type +| @unbound_generic_type +; + +#keyset[id] +any_generic_types( //dir=type + int id: @any_generic_type ref, + int declaration: @generic_type_decl_or_none ref +); + +#keyset[id] +any_generic_type_parents( //dir=type + int id: @any_generic_type ref, + int parent: @type_or_none ref +); + +@any_metatype_type = + @existential_metatype_type +| @metatype_type +; + +@builtin_type = + @any_builtin_integer_type +| @builtin_bridge_object_type +| @builtin_default_actor_storage_type +| @builtin_executor_type +| @builtin_float_type +| @builtin_job_type +| @builtin_native_object_type +| @builtin_raw_pointer_type +| @builtin_raw_unsafe_continuation_type +| @builtin_unsafe_value_buffer_type +| @builtin_vector_type +; + +dependent_member_types( //dir=type + unique int id: @dependent_member_type, + int base_type: @type_or_none ref, + int associated_type_decl: @associated_type_decl_or_none ref +); + +dynamic_self_types( //dir=type + unique int id: @dynamic_self_type, + int static_self_type: @type_or_none ref +); + +error_types( //dir=type + unique int id: @error_type +); + +existential_types( //dir=type + unique int id: @existential_type, + int constraint: @type_or_none ref +); + +in_out_types( //dir=type + unique int id: @in_out_type, + int object_type: @type_or_none ref +); + +l_value_types( //dir=type + unique int id: @l_value_type, + int object_type: @type_or_none ref +); + +module_types( //dir=type + unique int id: @module_type, + int module: @module_decl_or_none ref +); + +parameterized_protocol_types( //dir=type + unique int id: @parameterized_protocol_type, + int base: @protocol_type_or_none ref +); + +#keyset[id, index] +parameterized_protocol_type_args( //dir=type + int id: @parameterized_protocol_type ref, + int index: int ref, + int arg: @type_or_none ref +); + +protocol_composition_types( //dir=type + unique int id: @protocol_composition_type +); + +#keyset[id, index] +protocol_composition_type_members( //dir=type + int id: @protocol_composition_type ref, + int index: int ref, + int member: @type_or_none ref +); + +@reference_storage_type = + @unmanaged_storage_type +| @unowned_storage_type +| @weak_storage_type +; + +#keyset[id] +reference_storage_types( //dir=type + int id: @reference_storage_type ref, + int referent_type: @type_or_none ref +); + +@substitutable_type = + @archetype_type +| @generic_type_param_type +; + +@sugar_type = + @paren_type +| @syntax_sugar_type +| @type_alias_type +; + +tuple_types( //dir=type + unique int id: @tuple_type +); + +#keyset[id, index] +tuple_type_types( //dir=type + int id: @tuple_type ref, + int index: int ref, + int type_: @type_or_none ref +); + +#keyset[id, index] +tuple_type_names( //dir=type + int id: @tuple_type ref, + int index: int ref, + string name: string ref +); + +unresolved_types( //dir=type + unique int id: @unresolved_type +); + +@any_builtin_integer_type = + @builtin_integer_literal_type +| @builtin_integer_type +; + +@archetype_type = + @opaque_type_archetype_type +| @opened_archetype_type +| @primary_archetype_type +; + +#keyset[id] +archetype_types( //dir=type + int id: @archetype_type ref, + int interface_type: @type_or_none ref +); + +#keyset[id] +archetype_type_superclasses( //dir=type + int id: @archetype_type ref, + int superclass: @type_or_none ref +); + +#keyset[id, index] +archetype_type_protocols( //dir=type + int id: @archetype_type ref, + int index: int ref, + int protocol: @protocol_decl_or_none ref +); + +builtin_bridge_object_types( //dir=type + unique int id: @builtin_bridge_object_type +); + +builtin_default_actor_storage_types( //dir=type + unique int id: @builtin_default_actor_storage_type +); + +builtin_executor_types( //dir=type + unique int id: @builtin_executor_type +); + +builtin_float_types( //dir=type + unique int id: @builtin_float_type +); + +builtin_job_types( //dir=type + unique int id: @builtin_job_type +); + +builtin_native_object_types( //dir=type + unique int id: @builtin_native_object_type +); + +builtin_raw_pointer_types( //dir=type + unique int id: @builtin_raw_pointer_type +); + +builtin_raw_unsafe_continuation_types( //dir=type + unique int id: @builtin_raw_unsafe_continuation_type +); + +builtin_unsafe_value_buffer_types( //dir=type + unique int id: @builtin_unsafe_value_buffer_type +); + +builtin_vector_types( //dir=type + unique int id: @builtin_vector_type +); + +existential_metatype_types( //dir=type + unique int id: @existential_metatype_type +); + +function_types( //dir=type + unique int id: @function_type +); + +generic_function_types( //dir=type + unique int id: @generic_function_type +); + +#keyset[id, index] +generic_function_type_generic_params( //dir=type + int id: @generic_function_type ref, + int index: int ref, + int generic_param: @generic_type_param_type_or_none ref +); + +generic_type_param_types( //dir=type + unique int id: @generic_type_param_type +); + +metatype_types( //dir=type + unique int id: @metatype_type +); + +@nominal_or_bound_generic_nominal_type = + @bound_generic_type +| @nominal_type +; + +paren_types( //dir=type + unique int id: @paren_type, + int type_: @type_or_none ref +); + +@syntax_sugar_type = + @dictionary_type +| @unary_syntax_sugar_type +; + +type_alias_types( //dir=type + unique int id: @type_alias_type, + int decl: @type_alias_decl_or_none ref +); + +unbound_generic_types( //dir=type + unique int id: @unbound_generic_type +); + +unmanaged_storage_types( //dir=type + unique int id: @unmanaged_storage_type +); + +unowned_storage_types( //dir=type + unique int id: @unowned_storage_type +); + +weak_storage_types( //dir=type + unique int id: @weak_storage_type +); + +@bound_generic_type = + @bound_generic_class_type +| @bound_generic_enum_type +| @bound_generic_struct_type +; + +#keyset[id, index] +bound_generic_type_arg_types( //dir=type + int id: @bound_generic_type ref, + int index: int ref, + int arg_type: @type_or_none ref +); + +builtin_integer_literal_types( //dir=type + unique int id: @builtin_integer_literal_type +); + +builtin_integer_types( //dir=type + unique int id: @builtin_integer_type +); + +#keyset[id] +builtin_integer_type_widths( //dir=type + int id: @builtin_integer_type ref, + int width: int ref +); + +dictionary_types( //dir=type + unique int id: @dictionary_type, + int key_type: @type_or_none ref, + int value_type: @type_or_none ref +); + +@nominal_type = + @class_type +| @enum_type +| @protocol_type +| @struct_type +; + +opaque_type_archetype_types( //dir=type + unique int id: @opaque_type_archetype_type, + int declaration: @opaque_type_decl_or_none ref +); + +opened_archetype_types( //dir=type + unique int id: @opened_archetype_type +); + +primary_archetype_types( //dir=type + unique int id: @primary_archetype_type +); + +@unary_syntax_sugar_type = + @array_slice_type +| @optional_type +| @variadic_sequence_type +; + +#keyset[id] +unary_syntax_sugar_types( //dir=type + int id: @unary_syntax_sugar_type ref, + int base_type: @type_or_none ref +); + +array_slice_types( //dir=type + unique int id: @array_slice_type +); + +bound_generic_class_types( //dir=type + unique int id: @bound_generic_class_type +); + +bound_generic_enum_types( //dir=type + unique int id: @bound_generic_enum_type +); + +bound_generic_struct_types( //dir=type + unique int id: @bound_generic_struct_type +); + +class_types( //dir=type + unique int id: @class_type +); + +enum_types( //dir=type + unique int id: @enum_type +); + +optional_types( //dir=type + unique int id: @optional_type +); + +protocol_types( //dir=type + unique int id: @protocol_type +); + +struct_types( //dir=type + unique int id: @struct_type +); + +variadic_sequence_types( //dir=type + unique int id: @variadic_sequence_type +); + +@accessor_or_none = + @accessor +| @unspecified_element +; + +@argument_or_none = + @argument +| @unspecified_element +; + +@associated_type_decl_or_none = + @associated_type_decl +| @unspecified_element +; + +@ast_node_or_none = + @ast_node +| @unspecified_element +; + +@availability_info_or_none = + @availability_info +| @unspecified_element +; + +@availability_spec_or_none = + @availability_spec +| @unspecified_element +; + +@brace_stmt_or_none = + @brace_stmt +| @unspecified_element +; + +@captured_decl_or_none = + @captured_decl +| @unspecified_element +; + +@case_label_item_or_none = + @case_label_item +| @unspecified_element +; + +@case_stmt_or_none = + @case_stmt +| @unspecified_element +; + +@closure_expr_or_none = + @closure_expr +| @unspecified_element +; + +@condition_element_or_none = + @condition_element +| @unspecified_element +; + +@decl_or_none = + @decl +| @unspecified_element +; + +@enum_element_decl_or_none = + @enum_element_decl +| @unspecified_element +; + +@expr_or_none = + @expr +| @unspecified_element +; + +@file_or_none = + @file +| @unspecified_element +; + +@function_or_none = + @function +| @unspecified_element +; + +@generic_type_decl_or_none = + @generic_type_decl +| @unspecified_element +; + +@generic_type_param_decl_or_none = + @generic_type_param_decl +| @unspecified_element +; + +@generic_type_param_type_or_none = + @generic_type_param_type +| @unspecified_element +; + +@initializer_or_none = + @initializer +| @unspecified_element +; + +@key_path_component_or_none = + @key_path_component +| @unspecified_element +; + +@location_or_none = + @location +| @unspecified_element +; + +@module_decl_or_none = + @module_decl +| @unspecified_element +; + +@nominal_type_decl_or_none = + @nominal_type_decl +| @unspecified_element +; + +@opaque_type_decl_or_none = + @opaque_type_decl +| @unspecified_element +; + +@opaque_value_expr_or_none = + @opaque_value_expr +| @unspecified_element +; + +@param_decl_or_none = + @param_decl +| @unspecified_element +; + +@pattern_or_none = + @pattern +| @unspecified_element +; + +@pattern_binding_decl_or_none = + @pattern_binding_decl +| @unspecified_element +; + +@precedence_group_decl_or_none = + @precedence_group_decl +| @unspecified_element +; + +@protocol_decl_or_none = + @protocol_decl +| @unspecified_element +; + +@protocol_type_or_none = + @protocol_type +| @unspecified_element +; + +@stmt_or_none = + @stmt +| @unspecified_element +; + +@stmt_condition_or_none = + @stmt_condition +| @unspecified_element +; + +@string_literal_expr_or_none = + @string_literal_expr +| @unspecified_element +; + +@tap_expr_or_none = + @tap_expr +| @unspecified_element +; + +@type_or_none = + @type +| @unspecified_element +; + +@type_alias_decl_or_none = + @type_alias_decl +| @unspecified_element +; + +@type_repr_or_none = + @type_repr +| @unspecified_element +; + +@value_decl_or_none = + @unspecified_element +| @value_decl +; + +@var_decl_or_none = + @unspecified_element +| @var_decl +; diff --git a/swift/downgrades/7c17e1f4b2d30f2da05bfa667c621ddd418eb151/upgrade.properties b/swift/downgrades/7c17e1f4b2d30f2da05bfa667c621ddd418eb151/upgrade.properties new file mode 100644 index 000000000000..1e1a11ca5b03 --- /dev/null +++ b/swift/downgrades/7c17e1f4b2d30f2da05bfa667c621ddd418eb151/upgrade.properties @@ -0,0 +1,4 @@ +description: change the second column in named_patterns to a string +compatibility: full + +named_patterns.rel: run named_patterns.ql \ No newline at end of file diff --git a/swift/ql/lib/upgrades/c0db61944f46ba5507f207ec2b1cff77ad0529a1/named_patterns.ql b/swift/ql/lib/upgrades/c0db61944f46ba5507f207ec2b1cff77ad0529a1/named_patterns.ql new file mode 100644 index 000000000000..d1620f3aab4c --- /dev/null +++ b/swift/ql/lib/upgrades/c0db61944f46ba5507f207ec2b1cff77ad0529a1/named_patterns.ql @@ -0,0 +1,43 @@ +// Change the second column in named_patterns from a string a @var_decl using the same logic that used to be in the Swift QL libraries +class Pattern extends @pattern { + string toString() { none() } +} + +class NamedPattern extends @named_pattern { + string getName() { named_patterns(this, result) } + + VarDecl getVarDecl() { + this.getImmediateEnclosingPattern*() = result.getImmediateParentPattern() and + pragma[only_bind_out](result.getName()) = pragma[only_bind_out](this.getName()) + } + + Pattern getImmediateEnclosingPattern() { + enum_element_pattern_sub_patterns(result, this) + or + optional_some_patterns(result, this) + or + tuple_pattern_elements(result, _, this) + or + binding_patterns(result, this) + or + is_pattern_sub_patterns(result, this) + or + paren_patterns(result, this) + or + typed_patterns(result, this) + } + + string toString() { none() } +} + +class VarDecl extends @var_decl { + string getName() { var_decls(this, result, _) } + + Pattern getImmediateParentPattern() { var_decl_parent_patterns(this, result) } + + string toString() { none() } +} + +from NamedPattern np, string name, VarDecl varDecl +where np.getName() = name and varDecl = np.getVarDecl() +select np, varDecl diff --git a/swift/ql/lib/upgrades/c0db61944f46ba5507f207ec2b1cff77ad0529a1/old.dbscheme b/swift/ql/lib/upgrades/c0db61944f46ba5507f207ec2b1cff77ad0529a1/old.dbscheme new file mode 100644 index 000000000000..c0db61944f46 --- /dev/null +++ b/swift/ql/lib/upgrades/c0db61944f46ba5507f207ec2b1cff77ad0529a1/old.dbscheme @@ -0,0 +1,2636 @@ +// generated by codegen/codegen.py + +// from prefix.dbscheme +/** + * The source location of the snapshot. + */ +sourceLocationPrefix( + string prefix: string ref +); + + +// from schema.py + +@element = + @callable +| @file +| @generic_context +| @locatable +| @location +| @type +; + +#keyset[id] +element_is_unknown( + int id: @element ref +); + +@callable = + @closure_expr +| @function +; + +#keyset[id] +callable_names( + int id: @callable ref, + string name: string ref +); + +#keyset[id] +callable_self_params( + int id: @callable ref, + int self_param: @param_decl_or_none ref +); + +#keyset[id, index] +callable_params( + int id: @callable ref, + int index: int ref, + int param: @param_decl_or_none ref +); + +#keyset[id] +callable_bodies( + int id: @callable ref, + int body: @brace_stmt_or_none ref +); + +#keyset[id, index] +callable_captures( + int id: @callable ref, + int index: int ref, + int capture: @captured_decl_or_none ref +); + +@file = + @db_file +; + +#keyset[id] +files( + int id: @file ref, + string name: string ref +); + +#keyset[id] +file_is_successfully_extracted( + int id: @file ref +); + +@locatable = + @argument +| @ast_node +| @comment +| @diagnostics +| @error_element +; + +#keyset[id] +locatable_locations( + int id: @locatable ref, + int location: @location_or_none ref +); + +@location = + @db_location +; + +#keyset[id] +locations( + int id: @location ref, + int file: @file_or_none ref, + int start_line: int ref, + int start_column: int ref, + int end_line: int ref, + int end_column: int ref +); + +@ast_node = + @availability_info +| @availability_spec +| @case_label_item +| @condition_element +| @decl +| @expr +| @key_path_component +| @pattern +| @stmt +| @stmt_condition +| @type_repr +; + +comments( + unique int id: @comment, + string text: string ref +); + +db_files( + unique int id: @db_file +); + +db_locations( + unique int id: @db_location +); + +diagnostics( + unique int id: @diagnostics, + string text: string ref, + int kind: int ref +); + +@error_element = + @error_expr +| @error_type +| @overloaded_decl_ref_expr +| @unresolved_decl_ref_expr +| @unresolved_dot_expr +| @unresolved_member_chain_result_expr +| @unresolved_member_expr +| @unresolved_pattern_expr +| @unresolved_specialize_expr +| @unresolved_type +| @unresolved_type_conversion_expr +| @unspecified_element +; + +availability_infos( + unique int id: @availability_info +); + +#keyset[id] +availability_info_is_unavailable( + int id: @availability_info ref +); + +#keyset[id, index] +availability_info_specs( + int id: @availability_info ref, + int index: int ref, + int spec: @availability_spec_or_none ref +); + +@availability_spec = + @other_availability_spec +| @platform_version_availability_spec +; + +key_path_components( + unique int id: @key_path_component, + int kind: int ref, + int component_type: @type_or_none ref +); + +#keyset[id, index] +key_path_component_subscript_arguments( + int id: @key_path_component ref, + int index: int ref, + int subscript_argument: @argument_or_none ref +); + +#keyset[id] +key_path_component_tuple_indices( + int id: @key_path_component ref, + int tuple_index: int ref +); + +#keyset[id] +key_path_component_decl_refs( + int id: @key_path_component ref, + int decl_ref: @value_decl_or_none ref +); + +unspecified_elements( + unique int id: @unspecified_element, + string property: string ref, + string error: string ref +); + +#keyset[id] +unspecified_element_parents( + int id: @unspecified_element ref, + int parent: @element ref +); + +#keyset[id] +unspecified_element_indices( + int id: @unspecified_element ref, + int index: int ref +); + +#keyset[id, index] +unspecified_element_children( + int id: @unspecified_element ref, + int index: int ref, + int child: @ast_node_or_none ref +); + +other_availability_specs( + unique int id: @other_availability_spec +); + +platform_version_availability_specs( + unique int id: @platform_version_availability_spec, + string platform: string ref, + string version: string ref +); + +@decl = + @captured_decl +| @enum_case_decl +| @extension_decl +| @if_config_decl +| @import_decl +| @missing_member_decl +| @operator_decl +| @pattern_binding_decl +| @pound_diagnostic_decl +| @precedence_group_decl +| @top_level_code_decl +| @value_decl +; + +#keyset[id] +decls( //dir=decl + int id: @decl ref, + int module: @module_decl_or_none ref +); + +#keyset[id, index] +decl_members( //dir=decl + int id: @decl ref, + int index: int ref, + int member: @decl_or_none ref +); + +@generic_context = + @extension_decl +| @function +| @generic_type_decl +| @subscript_decl +; + +#keyset[id, index] +generic_context_generic_type_params( //dir=decl + int id: @generic_context ref, + int index: int ref, + int generic_type_param: @generic_type_param_decl_or_none ref +); + +captured_decls( //dir=decl + unique int id: @captured_decl, + int decl: @value_decl_or_none ref +); + +#keyset[id] +captured_decl_is_direct( //dir=decl + int id: @captured_decl ref +); + +#keyset[id] +captured_decl_is_escaping( //dir=decl + int id: @captured_decl ref +); + +enum_case_decls( //dir=decl + unique int id: @enum_case_decl +); + +#keyset[id, index] +enum_case_decl_elements( //dir=decl + int id: @enum_case_decl ref, + int index: int ref, + int element: @enum_element_decl_or_none ref +); + +extension_decls( //dir=decl + unique int id: @extension_decl, + int extended_type_decl: @nominal_type_decl_or_none ref +); + +#keyset[id, index] +extension_decl_protocols( //dir=decl + int id: @extension_decl ref, + int index: int ref, + int protocol: @protocol_decl_or_none ref +); + +if_config_decls( //dir=decl + unique int id: @if_config_decl +); + +#keyset[id, index] +if_config_decl_active_elements( //dir=decl + int id: @if_config_decl ref, + int index: int ref, + int active_element: @ast_node_or_none ref +); + +import_decls( //dir=decl + unique int id: @import_decl +); + +#keyset[id] +import_decl_is_exported( //dir=decl + int id: @import_decl ref +); + +#keyset[id] +import_decl_imported_modules( //dir=decl + int id: @import_decl ref, + int imported_module: @module_decl_or_none ref +); + +#keyset[id, index] +import_decl_declarations( //dir=decl + int id: @import_decl ref, + int index: int ref, + int declaration: @value_decl_or_none ref +); + +missing_member_decls( //dir=decl + unique int id: @missing_member_decl, + string name: string ref +); + +@operator_decl = + @infix_operator_decl +| @postfix_operator_decl +| @prefix_operator_decl +; + +#keyset[id] +operator_decls( //dir=decl + int id: @operator_decl ref, + string name: string ref +); + +pattern_binding_decls( //dir=decl + unique int id: @pattern_binding_decl +); + +#keyset[id, index] +pattern_binding_decl_inits( //dir=decl + int id: @pattern_binding_decl ref, + int index: int ref, + int init: @expr_or_none ref +); + +#keyset[id, index] +pattern_binding_decl_patterns( //dir=decl + int id: @pattern_binding_decl ref, + int index: int ref, + int pattern: @pattern_or_none ref +); + +pound_diagnostic_decls( //dir=decl + unique int id: @pound_diagnostic_decl, + int kind: int ref, + int message: @string_literal_expr_or_none ref +); + +precedence_group_decls( //dir=decl + unique int id: @precedence_group_decl +); + +top_level_code_decls( //dir=decl + unique int id: @top_level_code_decl, + int body: @brace_stmt_or_none ref +); + +@value_decl = + @abstract_storage_decl +| @enum_element_decl +| @function +| @type_decl +; + +#keyset[id] +value_decls( //dir=decl + int id: @value_decl ref, + int interface_type: @type_or_none ref +); + +@abstract_storage_decl = + @subscript_decl +| @var_decl +; + +#keyset[id, index] +abstract_storage_decl_accessors( //dir=decl + int id: @abstract_storage_decl ref, + int index: int ref, + int accessor: @accessor_or_none ref +); + +enum_element_decls( //dir=decl + unique int id: @enum_element_decl, + string name: string ref +); + +#keyset[id, index] +enum_element_decl_params( //dir=decl + int id: @enum_element_decl ref, + int index: int ref, + int param: @param_decl_or_none ref +); + +@function = + @accessor_or_named_function +| @deinitializer +| @initializer +; + +infix_operator_decls( //dir=decl + unique int id: @infix_operator_decl +); + +#keyset[id] +infix_operator_decl_precedence_groups( //dir=decl + int id: @infix_operator_decl ref, + int precedence_group: @precedence_group_decl_or_none ref +); + +postfix_operator_decls( //dir=decl + unique int id: @postfix_operator_decl +); + +prefix_operator_decls( //dir=decl + unique int id: @prefix_operator_decl +); + +@type_decl = + @abstract_type_param_decl +| @generic_type_decl +| @module_decl +; + +#keyset[id] +type_decls( //dir=decl + int id: @type_decl ref, + string name: string ref +); + +#keyset[id, index] +type_decl_inherited_types( //dir=decl + int id: @type_decl ref, + int index: int ref, + int inherited_type: @type_or_none ref +); + +@abstract_type_param_decl = + @associated_type_decl +| @generic_type_param_decl +; + +@accessor_or_named_function = + @accessor +| @named_function +; + +deinitializers( //dir=decl + unique int id: @deinitializer +); + +@generic_type_decl = + @nominal_type_decl +| @opaque_type_decl +| @type_alias_decl +; + +initializers( //dir=decl + unique int id: @initializer +); + +module_decls( //dir=decl + unique int id: @module_decl +); + +#keyset[id] +module_decl_is_builtin_module( //dir=decl + int id: @module_decl ref +); + +#keyset[id] +module_decl_is_system_module( //dir=decl + int id: @module_decl ref +); + +module_decl_imported_modules( //dir=decl + int id: @module_decl ref, + int imported_module: @module_decl_or_none ref +); + +module_decl_exported_modules( //dir=decl + int id: @module_decl ref, + int exported_module: @module_decl_or_none ref +); + +subscript_decls( //dir=decl + unique int id: @subscript_decl, + int element_type: @type_or_none ref +); + +#keyset[id, index] +subscript_decl_params( //dir=decl + int id: @subscript_decl ref, + int index: int ref, + int param: @param_decl_or_none ref +); + +@var_decl = + @concrete_var_decl +| @param_decl +; + +#keyset[id] +var_decls( //dir=decl + int id: @var_decl ref, + string name: string ref, + int type_: @type_or_none ref +); + +#keyset[id] +var_decl_attached_property_wrapper_types( //dir=decl + int id: @var_decl ref, + int attached_property_wrapper_type: @type_or_none ref +); + +#keyset[id] +var_decl_parent_patterns( //dir=decl + int id: @var_decl ref, + int parent_pattern: @pattern_or_none ref +); + +#keyset[id] +var_decl_parent_initializers( //dir=decl + int id: @var_decl ref, + int parent_initializer: @expr_or_none ref +); + +#keyset[id] +var_decl_property_wrapper_backing_var_bindings( //dir=decl + int id: @var_decl ref, + int property_wrapper_backing_var_binding: @pattern_binding_decl_or_none ref +); + +#keyset[id] +var_decl_property_wrapper_backing_vars( //dir=decl + int id: @var_decl ref, + int property_wrapper_backing_var: @var_decl_or_none ref +); + +#keyset[id] +var_decl_property_wrapper_projection_var_bindings( //dir=decl + int id: @var_decl ref, + int property_wrapper_projection_var_binding: @pattern_binding_decl_or_none ref +); + +#keyset[id] +var_decl_property_wrapper_projection_vars( //dir=decl + int id: @var_decl ref, + int property_wrapper_projection_var: @var_decl_or_none ref +); + +accessors( //dir=decl + unique int id: @accessor +); + +#keyset[id] +accessor_is_getter( //dir=decl + int id: @accessor ref +); + +#keyset[id] +accessor_is_setter( //dir=decl + int id: @accessor ref +); + +#keyset[id] +accessor_is_will_set( //dir=decl + int id: @accessor ref +); + +#keyset[id] +accessor_is_did_set( //dir=decl + int id: @accessor ref +); + +#keyset[id] +accessor_is_read( //dir=decl + int id: @accessor ref +); + +#keyset[id] +accessor_is_modify( //dir=decl + int id: @accessor ref +); + +#keyset[id] +accessor_is_unsafe_address( //dir=decl + int id: @accessor ref +); + +#keyset[id] +accessor_is_unsafe_mutable_address( //dir=decl + int id: @accessor ref +); + +associated_type_decls( //dir=decl + unique int id: @associated_type_decl +); + +concrete_var_decls( //dir=decl + unique int id: @concrete_var_decl, + int introducer_int: int ref +); + +generic_type_param_decls( //dir=decl + unique int id: @generic_type_param_decl +); + +named_functions( //dir=decl + unique int id: @named_function +); + +@nominal_type_decl = + @class_decl +| @enum_decl +| @protocol_decl +| @struct_decl +; + +#keyset[id] +nominal_type_decls( //dir=decl + int id: @nominal_type_decl ref, + int type_: @type_or_none ref +); + +opaque_type_decls( //dir=decl + unique int id: @opaque_type_decl, + int naming_declaration: @value_decl_or_none ref +); + +#keyset[id, index] +opaque_type_decl_opaque_generic_params( //dir=decl + int id: @opaque_type_decl ref, + int index: int ref, + int opaque_generic_param: @generic_type_param_type_or_none ref +); + +param_decls( //dir=decl + unique int id: @param_decl +); + +#keyset[id] +param_decl_is_inout( //dir=decl + int id: @param_decl ref +); + +#keyset[id] +param_decl_property_wrapper_local_wrapped_var_bindings( //dir=decl + int id: @param_decl ref, + int property_wrapper_local_wrapped_var_binding: @pattern_binding_decl_or_none ref +); + +#keyset[id] +param_decl_property_wrapper_local_wrapped_vars( //dir=decl + int id: @param_decl ref, + int property_wrapper_local_wrapped_var: @var_decl_or_none ref +); + +type_alias_decls( //dir=decl + unique int id: @type_alias_decl, + int aliased_type: @type_or_none ref +); + +class_decls( //dir=decl + unique int id: @class_decl +); + +enum_decls( //dir=decl + unique int id: @enum_decl +); + +protocol_decls( //dir=decl + unique int id: @protocol_decl +); + +struct_decls( //dir=decl + unique int id: @struct_decl +); + +arguments( //dir=expr + unique int id: @argument, + string label: string ref, + int expr: @expr_or_none ref +); + +@expr = + @any_try_expr +| @applied_property_wrapper_expr +| @apply_expr +| @assign_expr +| @bind_optional_expr +| @capture_list_expr +| @closure_expr +| @collection_expr +| @decl_ref_expr +| @default_argument_expr +| @discard_assignment_expr +| @dot_syntax_base_ignored_expr +| @dynamic_type_expr +| @enum_is_case_expr +| @error_expr +| @explicit_cast_expr +| @force_value_expr +| @identity_expr +| @if_expr +| @implicit_conversion_expr +| @in_out_expr +| @key_path_application_expr +| @key_path_dot_expr +| @key_path_expr +| @lazy_initialization_expr +| @literal_expr +| @lookup_expr +| @make_temporarily_escapable_expr +| @obj_c_selector_expr +| @one_way_expr +| @opaque_value_expr +| @open_existential_expr +| @optional_evaluation_expr +| @other_initializer_ref_expr +| @overloaded_decl_ref_expr +| @property_wrapper_value_placeholder_expr +| @rebind_self_in_initializer_expr +| @sequence_expr +| @super_ref_expr +| @tap_expr +| @tuple_element_expr +| @tuple_expr +| @type_expr +| @unresolved_decl_ref_expr +| @unresolved_dot_expr +| @unresolved_member_expr +| @unresolved_pattern_expr +| @unresolved_specialize_expr +| @vararg_expansion_expr +; + +#keyset[id] +expr_types( //dir=expr + int id: @expr ref, + int type_: @type_or_none ref +); + +@any_try_expr = + @force_try_expr +| @optional_try_expr +| @try_expr +; + +#keyset[id] +any_try_exprs( //dir=expr + int id: @any_try_expr ref, + int sub_expr: @expr_or_none ref +); + +applied_property_wrapper_exprs( //dir=expr + unique int id: @applied_property_wrapper_expr, + int kind: int ref, + int value: @expr_or_none ref, + int param: @param_decl_or_none ref +); + +@apply_expr = + @binary_expr +| @call_expr +| @postfix_unary_expr +| @prefix_unary_expr +| @self_apply_expr +; + +#keyset[id] +apply_exprs( //dir=expr + int id: @apply_expr ref, + int function: @expr_or_none ref +); + +#keyset[id, index] +apply_expr_arguments( //dir=expr + int id: @apply_expr ref, + int index: int ref, + int argument: @argument_or_none ref +); + +assign_exprs( //dir=expr + unique int id: @assign_expr, + int dest: @expr_or_none ref, + int source: @expr_or_none ref +); + +bind_optional_exprs( //dir=expr + unique int id: @bind_optional_expr, + int sub_expr: @expr_or_none ref +); + +capture_list_exprs( //dir=expr + unique int id: @capture_list_expr, + int closure_body: @closure_expr_or_none ref +); + +#keyset[id, index] +capture_list_expr_binding_decls( //dir=expr + int id: @capture_list_expr ref, + int index: int ref, + int binding_decl: @pattern_binding_decl_or_none ref +); + +@closure_expr = + @auto_closure_expr +| @explicit_closure_expr +; + +@collection_expr = + @array_expr +| @dictionary_expr +; + +decl_ref_exprs( //dir=expr + unique int id: @decl_ref_expr, + int decl: @decl_or_none ref +); + +#keyset[id, index] +decl_ref_expr_replacement_types( //dir=expr + int id: @decl_ref_expr ref, + int index: int ref, + int replacement_type: @type_or_none ref +); + +#keyset[id] +decl_ref_expr_has_direct_to_storage_semantics( //dir=expr + int id: @decl_ref_expr ref +); + +#keyset[id] +decl_ref_expr_has_direct_to_implementation_semantics( //dir=expr + int id: @decl_ref_expr ref +); + +#keyset[id] +decl_ref_expr_has_ordinary_semantics( //dir=expr + int id: @decl_ref_expr ref +); + +#keyset[id] +decl_ref_expr_has_distributed_thunk_semantics( //dir=expr + int id: @decl_ref_expr ref +); + +default_argument_exprs( //dir=expr + unique int id: @default_argument_expr, + int param_decl: @param_decl_or_none ref, + int param_index: int ref +); + +#keyset[id] +default_argument_expr_caller_side_defaults( //dir=expr + int id: @default_argument_expr ref, + int caller_side_default: @expr_or_none ref +); + +discard_assignment_exprs( //dir=expr + unique int id: @discard_assignment_expr +); + +dot_syntax_base_ignored_exprs( //dir=expr + unique int id: @dot_syntax_base_ignored_expr, + int qualifier: @expr_or_none ref, + int sub_expr: @expr_or_none ref +); + +dynamic_type_exprs( //dir=expr + unique int id: @dynamic_type_expr, + int base: @expr_or_none ref +); + +enum_is_case_exprs( //dir=expr + unique int id: @enum_is_case_expr, + int sub_expr: @expr_or_none ref, + int element: @enum_element_decl_or_none ref +); + +error_exprs( //dir=expr + unique int id: @error_expr +); + +@explicit_cast_expr = + @checked_cast_expr +| @coerce_expr +; + +#keyset[id] +explicit_cast_exprs( //dir=expr + int id: @explicit_cast_expr ref, + int sub_expr: @expr_or_none ref +); + +force_value_exprs( //dir=expr + unique int id: @force_value_expr, + int sub_expr: @expr_or_none ref +); + +@identity_expr = + @await_expr +| @dot_self_expr +| @paren_expr +| @unresolved_member_chain_result_expr +; + +#keyset[id] +identity_exprs( //dir=expr + int id: @identity_expr ref, + int sub_expr: @expr_or_none ref +); + +if_exprs( //dir=expr + unique int id: @if_expr, + int condition: @expr_or_none ref, + int then_expr: @expr_or_none ref, + int else_expr: @expr_or_none ref +); + +@implicit_conversion_expr = + @abi_safe_conversion_expr +| @any_hashable_erasure_expr +| @archetype_to_super_expr +| @array_to_pointer_expr +| @bridge_from_obj_c_expr +| @bridge_to_obj_c_expr +| @class_metatype_to_object_expr +| @collection_upcast_conversion_expr +| @conditional_bridge_from_obj_c_expr +| @covariant_function_conversion_expr +| @covariant_return_conversion_expr +| @derived_to_base_expr +| @destructure_tuple_expr +| @differentiable_function_expr +| @differentiable_function_extract_original_expr +| @erasure_expr +| @existential_metatype_to_object_expr +| @foreign_object_conversion_expr +| @function_conversion_expr +| @in_out_to_pointer_expr +| @inject_into_optional_expr +| @linear_function_expr +| @linear_function_extract_original_expr +| @linear_to_differentiable_function_expr +| @load_expr +| @metatype_conversion_expr +| @pointer_to_pointer_expr +| @protocol_metatype_to_object_expr +| @string_to_pointer_expr +| @underlying_to_opaque_expr +| @unevaluated_instance_expr +| @unresolved_type_conversion_expr +; + +#keyset[id] +implicit_conversion_exprs( //dir=expr + int id: @implicit_conversion_expr ref, + int sub_expr: @expr_or_none ref +); + +in_out_exprs( //dir=expr + unique int id: @in_out_expr, + int sub_expr: @expr_or_none ref +); + +key_path_application_exprs( //dir=expr + unique int id: @key_path_application_expr, + int base: @expr_or_none ref, + int key_path: @expr_or_none ref +); + +key_path_dot_exprs( //dir=expr + unique int id: @key_path_dot_expr +); + +key_path_exprs( //dir=expr + unique int id: @key_path_expr +); + +#keyset[id] +key_path_expr_roots( //dir=expr + int id: @key_path_expr ref, + int root: @type_repr_or_none ref +); + +#keyset[id, index] +key_path_expr_components( //dir=expr + int id: @key_path_expr ref, + int index: int ref, + int component: @key_path_component_or_none ref +); + +lazy_initialization_exprs( //dir=expr + unique int id: @lazy_initialization_expr, + int sub_expr: @expr_or_none ref +); + +@literal_expr = + @builtin_literal_expr +| @interpolated_string_literal_expr +| @nil_literal_expr +| @object_literal_expr +| @regex_literal_expr +; + +@lookup_expr = + @dynamic_lookup_expr +| @member_ref_expr +| @subscript_expr +; + +#keyset[id] +lookup_exprs( //dir=expr + int id: @lookup_expr ref, + int base: @expr_or_none ref +); + +#keyset[id] +lookup_expr_members( //dir=expr + int id: @lookup_expr ref, + int member: @decl_or_none ref +); + +make_temporarily_escapable_exprs( //dir=expr + unique int id: @make_temporarily_escapable_expr, + int escaping_closure: @opaque_value_expr_or_none ref, + int nonescaping_closure: @expr_or_none ref, + int sub_expr: @expr_or_none ref +); + +obj_c_selector_exprs( //dir=expr + unique int id: @obj_c_selector_expr, + int sub_expr: @expr_or_none ref, + int method: @function_or_none ref +); + +one_way_exprs( //dir=expr + unique int id: @one_way_expr, + int sub_expr: @expr_or_none ref +); + +opaque_value_exprs( //dir=expr + unique int id: @opaque_value_expr +); + +open_existential_exprs( //dir=expr + unique int id: @open_existential_expr, + int sub_expr: @expr_or_none ref, + int existential: @expr_or_none ref, + int opaque_expr: @opaque_value_expr_or_none ref +); + +optional_evaluation_exprs( //dir=expr + unique int id: @optional_evaluation_expr, + int sub_expr: @expr_or_none ref +); + +other_initializer_ref_exprs( //dir=expr + unique int id: @other_initializer_ref_expr, + int initializer: @initializer_or_none ref +); + +overloaded_decl_ref_exprs( //dir=expr + unique int id: @overloaded_decl_ref_expr +); + +#keyset[id, index] +overloaded_decl_ref_expr_possible_declarations( //dir=expr + int id: @overloaded_decl_ref_expr ref, + int index: int ref, + int possible_declaration: @value_decl_or_none ref +); + +property_wrapper_value_placeholder_exprs( //dir=expr + unique int id: @property_wrapper_value_placeholder_expr, + int placeholder: @opaque_value_expr_or_none ref +); + +#keyset[id] +property_wrapper_value_placeholder_expr_wrapped_values( //dir=expr + int id: @property_wrapper_value_placeholder_expr ref, + int wrapped_value: @expr_or_none ref +); + +rebind_self_in_initializer_exprs( //dir=expr + unique int id: @rebind_self_in_initializer_expr, + int sub_expr: @expr_or_none ref, + int self: @var_decl_or_none ref +); + +sequence_exprs( //dir=expr + unique int id: @sequence_expr +); + +#keyset[id, index] +sequence_expr_elements( //dir=expr + int id: @sequence_expr ref, + int index: int ref, + int element: @expr_or_none ref +); + +super_ref_exprs( //dir=expr + unique int id: @super_ref_expr, + int self: @var_decl_or_none ref +); + +tap_exprs( //dir=expr + unique int id: @tap_expr, + int body: @brace_stmt_or_none ref, + int var: @var_decl_or_none ref +); + +#keyset[id] +tap_expr_sub_exprs( //dir=expr + int id: @tap_expr ref, + int sub_expr: @expr_or_none ref +); + +tuple_element_exprs( //dir=expr + unique int id: @tuple_element_expr, + int sub_expr: @expr_or_none ref, + int index: int ref +); + +tuple_exprs( //dir=expr + unique int id: @tuple_expr +); + +#keyset[id, index] +tuple_expr_elements( //dir=expr + int id: @tuple_expr ref, + int index: int ref, + int element: @expr_or_none ref +); + +type_exprs( //dir=expr + unique int id: @type_expr +); + +#keyset[id] +type_expr_type_reprs( //dir=expr + int id: @type_expr ref, + int type_repr: @type_repr_or_none ref +); + +unresolved_decl_ref_exprs( //dir=expr + unique int id: @unresolved_decl_ref_expr +); + +#keyset[id] +unresolved_decl_ref_expr_names( //dir=expr + int id: @unresolved_decl_ref_expr ref, + string name: string ref +); + +unresolved_dot_exprs( //dir=expr + unique int id: @unresolved_dot_expr, + int base: @expr_or_none ref, + string name: string ref +); + +unresolved_member_exprs( //dir=expr + unique int id: @unresolved_member_expr, + string name: string ref +); + +unresolved_pattern_exprs( //dir=expr + unique int id: @unresolved_pattern_expr, + int sub_pattern: @pattern_or_none ref +); + +unresolved_specialize_exprs( //dir=expr + unique int id: @unresolved_specialize_expr, + int sub_expr: @expr_or_none ref +); + +vararg_expansion_exprs( //dir=expr + unique int id: @vararg_expansion_expr, + int sub_expr: @expr_or_none ref +); + +abi_safe_conversion_exprs( //dir=expr + unique int id: @abi_safe_conversion_expr +); + +any_hashable_erasure_exprs( //dir=expr + unique int id: @any_hashable_erasure_expr +); + +archetype_to_super_exprs( //dir=expr + unique int id: @archetype_to_super_expr +); + +array_exprs( //dir=expr + unique int id: @array_expr +); + +#keyset[id, index] +array_expr_elements( //dir=expr + int id: @array_expr ref, + int index: int ref, + int element: @expr_or_none ref +); + +array_to_pointer_exprs( //dir=expr + unique int id: @array_to_pointer_expr +); + +auto_closure_exprs( //dir=expr + unique int id: @auto_closure_expr +); + +await_exprs( //dir=expr + unique int id: @await_expr +); + +binary_exprs( //dir=expr + unique int id: @binary_expr +); + +bridge_from_obj_c_exprs( //dir=expr + unique int id: @bridge_from_obj_c_expr +); + +bridge_to_obj_c_exprs( //dir=expr + unique int id: @bridge_to_obj_c_expr +); + +@builtin_literal_expr = + @boolean_literal_expr +| @magic_identifier_literal_expr +| @number_literal_expr +| @string_literal_expr +; + +call_exprs( //dir=expr + unique int id: @call_expr +); + +@checked_cast_expr = + @conditional_checked_cast_expr +| @forced_checked_cast_expr +| @is_expr +; + +class_metatype_to_object_exprs( //dir=expr + unique int id: @class_metatype_to_object_expr +); + +coerce_exprs( //dir=expr + unique int id: @coerce_expr +); + +collection_upcast_conversion_exprs( //dir=expr + unique int id: @collection_upcast_conversion_expr +); + +conditional_bridge_from_obj_c_exprs( //dir=expr + unique int id: @conditional_bridge_from_obj_c_expr +); + +covariant_function_conversion_exprs( //dir=expr + unique int id: @covariant_function_conversion_expr +); + +covariant_return_conversion_exprs( //dir=expr + unique int id: @covariant_return_conversion_expr +); + +derived_to_base_exprs( //dir=expr + unique int id: @derived_to_base_expr +); + +destructure_tuple_exprs( //dir=expr + unique int id: @destructure_tuple_expr +); + +dictionary_exprs( //dir=expr + unique int id: @dictionary_expr +); + +#keyset[id, index] +dictionary_expr_elements( //dir=expr + int id: @dictionary_expr ref, + int index: int ref, + int element: @expr_or_none ref +); + +differentiable_function_exprs( //dir=expr + unique int id: @differentiable_function_expr +); + +differentiable_function_extract_original_exprs( //dir=expr + unique int id: @differentiable_function_extract_original_expr +); + +dot_self_exprs( //dir=expr + unique int id: @dot_self_expr +); + +@dynamic_lookup_expr = + @dynamic_member_ref_expr +| @dynamic_subscript_expr +; + +erasure_exprs( //dir=expr + unique int id: @erasure_expr +); + +existential_metatype_to_object_exprs( //dir=expr + unique int id: @existential_metatype_to_object_expr +); + +explicit_closure_exprs( //dir=expr + unique int id: @explicit_closure_expr +); + +force_try_exprs( //dir=expr + unique int id: @force_try_expr +); + +foreign_object_conversion_exprs( //dir=expr + unique int id: @foreign_object_conversion_expr +); + +function_conversion_exprs( //dir=expr + unique int id: @function_conversion_expr +); + +in_out_to_pointer_exprs( //dir=expr + unique int id: @in_out_to_pointer_expr +); + +inject_into_optional_exprs( //dir=expr + unique int id: @inject_into_optional_expr +); + +interpolated_string_literal_exprs( //dir=expr + unique int id: @interpolated_string_literal_expr +); + +#keyset[id] +interpolated_string_literal_expr_interpolation_exprs( //dir=expr + int id: @interpolated_string_literal_expr ref, + int interpolation_expr: @opaque_value_expr_or_none ref +); + +#keyset[id] +interpolated_string_literal_expr_appending_exprs( //dir=expr + int id: @interpolated_string_literal_expr ref, + int appending_expr: @tap_expr_or_none ref +); + +linear_function_exprs( //dir=expr + unique int id: @linear_function_expr +); + +linear_function_extract_original_exprs( //dir=expr + unique int id: @linear_function_extract_original_expr +); + +linear_to_differentiable_function_exprs( //dir=expr + unique int id: @linear_to_differentiable_function_expr +); + +load_exprs( //dir=expr + unique int id: @load_expr +); + +member_ref_exprs( //dir=expr + unique int id: @member_ref_expr +); + +#keyset[id] +member_ref_expr_has_direct_to_storage_semantics( //dir=expr + int id: @member_ref_expr ref +); + +#keyset[id] +member_ref_expr_has_direct_to_implementation_semantics( //dir=expr + int id: @member_ref_expr ref +); + +#keyset[id] +member_ref_expr_has_ordinary_semantics( //dir=expr + int id: @member_ref_expr ref +); + +#keyset[id] +member_ref_expr_has_distributed_thunk_semantics( //dir=expr + int id: @member_ref_expr ref +); + +metatype_conversion_exprs( //dir=expr + unique int id: @metatype_conversion_expr +); + +nil_literal_exprs( //dir=expr + unique int id: @nil_literal_expr +); + +object_literal_exprs( //dir=expr + unique int id: @object_literal_expr, + int kind: int ref +); + +#keyset[id, index] +object_literal_expr_arguments( //dir=expr + int id: @object_literal_expr ref, + int index: int ref, + int argument: @argument_or_none ref +); + +optional_try_exprs( //dir=expr + unique int id: @optional_try_expr +); + +paren_exprs( //dir=expr + unique int id: @paren_expr +); + +pointer_to_pointer_exprs( //dir=expr + unique int id: @pointer_to_pointer_expr +); + +postfix_unary_exprs( //dir=expr + unique int id: @postfix_unary_expr +); + +prefix_unary_exprs( //dir=expr + unique int id: @prefix_unary_expr +); + +protocol_metatype_to_object_exprs( //dir=expr + unique int id: @protocol_metatype_to_object_expr +); + +regex_literal_exprs( //dir=expr + unique int id: @regex_literal_expr, + string pattern: string ref, + int version: int ref +); + +@self_apply_expr = + @dot_syntax_call_expr +| @initializer_ref_call_expr +; + +#keyset[id] +self_apply_exprs( //dir=expr + int id: @self_apply_expr ref, + int base: @expr_or_none ref +); + +string_to_pointer_exprs( //dir=expr + unique int id: @string_to_pointer_expr +); + +subscript_exprs( //dir=expr + unique int id: @subscript_expr +); + +#keyset[id, index] +subscript_expr_arguments( //dir=expr + int id: @subscript_expr ref, + int index: int ref, + int argument: @argument_or_none ref +); + +#keyset[id] +subscript_expr_has_direct_to_storage_semantics( //dir=expr + int id: @subscript_expr ref +); + +#keyset[id] +subscript_expr_has_direct_to_implementation_semantics( //dir=expr + int id: @subscript_expr ref +); + +#keyset[id] +subscript_expr_has_ordinary_semantics( //dir=expr + int id: @subscript_expr ref +); + +#keyset[id] +subscript_expr_has_distributed_thunk_semantics( //dir=expr + int id: @subscript_expr ref +); + +try_exprs( //dir=expr + unique int id: @try_expr +); + +underlying_to_opaque_exprs( //dir=expr + unique int id: @underlying_to_opaque_expr +); + +unevaluated_instance_exprs( //dir=expr + unique int id: @unevaluated_instance_expr +); + +unresolved_member_chain_result_exprs( //dir=expr + unique int id: @unresolved_member_chain_result_expr +); + +unresolved_type_conversion_exprs( //dir=expr + unique int id: @unresolved_type_conversion_expr +); + +boolean_literal_exprs( //dir=expr + unique int id: @boolean_literal_expr, + boolean value: boolean ref +); + +conditional_checked_cast_exprs( //dir=expr + unique int id: @conditional_checked_cast_expr +); + +dot_syntax_call_exprs( //dir=expr + unique int id: @dot_syntax_call_expr +); + +dynamic_member_ref_exprs( //dir=expr + unique int id: @dynamic_member_ref_expr +); + +dynamic_subscript_exprs( //dir=expr + unique int id: @dynamic_subscript_expr +); + +forced_checked_cast_exprs( //dir=expr + unique int id: @forced_checked_cast_expr +); + +initializer_ref_call_exprs( //dir=expr + unique int id: @initializer_ref_call_expr +); + +is_exprs( //dir=expr + unique int id: @is_expr +); + +magic_identifier_literal_exprs( //dir=expr + unique int id: @magic_identifier_literal_expr, + string kind: string ref +); + +@number_literal_expr = + @float_literal_expr +| @integer_literal_expr +; + +string_literal_exprs( //dir=expr + unique int id: @string_literal_expr, + string value: string ref +); + +float_literal_exprs( //dir=expr + unique int id: @float_literal_expr, + string string_value: string ref +); + +integer_literal_exprs( //dir=expr + unique int id: @integer_literal_expr, + string string_value: string ref +); + +@pattern = + @any_pattern +| @binding_pattern +| @bool_pattern +| @enum_element_pattern +| @expr_pattern +| @is_pattern +| @named_pattern +| @optional_some_pattern +| @paren_pattern +| @tuple_pattern +| @typed_pattern +; + +any_patterns( //dir=pattern + unique int id: @any_pattern +); + +binding_patterns( //dir=pattern + unique int id: @binding_pattern, + int sub_pattern: @pattern_or_none ref +); + +bool_patterns( //dir=pattern + unique int id: @bool_pattern, + boolean value: boolean ref +); + +enum_element_patterns( //dir=pattern + unique int id: @enum_element_pattern, + int element: @enum_element_decl_or_none ref +); + +#keyset[id] +enum_element_pattern_sub_patterns( //dir=pattern + int id: @enum_element_pattern ref, + int sub_pattern: @pattern_or_none ref +); + +expr_patterns( //dir=pattern + unique int id: @expr_pattern, + int sub_expr: @expr_or_none ref +); + +is_patterns( //dir=pattern + unique int id: @is_pattern +); + +#keyset[id] +is_pattern_cast_type_reprs( //dir=pattern + int id: @is_pattern ref, + int cast_type_repr: @type_repr_or_none ref +); + +#keyset[id] +is_pattern_sub_patterns( //dir=pattern + int id: @is_pattern ref, + int sub_pattern: @pattern_or_none ref +); + +named_patterns( //dir=pattern + unique int id: @named_pattern, + string name: string ref +); + +optional_some_patterns( //dir=pattern + unique int id: @optional_some_pattern, + int sub_pattern: @pattern_or_none ref +); + +paren_patterns( //dir=pattern + unique int id: @paren_pattern, + int sub_pattern: @pattern_or_none ref +); + +tuple_patterns( //dir=pattern + unique int id: @tuple_pattern +); + +#keyset[id, index] +tuple_pattern_elements( //dir=pattern + int id: @tuple_pattern ref, + int index: int ref, + int element: @pattern_or_none ref +); + +typed_patterns( //dir=pattern + unique int id: @typed_pattern, + int sub_pattern: @pattern_or_none ref +); + +#keyset[id] +typed_pattern_type_reprs( //dir=pattern + int id: @typed_pattern ref, + int type_repr: @type_repr_or_none ref +); + +case_label_items( //dir=stmt + unique int id: @case_label_item, + int pattern: @pattern_or_none ref +); + +#keyset[id] +case_label_item_guards( //dir=stmt + int id: @case_label_item ref, + int guard: @expr_or_none ref +); + +condition_elements( //dir=stmt + unique int id: @condition_element +); + +#keyset[id] +condition_element_booleans( //dir=stmt + int id: @condition_element ref, + int boolean_: @expr_or_none ref +); + +#keyset[id] +condition_element_patterns( //dir=stmt + int id: @condition_element ref, + int pattern: @pattern_or_none ref +); + +#keyset[id] +condition_element_initializers( //dir=stmt + int id: @condition_element ref, + int initializer: @expr_or_none ref +); + +#keyset[id] +condition_element_availabilities( //dir=stmt + int id: @condition_element ref, + int availability: @availability_info_or_none ref +); + +@stmt = + @brace_stmt +| @break_stmt +| @case_stmt +| @continue_stmt +| @defer_stmt +| @fail_stmt +| @fallthrough_stmt +| @labeled_stmt +| @pound_assert_stmt +| @return_stmt +| @throw_stmt +| @yield_stmt +; + +stmt_conditions( //dir=stmt + unique int id: @stmt_condition +); + +#keyset[id, index] +stmt_condition_elements( //dir=stmt + int id: @stmt_condition ref, + int index: int ref, + int element: @condition_element_or_none ref +); + +brace_stmts( //dir=stmt + unique int id: @brace_stmt +); + +#keyset[id, index] +brace_stmt_elements( //dir=stmt + int id: @brace_stmt ref, + int index: int ref, + int element: @ast_node_or_none ref +); + +break_stmts( //dir=stmt + unique int id: @break_stmt +); + +#keyset[id] +break_stmt_target_names( //dir=stmt + int id: @break_stmt ref, + string target_name: string ref +); + +#keyset[id] +break_stmt_targets( //dir=stmt + int id: @break_stmt ref, + int target: @stmt_or_none ref +); + +case_stmts( //dir=stmt + unique int id: @case_stmt, + int body: @stmt_or_none ref +); + +#keyset[id, index] +case_stmt_labels( //dir=stmt + int id: @case_stmt ref, + int index: int ref, + int label: @case_label_item_or_none ref +); + +#keyset[id, index] +case_stmt_variables( //dir=stmt + int id: @case_stmt ref, + int index: int ref, + int variable: @var_decl_or_none ref +); + +continue_stmts( //dir=stmt + unique int id: @continue_stmt +); + +#keyset[id] +continue_stmt_target_names( //dir=stmt + int id: @continue_stmt ref, + string target_name: string ref +); + +#keyset[id] +continue_stmt_targets( //dir=stmt + int id: @continue_stmt ref, + int target: @stmt_or_none ref +); + +defer_stmts( //dir=stmt + unique int id: @defer_stmt, + int body: @brace_stmt_or_none ref +); + +fail_stmts( //dir=stmt + unique int id: @fail_stmt +); + +fallthrough_stmts( //dir=stmt + unique int id: @fallthrough_stmt, + int fallthrough_source: @case_stmt_or_none ref, + int fallthrough_dest: @case_stmt_or_none ref +); + +@labeled_stmt = + @do_catch_stmt +| @do_stmt +| @for_each_stmt +| @labeled_conditional_stmt +| @repeat_while_stmt +| @switch_stmt +; + +#keyset[id] +labeled_stmt_labels( //dir=stmt + int id: @labeled_stmt ref, + string label: string ref +); + +pound_assert_stmts( //dir=stmt + unique int id: @pound_assert_stmt, + int condition: @expr_or_none ref, + string message: string ref +); + +return_stmts( //dir=stmt + unique int id: @return_stmt +); + +#keyset[id] +return_stmt_results( //dir=stmt + int id: @return_stmt ref, + int result: @expr_or_none ref +); + +throw_stmts( //dir=stmt + unique int id: @throw_stmt, + int sub_expr: @expr_or_none ref +); + +yield_stmts( //dir=stmt + unique int id: @yield_stmt +); + +#keyset[id, index] +yield_stmt_results( //dir=stmt + int id: @yield_stmt ref, + int index: int ref, + int result: @expr_or_none ref +); + +do_catch_stmts( //dir=stmt + unique int id: @do_catch_stmt, + int body: @stmt_or_none ref +); + +#keyset[id, index] +do_catch_stmt_catches( //dir=stmt + int id: @do_catch_stmt ref, + int index: int ref, + int catch: @case_stmt_or_none ref +); + +do_stmts( //dir=stmt + unique int id: @do_stmt, + int body: @brace_stmt_or_none ref +); + +for_each_stmts( //dir=stmt + unique int id: @for_each_stmt, + int pattern: @pattern_or_none ref, + int body: @brace_stmt_or_none ref +); + +#keyset[id] +for_each_stmt_wheres( //dir=stmt + int id: @for_each_stmt ref, + int where: @expr_or_none ref +); + +#keyset[id] +for_each_stmt_iterator_vars( //dir=stmt + int id: @for_each_stmt ref, + int iteratorVar: @pattern_binding_decl_or_none ref +); + +#keyset[id] +for_each_stmt_next_calls( //dir=stmt + int id: @for_each_stmt ref, + int nextCall: @expr_or_none ref +); + +@labeled_conditional_stmt = + @guard_stmt +| @if_stmt +| @while_stmt +; + +#keyset[id] +labeled_conditional_stmts( //dir=stmt + int id: @labeled_conditional_stmt ref, + int condition: @stmt_condition_or_none ref +); + +repeat_while_stmts( //dir=stmt + unique int id: @repeat_while_stmt, + int condition: @expr_or_none ref, + int body: @stmt_or_none ref +); + +switch_stmts( //dir=stmt + unique int id: @switch_stmt, + int expr: @expr_or_none ref +); + +#keyset[id, index] +switch_stmt_cases( //dir=stmt + int id: @switch_stmt ref, + int index: int ref, + int case_: @case_stmt_or_none ref +); + +guard_stmts( //dir=stmt + unique int id: @guard_stmt, + int body: @brace_stmt_or_none ref +); + +if_stmts( //dir=stmt + unique int id: @if_stmt, + int then: @stmt_or_none ref +); + +#keyset[id] +if_stmt_elses( //dir=stmt + int id: @if_stmt ref, + int else: @stmt_or_none ref +); + +while_stmts( //dir=stmt + unique int id: @while_stmt, + int body: @stmt_or_none ref +); + +@type = + @any_function_type +| @any_generic_type +| @any_metatype_type +| @builtin_type +| @dependent_member_type +| @dynamic_self_type +| @error_type +| @existential_type +| @in_out_type +| @l_value_type +| @module_type +| @parameterized_protocol_type +| @protocol_composition_type +| @reference_storage_type +| @substitutable_type +| @sugar_type +| @tuple_type +| @unresolved_type +; + +#keyset[id] +types( //dir=type + int id: @type ref, + string name: string ref, + int canonical_type: @type_or_none ref +); + +type_reprs( //dir=type + unique int id: @type_repr, + int type_: @type_or_none ref +); + +@any_function_type = + @function_type +| @generic_function_type +; + +#keyset[id] +any_function_types( //dir=type + int id: @any_function_type ref, + int result: @type_or_none ref +); + +#keyset[id, index] +any_function_type_param_types( //dir=type + int id: @any_function_type ref, + int index: int ref, + int param_type: @type_or_none ref +); + +#keyset[id] +any_function_type_is_throwing( //dir=type + int id: @any_function_type ref +); + +#keyset[id] +any_function_type_is_async( //dir=type + int id: @any_function_type ref +); + +@any_generic_type = + @nominal_or_bound_generic_nominal_type +| @unbound_generic_type +; + +#keyset[id] +any_generic_types( //dir=type + int id: @any_generic_type ref, + int declaration: @generic_type_decl_or_none ref +); + +#keyset[id] +any_generic_type_parents( //dir=type + int id: @any_generic_type ref, + int parent: @type_or_none ref +); + +@any_metatype_type = + @existential_metatype_type +| @metatype_type +; + +@builtin_type = + @any_builtin_integer_type +| @builtin_bridge_object_type +| @builtin_default_actor_storage_type +| @builtin_executor_type +| @builtin_float_type +| @builtin_job_type +| @builtin_native_object_type +| @builtin_raw_pointer_type +| @builtin_raw_unsafe_continuation_type +| @builtin_unsafe_value_buffer_type +| @builtin_vector_type +; + +dependent_member_types( //dir=type + unique int id: @dependent_member_type, + int base_type: @type_or_none ref, + int associated_type_decl: @associated_type_decl_or_none ref +); + +dynamic_self_types( //dir=type + unique int id: @dynamic_self_type, + int static_self_type: @type_or_none ref +); + +error_types( //dir=type + unique int id: @error_type +); + +existential_types( //dir=type + unique int id: @existential_type, + int constraint: @type_or_none ref +); + +in_out_types( //dir=type + unique int id: @in_out_type, + int object_type: @type_or_none ref +); + +l_value_types( //dir=type + unique int id: @l_value_type, + int object_type: @type_or_none ref +); + +module_types( //dir=type + unique int id: @module_type, + int module: @module_decl_or_none ref +); + +parameterized_protocol_types( //dir=type + unique int id: @parameterized_protocol_type, + int base: @protocol_type_or_none ref +); + +#keyset[id, index] +parameterized_protocol_type_args( //dir=type + int id: @parameterized_protocol_type ref, + int index: int ref, + int arg: @type_or_none ref +); + +protocol_composition_types( //dir=type + unique int id: @protocol_composition_type +); + +#keyset[id, index] +protocol_composition_type_members( //dir=type + int id: @protocol_composition_type ref, + int index: int ref, + int member: @type_or_none ref +); + +@reference_storage_type = + @unmanaged_storage_type +| @unowned_storage_type +| @weak_storage_type +; + +#keyset[id] +reference_storage_types( //dir=type + int id: @reference_storage_type ref, + int referent_type: @type_or_none ref +); + +@substitutable_type = + @archetype_type +| @generic_type_param_type +; + +@sugar_type = + @paren_type +| @syntax_sugar_type +| @type_alias_type +; + +tuple_types( //dir=type + unique int id: @tuple_type +); + +#keyset[id, index] +tuple_type_types( //dir=type + int id: @tuple_type ref, + int index: int ref, + int type_: @type_or_none ref +); + +#keyset[id, index] +tuple_type_names( //dir=type + int id: @tuple_type ref, + int index: int ref, + string name: string ref +); + +unresolved_types( //dir=type + unique int id: @unresolved_type +); + +@any_builtin_integer_type = + @builtin_integer_literal_type +| @builtin_integer_type +; + +@archetype_type = + @opaque_type_archetype_type +| @opened_archetype_type +| @primary_archetype_type +; + +#keyset[id] +archetype_types( //dir=type + int id: @archetype_type ref, + int interface_type: @type_or_none ref +); + +#keyset[id] +archetype_type_superclasses( //dir=type + int id: @archetype_type ref, + int superclass: @type_or_none ref +); + +#keyset[id, index] +archetype_type_protocols( //dir=type + int id: @archetype_type ref, + int index: int ref, + int protocol: @protocol_decl_or_none ref +); + +builtin_bridge_object_types( //dir=type + unique int id: @builtin_bridge_object_type +); + +builtin_default_actor_storage_types( //dir=type + unique int id: @builtin_default_actor_storage_type +); + +builtin_executor_types( //dir=type + unique int id: @builtin_executor_type +); + +builtin_float_types( //dir=type + unique int id: @builtin_float_type +); + +builtin_job_types( //dir=type + unique int id: @builtin_job_type +); + +builtin_native_object_types( //dir=type + unique int id: @builtin_native_object_type +); + +builtin_raw_pointer_types( //dir=type + unique int id: @builtin_raw_pointer_type +); + +builtin_raw_unsafe_continuation_types( //dir=type + unique int id: @builtin_raw_unsafe_continuation_type +); + +builtin_unsafe_value_buffer_types( //dir=type + unique int id: @builtin_unsafe_value_buffer_type +); + +builtin_vector_types( //dir=type + unique int id: @builtin_vector_type +); + +existential_metatype_types( //dir=type + unique int id: @existential_metatype_type +); + +function_types( //dir=type + unique int id: @function_type +); + +generic_function_types( //dir=type + unique int id: @generic_function_type +); + +#keyset[id, index] +generic_function_type_generic_params( //dir=type + int id: @generic_function_type ref, + int index: int ref, + int generic_param: @generic_type_param_type_or_none ref +); + +generic_type_param_types( //dir=type + unique int id: @generic_type_param_type +); + +metatype_types( //dir=type + unique int id: @metatype_type +); + +@nominal_or_bound_generic_nominal_type = + @bound_generic_type +| @nominal_type +; + +paren_types( //dir=type + unique int id: @paren_type, + int type_: @type_or_none ref +); + +@syntax_sugar_type = + @dictionary_type +| @unary_syntax_sugar_type +; + +type_alias_types( //dir=type + unique int id: @type_alias_type, + int decl: @type_alias_decl_or_none ref +); + +unbound_generic_types( //dir=type + unique int id: @unbound_generic_type +); + +unmanaged_storage_types( //dir=type + unique int id: @unmanaged_storage_type +); + +unowned_storage_types( //dir=type + unique int id: @unowned_storage_type +); + +weak_storage_types( //dir=type + unique int id: @weak_storage_type +); + +@bound_generic_type = + @bound_generic_class_type +| @bound_generic_enum_type +| @bound_generic_struct_type +; + +#keyset[id, index] +bound_generic_type_arg_types( //dir=type + int id: @bound_generic_type ref, + int index: int ref, + int arg_type: @type_or_none ref +); + +builtin_integer_literal_types( //dir=type + unique int id: @builtin_integer_literal_type +); + +builtin_integer_types( //dir=type + unique int id: @builtin_integer_type +); + +#keyset[id] +builtin_integer_type_widths( //dir=type + int id: @builtin_integer_type ref, + int width: int ref +); + +dictionary_types( //dir=type + unique int id: @dictionary_type, + int key_type: @type_or_none ref, + int value_type: @type_or_none ref +); + +@nominal_type = + @class_type +| @enum_type +| @protocol_type +| @struct_type +; + +opaque_type_archetype_types( //dir=type + unique int id: @opaque_type_archetype_type, + int declaration: @opaque_type_decl_or_none ref +); + +opened_archetype_types( //dir=type + unique int id: @opened_archetype_type +); + +primary_archetype_types( //dir=type + unique int id: @primary_archetype_type +); + +@unary_syntax_sugar_type = + @array_slice_type +| @optional_type +| @variadic_sequence_type +; + +#keyset[id] +unary_syntax_sugar_types( //dir=type + int id: @unary_syntax_sugar_type ref, + int base_type: @type_or_none ref +); + +array_slice_types( //dir=type + unique int id: @array_slice_type +); + +bound_generic_class_types( //dir=type + unique int id: @bound_generic_class_type +); + +bound_generic_enum_types( //dir=type + unique int id: @bound_generic_enum_type +); + +bound_generic_struct_types( //dir=type + unique int id: @bound_generic_struct_type +); + +class_types( //dir=type + unique int id: @class_type +); + +enum_types( //dir=type + unique int id: @enum_type +); + +optional_types( //dir=type + unique int id: @optional_type +); + +protocol_types( //dir=type + unique int id: @protocol_type +); + +struct_types( //dir=type + unique int id: @struct_type +); + +variadic_sequence_types( //dir=type + unique int id: @variadic_sequence_type +); + +@accessor_or_none = + @accessor +| @unspecified_element +; + +@argument_or_none = + @argument +| @unspecified_element +; + +@associated_type_decl_or_none = + @associated_type_decl +| @unspecified_element +; + +@ast_node_or_none = + @ast_node +| @unspecified_element +; + +@availability_info_or_none = + @availability_info +| @unspecified_element +; + +@availability_spec_or_none = + @availability_spec +| @unspecified_element +; + +@brace_stmt_or_none = + @brace_stmt +| @unspecified_element +; + +@captured_decl_or_none = + @captured_decl +| @unspecified_element +; + +@case_label_item_or_none = + @case_label_item +| @unspecified_element +; + +@case_stmt_or_none = + @case_stmt +| @unspecified_element +; + +@closure_expr_or_none = + @closure_expr +| @unspecified_element +; + +@condition_element_or_none = + @condition_element +| @unspecified_element +; + +@decl_or_none = + @decl +| @unspecified_element +; + +@enum_element_decl_or_none = + @enum_element_decl +| @unspecified_element +; + +@expr_or_none = + @expr +| @unspecified_element +; + +@file_or_none = + @file +| @unspecified_element +; + +@function_or_none = + @function +| @unspecified_element +; + +@generic_type_decl_or_none = + @generic_type_decl +| @unspecified_element +; + +@generic_type_param_decl_or_none = + @generic_type_param_decl +| @unspecified_element +; + +@generic_type_param_type_or_none = + @generic_type_param_type +| @unspecified_element +; + +@initializer_or_none = + @initializer +| @unspecified_element +; + +@key_path_component_or_none = + @key_path_component +| @unspecified_element +; + +@location_or_none = + @location +| @unspecified_element +; + +@module_decl_or_none = + @module_decl +| @unspecified_element +; + +@nominal_type_decl_or_none = + @nominal_type_decl +| @unspecified_element +; + +@opaque_type_decl_or_none = + @opaque_type_decl +| @unspecified_element +; + +@opaque_value_expr_or_none = + @opaque_value_expr +| @unspecified_element +; + +@param_decl_or_none = + @param_decl +| @unspecified_element +; + +@pattern_or_none = + @pattern +| @unspecified_element +; + +@pattern_binding_decl_or_none = + @pattern_binding_decl +| @unspecified_element +; + +@precedence_group_decl_or_none = + @precedence_group_decl +| @unspecified_element +; + +@protocol_decl_or_none = + @protocol_decl +| @unspecified_element +; + +@protocol_type_or_none = + @protocol_type +| @unspecified_element +; + +@stmt_or_none = + @stmt +| @unspecified_element +; + +@stmt_condition_or_none = + @stmt_condition +| @unspecified_element +; + +@string_literal_expr_or_none = + @string_literal_expr +| @unspecified_element +; + +@tap_expr_or_none = + @tap_expr +| @unspecified_element +; + +@type_or_none = + @type +| @unspecified_element +; + +@type_alias_decl_or_none = + @type_alias_decl +| @unspecified_element +; + +@type_repr_or_none = + @type_repr +| @unspecified_element +; + +@value_decl_or_none = + @unspecified_element +| @value_decl +; + +@var_decl_or_none = + @unspecified_element +| @var_decl +; diff --git a/swift/ql/lib/upgrades/c0db61944f46ba5507f207ec2b1cff77ad0529a1/swift.dbscheme b/swift/ql/lib/upgrades/c0db61944f46ba5507f207ec2b1cff77ad0529a1/swift.dbscheme new file mode 100644 index 000000000000..7c17e1f4b2d3 --- /dev/null +++ b/swift/ql/lib/upgrades/c0db61944f46ba5507f207ec2b1cff77ad0529a1/swift.dbscheme @@ -0,0 +1,2636 @@ +// generated by codegen/codegen.py + +// from prefix.dbscheme +/** + * The source location of the snapshot. + */ +sourceLocationPrefix( + string prefix: string ref +); + + +// from schema.py + +@element = + @callable +| @file +| @generic_context +| @locatable +| @location +| @type +; + +#keyset[id] +element_is_unknown( + int id: @element ref +); + +@callable = + @closure_expr +| @function +; + +#keyset[id] +callable_names( + int id: @callable ref, + string name: string ref +); + +#keyset[id] +callable_self_params( + int id: @callable ref, + int self_param: @param_decl_or_none ref +); + +#keyset[id, index] +callable_params( + int id: @callable ref, + int index: int ref, + int param: @param_decl_or_none ref +); + +#keyset[id] +callable_bodies( + int id: @callable ref, + int body: @brace_stmt_or_none ref +); + +#keyset[id, index] +callable_captures( + int id: @callable ref, + int index: int ref, + int capture: @captured_decl_or_none ref +); + +@file = + @db_file +; + +#keyset[id] +files( + int id: @file ref, + string name: string ref +); + +#keyset[id] +file_is_successfully_extracted( + int id: @file ref +); + +@locatable = + @argument +| @ast_node +| @comment +| @diagnostics +| @error_element +; + +#keyset[id] +locatable_locations( + int id: @locatable ref, + int location: @location_or_none ref +); + +@location = + @db_location +; + +#keyset[id] +locations( + int id: @location ref, + int file: @file_or_none ref, + int start_line: int ref, + int start_column: int ref, + int end_line: int ref, + int end_column: int ref +); + +@ast_node = + @availability_info +| @availability_spec +| @case_label_item +| @condition_element +| @decl +| @expr +| @key_path_component +| @pattern +| @stmt +| @stmt_condition +| @type_repr +; + +comments( + unique int id: @comment, + string text: string ref +); + +db_files( + unique int id: @db_file +); + +db_locations( + unique int id: @db_location +); + +diagnostics( + unique int id: @diagnostics, + string text: string ref, + int kind: int ref +); + +@error_element = + @error_expr +| @error_type +| @overloaded_decl_ref_expr +| @unresolved_decl_ref_expr +| @unresolved_dot_expr +| @unresolved_member_chain_result_expr +| @unresolved_member_expr +| @unresolved_pattern_expr +| @unresolved_specialize_expr +| @unresolved_type +| @unresolved_type_conversion_expr +| @unspecified_element +; + +availability_infos( + unique int id: @availability_info +); + +#keyset[id] +availability_info_is_unavailable( + int id: @availability_info ref +); + +#keyset[id, index] +availability_info_specs( + int id: @availability_info ref, + int index: int ref, + int spec: @availability_spec_or_none ref +); + +@availability_spec = + @other_availability_spec +| @platform_version_availability_spec +; + +key_path_components( + unique int id: @key_path_component, + int kind: int ref, + int component_type: @type_or_none ref +); + +#keyset[id, index] +key_path_component_subscript_arguments( + int id: @key_path_component ref, + int index: int ref, + int subscript_argument: @argument_or_none ref +); + +#keyset[id] +key_path_component_tuple_indices( + int id: @key_path_component ref, + int tuple_index: int ref +); + +#keyset[id] +key_path_component_decl_refs( + int id: @key_path_component ref, + int decl_ref: @value_decl_or_none ref +); + +unspecified_elements( + unique int id: @unspecified_element, + string property: string ref, + string error: string ref +); + +#keyset[id] +unspecified_element_parents( + int id: @unspecified_element ref, + int parent: @element ref +); + +#keyset[id] +unspecified_element_indices( + int id: @unspecified_element ref, + int index: int ref +); + +#keyset[id, index] +unspecified_element_children( + int id: @unspecified_element ref, + int index: int ref, + int child: @ast_node_or_none ref +); + +other_availability_specs( + unique int id: @other_availability_spec +); + +platform_version_availability_specs( + unique int id: @platform_version_availability_spec, + string platform: string ref, + string version: string ref +); + +@decl = + @captured_decl +| @enum_case_decl +| @extension_decl +| @if_config_decl +| @import_decl +| @missing_member_decl +| @operator_decl +| @pattern_binding_decl +| @pound_diagnostic_decl +| @precedence_group_decl +| @top_level_code_decl +| @value_decl +; + +#keyset[id] +decls( //dir=decl + int id: @decl ref, + int module: @module_decl_or_none ref +); + +#keyset[id, index] +decl_members( //dir=decl + int id: @decl ref, + int index: int ref, + int member: @decl_or_none ref +); + +@generic_context = + @extension_decl +| @function +| @generic_type_decl +| @subscript_decl +; + +#keyset[id, index] +generic_context_generic_type_params( //dir=decl + int id: @generic_context ref, + int index: int ref, + int generic_type_param: @generic_type_param_decl_or_none ref +); + +captured_decls( //dir=decl + unique int id: @captured_decl, + int decl: @value_decl_or_none ref +); + +#keyset[id] +captured_decl_is_direct( //dir=decl + int id: @captured_decl ref +); + +#keyset[id] +captured_decl_is_escaping( //dir=decl + int id: @captured_decl ref +); + +enum_case_decls( //dir=decl + unique int id: @enum_case_decl +); + +#keyset[id, index] +enum_case_decl_elements( //dir=decl + int id: @enum_case_decl ref, + int index: int ref, + int element: @enum_element_decl_or_none ref +); + +extension_decls( //dir=decl + unique int id: @extension_decl, + int extended_type_decl: @nominal_type_decl_or_none ref +); + +#keyset[id, index] +extension_decl_protocols( //dir=decl + int id: @extension_decl ref, + int index: int ref, + int protocol: @protocol_decl_or_none ref +); + +if_config_decls( //dir=decl + unique int id: @if_config_decl +); + +#keyset[id, index] +if_config_decl_active_elements( //dir=decl + int id: @if_config_decl ref, + int index: int ref, + int active_element: @ast_node_or_none ref +); + +import_decls( //dir=decl + unique int id: @import_decl +); + +#keyset[id] +import_decl_is_exported( //dir=decl + int id: @import_decl ref +); + +#keyset[id] +import_decl_imported_modules( //dir=decl + int id: @import_decl ref, + int imported_module: @module_decl_or_none ref +); + +#keyset[id, index] +import_decl_declarations( //dir=decl + int id: @import_decl ref, + int index: int ref, + int declaration: @value_decl_or_none ref +); + +missing_member_decls( //dir=decl + unique int id: @missing_member_decl, + string name: string ref +); + +@operator_decl = + @infix_operator_decl +| @postfix_operator_decl +| @prefix_operator_decl +; + +#keyset[id] +operator_decls( //dir=decl + int id: @operator_decl ref, + string name: string ref +); + +pattern_binding_decls( //dir=decl + unique int id: @pattern_binding_decl +); + +#keyset[id, index] +pattern_binding_decl_inits( //dir=decl + int id: @pattern_binding_decl ref, + int index: int ref, + int init: @expr_or_none ref +); + +#keyset[id, index] +pattern_binding_decl_patterns( //dir=decl + int id: @pattern_binding_decl ref, + int index: int ref, + int pattern: @pattern_or_none ref +); + +pound_diagnostic_decls( //dir=decl + unique int id: @pound_diagnostic_decl, + int kind: int ref, + int message: @string_literal_expr_or_none ref +); + +precedence_group_decls( //dir=decl + unique int id: @precedence_group_decl +); + +top_level_code_decls( //dir=decl + unique int id: @top_level_code_decl, + int body: @brace_stmt_or_none ref +); + +@value_decl = + @abstract_storage_decl +| @enum_element_decl +| @function +| @type_decl +; + +#keyset[id] +value_decls( //dir=decl + int id: @value_decl ref, + int interface_type: @type_or_none ref +); + +@abstract_storage_decl = + @subscript_decl +| @var_decl +; + +#keyset[id, index] +abstract_storage_decl_accessors( //dir=decl + int id: @abstract_storage_decl ref, + int index: int ref, + int accessor: @accessor_or_none ref +); + +enum_element_decls( //dir=decl + unique int id: @enum_element_decl, + string name: string ref +); + +#keyset[id, index] +enum_element_decl_params( //dir=decl + int id: @enum_element_decl ref, + int index: int ref, + int param: @param_decl_or_none ref +); + +@function = + @accessor_or_named_function +| @deinitializer +| @initializer +; + +infix_operator_decls( //dir=decl + unique int id: @infix_operator_decl +); + +#keyset[id] +infix_operator_decl_precedence_groups( //dir=decl + int id: @infix_operator_decl ref, + int precedence_group: @precedence_group_decl_or_none ref +); + +postfix_operator_decls( //dir=decl + unique int id: @postfix_operator_decl +); + +prefix_operator_decls( //dir=decl + unique int id: @prefix_operator_decl +); + +@type_decl = + @abstract_type_param_decl +| @generic_type_decl +| @module_decl +; + +#keyset[id] +type_decls( //dir=decl + int id: @type_decl ref, + string name: string ref +); + +#keyset[id, index] +type_decl_inherited_types( //dir=decl + int id: @type_decl ref, + int index: int ref, + int inherited_type: @type_or_none ref +); + +@abstract_type_param_decl = + @associated_type_decl +| @generic_type_param_decl +; + +@accessor_or_named_function = + @accessor +| @named_function +; + +deinitializers( //dir=decl + unique int id: @deinitializer +); + +@generic_type_decl = + @nominal_type_decl +| @opaque_type_decl +| @type_alias_decl +; + +initializers( //dir=decl + unique int id: @initializer +); + +module_decls( //dir=decl + unique int id: @module_decl +); + +#keyset[id] +module_decl_is_builtin_module( //dir=decl + int id: @module_decl ref +); + +#keyset[id] +module_decl_is_system_module( //dir=decl + int id: @module_decl ref +); + +module_decl_imported_modules( //dir=decl + int id: @module_decl ref, + int imported_module: @module_decl_or_none ref +); + +module_decl_exported_modules( //dir=decl + int id: @module_decl ref, + int exported_module: @module_decl_or_none ref +); + +subscript_decls( //dir=decl + unique int id: @subscript_decl, + int element_type: @type_or_none ref +); + +#keyset[id, index] +subscript_decl_params( //dir=decl + int id: @subscript_decl ref, + int index: int ref, + int param: @param_decl_or_none ref +); + +@var_decl = + @concrete_var_decl +| @param_decl +; + +#keyset[id] +var_decls( //dir=decl + int id: @var_decl ref, + string name: string ref, + int type_: @type_or_none ref +); + +#keyset[id] +var_decl_attached_property_wrapper_types( //dir=decl + int id: @var_decl ref, + int attached_property_wrapper_type: @type_or_none ref +); + +#keyset[id] +var_decl_parent_patterns( //dir=decl + int id: @var_decl ref, + int parent_pattern: @pattern_or_none ref +); + +#keyset[id] +var_decl_parent_initializers( //dir=decl + int id: @var_decl ref, + int parent_initializer: @expr_or_none ref +); + +#keyset[id] +var_decl_property_wrapper_backing_var_bindings( //dir=decl + int id: @var_decl ref, + int property_wrapper_backing_var_binding: @pattern_binding_decl_or_none ref +); + +#keyset[id] +var_decl_property_wrapper_backing_vars( //dir=decl + int id: @var_decl ref, + int property_wrapper_backing_var: @var_decl_or_none ref +); + +#keyset[id] +var_decl_property_wrapper_projection_var_bindings( //dir=decl + int id: @var_decl ref, + int property_wrapper_projection_var_binding: @pattern_binding_decl_or_none ref +); + +#keyset[id] +var_decl_property_wrapper_projection_vars( //dir=decl + int id: @var_decl ref, + int property_wrapper_projection_var: @var_decl_or_none ref +); + +accessors( //dir=decl + unique int id: @accessor +); + +#keyset[id] +accessor_is_getter( //dir=decl + int id: @accessor ref +); + +#keyset[id] +accessor_is_setter( //dir=decl + int id: @accessor ref +); + +#keyset[id] +accessor_is_will_set( //dir=decl + int id: @accessor ref +); + +#keyset[id] +accessor_is_did_set( //dir=decl + int id: @accessor ref +); + +#keyset[id] +accessor_is_read( //dir=decl + int id: @accessor ref +); + +#keyset[id] +accessor_is_modify( //dir=decl + int id: @accessor ref +); + +#keyset[id] +accessor_is_unsafe_address( //dir=decl + int id: @accessor ref +); + +#keyset[id] +accessor_is_unsafe_mutable_address( //dir=decl + int id: @accessor ref +); + +associated_type_decls( //dir=decl + unique int id: @associated_type_decl +); + +concrete_var_decls( //dir=decl + unique int id: @concrete_var_decl, + int introducer_int: int ref +); + +generic_type_param_decls( //dir=decl + unique int id: @generic_type_param_decl +); + +named_functions( //dir=decl + unique int id: @named_function +); + +@nominal_type_decl = + @class_decl +| @enum_decl +| @protocol_decl +| @struct_decl +; + +#keyset[id] +nominal_type_decls( //dir=decl + int id: @nominal_type_decl ref, + int type_: @type_or_none ref +); + +opaque_type_decls( //dir=decl + unique int id: @opaque_type_decl, + int naming_declaration: @value_decl_or_none ref +); + +#keyset[id, index] +opaque_type_decl_opaque_generic_params( //dir=decl + int id: @opaque_type_decl ref, + int index: int ref, + int opaque_generic_param: @generic_type_param_type_or_none ref +); + +param_decls( //dir=decl + unique int id: @param_decl +); + +#keyset[id] +param_decl_is_inout( //dir=decl + int id: @param_decl ref +); + +#keyset[id] +param_decl_property_wrapper_local_wrapped_var_bindings( //dir=decl + int id: @param_decl ref, + int property_wrapper_local_wrapped_var_binding: @pattern_binding_decl_or_none ref +); + +#keyset[id] +param_decl_property_wrapper_local_wrapped_vars( //dir=decl + int id: @param_decl ref, + int property_wrapper_local_wrapped_var: @var_decl_or_none ref +); + +type_alias_decls( //dir=decl + unique int id: @type_alias_decl, + int aliased_type: @type_or_none ref +); + +class_decls( //dir=decl + unique int id: @class_decl +); + +enum_decls( //dir=decl + unique int id: @enum_decl +); + +protocol_decls( //dir=decl + unique int id: @protocol_decl +); + +struct_decls( //dir=decl + unique int id: @struct_decl +); + +arguments( //dir=expr + unique int id: @argument, + string label: string ref, + int expr: @expr_or_none ref +); + +@expr = + @any_try_expr +| @applied_property_wrapper_expr +| @apply_expr +| @assign_expr +| @bind_optional_expr +| @capture_list_expr +| @closure_expr +| @collection_expr +| @decl_ref_expr +| @default_argument_expr +| @discard_assignment_expr +| @dot_syntax_base_ignored_expr +| @dynamic_type_expr +| @enum_is_case_expr +| @error_expr +| @explicit_cast_expr +| @force_value_expr +| @identity_expr +| @if_expr +| @implicit_conversion_expr +| @in_out_expr +| @key_path_application_expr +| @key_path_dot_expr +| @key_path_expr +| @lazy_initialization_expr +| @literal_expr +| @lookup_expr +| @make_temporarily_escapable_expr +| @obj_c_selector_expr +| @one_way_expr +| @opaque_value_expr +| @open_existential_expr +| @optional_evaluation_expr +| @other_initializer_ref_expr +| @overloaded_decl_ref_expr +| @property_wrapper_value_placeholder_expr +| @rebind_self_in_initializer_expr +| @sequence_expr +| @super_ref_expr +| @tap_expr +| @tuple_element_expr +| @tuple_expr +| @type_expr +| @unresolved_decl_ref_expr +| @unresolved_dot_expr +| @unresolved_member_expr +| @unresolved_pattern_expr +| @unresolved_specialize_expr +| @vararg_expansion_expr +; + +#keyset[id] +expr_types( //dir=expr + int id: @expr ref, + int type_: @type_or_none ref +); + +@any_try_expr = + @force_try_expr +| @optional_try_expr +| @try_expr +; + +#keyset[id] +any_try_exprs( //dir=expr + int id: @any_try_expr ref, + int sub_expr: @expr_or_none ref +); + +applied_property_wrapper_exprs( //dir=expr + unique int id: @applied_property_wrapper_expr, + int kind: int ref, + int value: @expr_or_none ref, + int param: @param_decl_or_none ref +); + +@apply_expr = + @binary_expr +| @call_expr +| @postfix_unary_expr +| @prefix_unary_expr +| @self_apply_expr +; + +#keyset[id] +apply_exprs( //dir=expr + int id: @apply_expr ref, + int function: @expr_or_none ref +); + +#keyset[id, index] +apply_expr_arguments( //dir=expr + int id: @apply_expr ref, + int index: int ref, + int argument: @argument_or_none ref +); + +assign_exprs( //dir=expr + unique int id: @assign_expr, + int dest: @expr_or_none ref, + int source: @expr_or_none ref +); + +bind_optional_exprs( //dir=expr + unique int id: @bind_optional_expr, + int sub_expr: @expr_or_none ref +); + +capture_list_exprs( //dir=expr + unique int id: @capture_list_expr, + int closure_body: @closure_expr_or_none ref +); + +#keyset[id, index] +capture_list_expr_binding_decls( //dir=expr + int id: @capture_list_expr ref, + int index: int ref, + int binding_decl: @pattern_binding_decl_or_none ref +); + +@closure_expr = + @auto_closure_expr +| @explicit_closure_expr +; + +@collection_expr = + @array_expr +| @dictionary_expr +; + +decl_ref_exprs( //dir=expr + unique int id: @decl_ref_expr, + int decl: @decl_or_none ref +); + +#keyset[id, index] +decl_ref_expr_replacement_types( //dir=expr + int id: @decl_ref_expr ref, + int index: int ref, + int replacement_type: @type_or_none ref +); + +#keyset[id] +decl_ref_expr_has_direct_to_storage_semantics( //dir=expr + int id: @decl_ref_expr ref +); + +#keyset[id] +decl_ref_expr_has_direct_to_implementation_semantics( //dir=expr + int id: @decl_ref_expr ref +); + +#keyset[id] +decl_ref_expr_has_ordinary_semantics( //dir=expr + int id: @decl_ref_expr ref +); + +#keyset[id] +decl_ref_expr_has_distributed_thunk_semantics( //dir=expr + int id: @decl_ref_expr ref +); + +default_argument_exprs( //dir=expr + unique int id: @default_argument_expr, + int param_decl: @param_decl_or_none ref, + int param_index: int ref +); + +#keyset[id] +default_argument_expr_caller_side_defaults( //dir=expr + int id: @default_argument_expr ref, + int caller_side_default: @expr_or_none ref +); + +discard_assignment_exprs( //dir=expr + unique int id: @discard_assignment_expr +); + +dot_syntax_base_ignored_exprs( //dir=expr + unique int id: @dot_syntax_base_ignored_expr, + int qualifier: @expr_or_none ref, + int sub_expr: @expr_or_none ref +); + +dynamic_type_exprs( //dir=expr + unique int id: @dynamic_type_expr, + int base: @expr_or_none ref +); + +enum_is_case_exprs( //dir=expr + unique int id: @enum_is_case_expr, + int sub_expr: @expr_or_none ref, + int element: @enum_element_decl_or_none ref +); + +error_exprs( //dir=expr + unique int id: @error_expr +); + +@explicit_cast_expr = + @checked_cast_expr +| @coerce_expr +; + +#keyset[id] +explicit_cast_exprs( //dir=expr + int id: @explicit_cast_expr ref, + int sub_expr: @expr_or_none ref +); + +force_value_exprs( //dir=expr + unique int id: @force_value_expr, + int sub_expr: @expr_or_none ref +); + +@identity_expr = + @await_expr +| @dot_self_expr +| @paren_expr +| @unresolved_member_chain_result_expr +; + +#keyset[id] +identity_exprs( //dir=expr + int id: @identity_expr ref, + int sub_expr: @expr_or_none ref +); + +if_exprs( //dir=expr + unique int id: @if_expr, + int condition: @expr_or_none ref, + int then_expr: @expr_or_none ref, + int else_expr: @expr_or_none ref +); + +@implicit_conversion_expr = + @abi_safe_conversion_expr +| @any_hashable_erasure_expr +| @archetype_to_super_expr +| @array_to_pointer_expr +| @bridge_from_obj_c_expr +| @bridge_to_obj_c_expr +| @class_metatype_to_object_expr +| @collection_upcast_conversion_expr +| @conditional_bridge_from_obj_c_expr +| @covariant_function_conversion_expr +| @covariant_return_conversion_expr +| @derived_to_base_expr +| @destructure_tuple_expr +| @differentiable_function_expr +| @differentiable_function_extract_original_expr +| @erasure_expr +| @existential_metatype_to_object_expr +| @foreign_object_conversion_expr +| @function_conversion_expr +| @in_out_to_pointer_expr +| @inject_into_optional_expr +| @linear_function_expr +| @linear_function_extract_original_expr +| @linear_to_differentiable_function_expr +| @load_expr +| @metatype_conversion_expr +| @pointer_to_pointer_expr +| @protocol_metatype_to_object_expr +| @string_to_pointer_expr +| @underlying_to_opaque_expr +| @unevaluated_instance_expr +| @unresolved_type_conversion_expr +; + +#keyset[id] +implicit_conversion_exprs( //dir=expr + int id: @implicit_conversion_expr ref, + int sub_expr: @expr_or_none ref +); + +in_out_exprs( //dir=expr + unique int id: @in_out_expr, + int sub_expr: @expr_or_none ref +); + +key_path_application_exprs( //dir=expr + unique int id: @key_path_application_expr, + int base: @expr_or_none ref, + int key_path: @expr_or_none ref +); + +key_path_dot_exprs( //dir=expr + unique int id: @key_path_dot_expr +); + +key_path_exprs( //dir=expr + unique int id: @key_path_expr +); + +#keyset[id] +key_path_expr_roots( //dir=expr + int id: @key_path_expr ref, + int root: @type_repr_or_none ref +); + +#keyset[id, index] +key_path_expr_components( //dir=expr + int id: @key_path_expr ref, + int index: int ref, + int component: @key_path_component_or_none ref +); + +lazy_initialization_exprs( //dir=expr + unique int id: @lazy_initialization_expr, + int sub_expr: @expr_or_none ref +); + +@literal_expr = + @builtin_literal_expr +| @interpolated_string_literal_expr +| @nil_literal_expr +| @object_literal_expr +| @regex_literal_expr +; + +@lookup_expr = + @dynamic_lookup_expr +| @member_ref_expr +| @subscript_expr +; + +#keyset[id] +lookup_exprs( //dir=expr + int id: @lookup_expr ref, + int base: @expr_or_none ref +); + +#keyset[id] +lookup_expr_members( //dir=expr + int id: @lookup_expr ref, + int member: @decl_or_none ref +); + +make_temporarily_escapable_exprs( //dir=expr + unique int id: @make_temporarily_escapable_expr, + int escaping_closure: @opaque_value_expr_or_none ref, + int nonescaping_closure: @expr_or_none ref, + int sub_expr: @expr_or_none ref +); + +obj_c_selector_exprs( //dir=expr + unique int id: @obj_c_selector_expr, + int sub_expr: @expr_or_none ref, + int method: @function_or_none ref +); + +one_way_exprs( //dir=expr + unique int id: @one_way_expr, + int sub_expr: @expr_or_none ref +); + +opaque_value_exprs( //dir=expr + unique int id: @opaque_value_expr +); + +open_existential_exprs( //dir=expr + unique int id: @open_existential_expr, + int sub_expr: @expr_or_none ref, + int existential: @expr_or_none ref, + int opaque_expr: @opaque_value_expr_or_none ref +); + +optional_evaluation_exprs( //dir=expr + unique int id: @optional_evaluation_expr, + int sub_expr: @expr_or_none ref +); + +other_initializer_ref_exprs( //dir=expr + unique int id: @other_initializer_ref_expr, + int initializer: @initializer_or_none ref +); + +overloaded_decl_ref_exprs( //dir=expr + unique int id: @overloaded_decl_ref_expr +); + +#keyset[id, index] +overloaded_decl_ref_expr_possible_declarations( //dir=expr + int id: @overloaded_decl_ref_expr ref, + int index: int ref, + int possible_declaration: @value_decl_or_none ref +); + +property_wrapper_value_placeholder_exprs( //dir=expr + unique int id: @property_wrapper_value_placeholder_expr, + int placeholder: @opaque_value_expr_or_none ref +); + +#keyset[id] +property_wrapper_value_placeholder_expr_wrapped_values( //dir=expr + int id: @property_wrapper_value_placeholder_expr ref, + int wrapped_value: @expr_or_none ref +); + +rebind_self_in_initializer_exprs( //dir=expr + unique int id: @rebind_self_in_initializer_expr, + int sub_expr: @expr_or_none ref, + int self: @var_decl_or_none ref +); + +sequence_exprs( //dir=expr + unique int id: @sequence_expr +); + +#keyset[id, index] +sequence_expr_elements( //dir=expr + int id: @sequence_expr ref, + int index: int ref, + int element: @expr_or_none ref +); + +super_ref_exprs( //dir=expr + unique int id: @super_ref_expr, + int self: @var_decl_or_none ref +); + +tap_exprs( //dir=expr + unique int id: @tap_expr, + int body: @brace_stmt_or_none ref, + int var: @var_decl_or_none ref +); + +#keyset[id] +tap_expr_sub_exprs( //dir=expr + int id: @tap_expr ref, + int sub_expr: @expr_or_none ref +); + +tuple_element_exprs( //dir=expr + unique int id: @tuple_element_expr, + int sub_expr: @expr_or_none ref, + int index: int ref +); + +tuple_exprs( //dir=expr + unique int id: @tuple_expr +); + +#keyset[id, index] +tuple_expr_elements( //dir=expr + int id: @tuple_expr ref, + int index: int ref, + int element: @expr_or_none ref +); + +type_exprs( //dir=expr + unique int id: @type_expr +); + +#keyset[id] +type_expr_type_reprs( //dir=expr + int id: @type_expr ref, + int type_repr: @type_repr_or_none ref +); + +unresolved_decl_ref_exprs( //dir=expr + unique int id: @unresolved_decl_ref_expr +); + +#keyset[id] +unresolved_decl_ref_expr_names( //dir=expr + int id: @unresolved_decl_ref_expr ref, + string name: string ref +); + +unresolved_dot_exprs( //dir=expr + unique int id: @unresolved_dot_expr, + int base: @expr_or_none ref, + string name: string ref +); + +unresolved_member_exprs( //dir=expr + unique int id: @unresolved_member_expr, + string name: string ref +); + +unresolved_pattern_exprs( //dir=expr + unique int id: @unresolved_pattern_expr, + int sub_pattern: @pattern_or_none ref +); + +unresolved_specialize_exprs( //dir=expr + unique int id: @unresolved_specialize_expr, + int sub_expr: @expr_or_none ref +); + +vararg_expansion_exprs( //dir=expr + unique int id: @vararg_expansion_expr, + int sub_expr: @expr_or_none ref +); + +abi_safe_conversion_exprs( //dir=expr + unique int id: @abi_safe_conversion_expr +); + +any_hashable_erasure_exprs( //dir=expr + unique int id: @any_hashable_erasure_expr +); + +archetype_to_super_exprs( //dir=expr + unique int id: @archetype_to_super_expr +); + +array_exprs( //dir=expr + unique int id: @array_expr +); + +#keyset[id, index] +array_expr_elements( //dir=expr + int id: @array_expr ref, + int index: int ref, + int element: @expr_or_none ref +); + +array_to_pointer_exprs( //dir=expr + unique int id: @array_to_pointer_expr +); + +auto_closure_exprs( //dir=expr + unique int id: @auto_closure_expr +); + +await_exprs( //dir=expr + unique int id: @await_expr +); + +binary_exprs( //dir=expr + unique int id: @binary_expr +); + +bridge_from_obj_c_exprs( //dir=expr + unique int id: @bridge_from_obj_c_expr +); + +bridge_to_obj_c_exprs( //dir=expr + unique int id: @bridge_to_obj_c_expr +); + +@builtin_literal_expr = + @boolean_literal_expr +| @magic_identifier_literal_expr +| @number_literal_expr +| @string_literal_expr +; + +call_exprs( //dir=expr + unique int id: @call_expr +); + +@checked_cast_expr = + @conditional_checked_cast_expr +| @forced_checked_cast_expr +| @is_expr +; + +class_metatype_to_object_exprs( //dir=expr + unique int id: @class_metatype_to_object_expr +); + +coerce_exprs( //dir=expr + unique int id: @coerce_expr +); + +collection_upcast_conversion_exprs( //dir=expr + unique int id: @collection_upcast_conversion_expr +); + +conditional_bridge_from_obj_c_exprs( //dir=expr + unique int id: @conditional_bridge_from_obj_c_expr +); + +covariant_function_conversion_exprs( //dir=expr + unique int id: @covariant_function_conversion_expr +); + +covariant_return_conversion_exprs( //dir=expr + unique int id: @covariant_return_conversion_expr +); + +derived_to_base_exprs( //dir=expr + unique int id: @derived_to_base_expr +); + +destructure_tuple_exprs( //dir=expr + unique int id: @destructure_tuple_expr +); + +dictionary_exprs( //dir=expr + unique int id: @dictionary_expr +); + +#keyset[id, index] +dictionary_expr_elements( //dir=expr + int id: @dictionary_expr ref, + int index: int ref, + int element: @expr_or_none ref +); + +differentiable_function_exprs( //dir=expr + unique int id: @differentiable_function_expr +); + +differentiable_function_extract_original_exprs( //dir=expr + unique int id: @differentiable_function_extract_original_expr +); + +dot_self_exprs( //dir=expr + unique int id: @dot_self_expr +); + +@dynamic_lookup_expr = + @dynamic_member_ref_expr +| @dynamic_subscript_expr +; + +erasure_exprs( //dir=expr + unique int id: @erasure_expr +); + +existential_metatype_to_object_exprs( //dir=expr + unique int id: @existential_metatype_to_object_expr +); + +explicit_closure_exprs( //dir=expr + unique int id: @explicit_closure_expr +); + +force_try_exprs( //dir=expr + unique int id: @force_try_expr +); + +foreign_object_conversion_exprs( //dir=expr + unique int id: @foreign_object_conversion_expr +); + +function_conversion_exprs( //dir=expr + unique int id: @function_conversion_expr +); + +in_out_to_pointer_exprs( //dir=expr + unique int id: @in_out_to_pointer_expr +); + +inject_into_optional_exprs( //dir=expr + unique int id: @inject_into_optional_expr +); + +interpolated_string_literal_exprs( //dir=expr + unique int id: @interpolated_string_literal_expr +); + +#keyset[id] +interpolated_string_literal_expr_interpolation_exprs( //dir=expr + int id: @interpolated_string_literal_expr ref, + int interpolation_expr: @opaque_value_expr_or_none ref +); + +#keyset[id] +interpolated_string_literal_expr_appending_exprs( //dir=expr + int id: @interpolated_string_literal_expr ref, + int appending_expr: @tap_expr_or_none ref +); + +linear_function_exprs( //dir=expr + unique int id: @linear_function_expr +); + +linear_function_extract_original_exprs( //dir=expr + unique int id: @linear_function_extract_original_expr +); + +linear_to_differentiable_function_exprs( //dir=expr + unique int id: @linear_to_differentiable_function_expr +); + +load_exprs( //dir=expr + unique int id: @load_expr +); + +member_ref_exprs( //dir=expr + unique int id: @member_ref_expr +); + +#keyset[id] +member_ref_expr_has_direct_to_storage_semantics( //dir=expr + int id: @member_ref_expr ref +); + +#keyset[id] +member_ref_expr_has_direct_to_implementation_semantics( //dir=expr + int id: @member_ref_expr ref +); + +#keyset[id] +member_ref_expr_has_ordinary_semantics( //dir=expr + int id: @member_ref_expr ref +); + +#keyset[id] +member_ref_expr_has_distributed_thunk_semantics( //dir=expr + int id: @member_ref_expr ref +); + +metatype_conversion_exprs( //dir=expr + unique int id: @metatype_conversion_expr +); + +nil_literal_exprs( //dir=expr + unique int id: @nil_literal_expr +); + +object_literal_exprs( //dir=expr + unique int id: @object_literal_expr, + int kind: int ref +); + +#keyset[id, index] +object_literal_expr_arguments( //dir=expr + int id: @object_literal_expr ref, + int index: int ref, + int argument: @argument_or_none ref +); + +optional_try_exprs( //dir=expr + unique int id: @optional_try_expr +); + +paren_exprs( //dir=expr + unique int id: @paren_expr +); + +pointer_to_pointer_exprs( //dir=expr + unique int id: @pointer_to_pointer_expr +); + +postfix_unary_exprs( //dir=expr + unique int id: @postfix_unary_expr +); + +prefix_unary_exprs( //dir=expr + unique int id: @prefix_unary_expr +); + +protocol_metatype_to_object_exprs( //dir=expr + unique int id: @protocol_metatype_to_object_expr +); + +regex_literal_exprs( //dir=expr + unique int id: @regex_literal_expr, + string pattern: string ref, + int version: int ref +); + +@self_apply_expr = + @dot_syntax_call_expr +| @initializer_ref_call_expr +; + +#keyset[id] +self_apply_exprs( //dir=expr + int id: @self_apply_expr ref, + int base: @expr_or_none ref +); + +string_to_pointer_exprs( //dir=expr + unique int id: @string_to_pointer_expr +); + +subscript_exprs( //dir=expr + unique int id: @subscript_expr +); + +#keyset[id, index] +subscript_expr_arguments( //dir=expr + int id: @subscript_expr ref, + int index: int ref, + int argument: @argument_or_none ref +); + +#keyset[id] +subscript_expr_has_direct_to_storage_semantics( //dir=expr + int id: @subscript_expr ref +); + +#keyset[id] +subscript_expr_has_direct_to_implementation_semantics( //dir=expr + int id: @subscript_expr ref +); + +#keyset[id] +subscript_expr_has_ordinary_semantics( //dir=expr + int id: @subscript_expr ref +); + +#keyset[id] +subscript_expr_has_distributed_thunk_semantics( //dir=expr + int id: @subscript_expr ref +); + +try_exprs( //dir=expr + unique int id: @try_expr +); + +underlying_to_opaque_exprs( //dir=expr + unique int id: @underlying_to_opaque_expr +); + +unevaluated_instance_exprs( //dir=expr + unique int id: @unevaluated_instance_expr +); + +unresolved_member_chain_result_exprs( //dir=expr + unique int id: @unresolved_member_chain_result_expr +); + +unresolved_type_conversion_exprs( //dir=expr + unique int id: @unresolved_type_conversion_expr +); + +boolean_literal_exprs( //dir=expr + unique int id: @boolean_literal_expr, + boolean value: boolean ref +); + +conditional_checked_cast_exprs( //dir=expr + unique int id: @conditional_checked_cast_expr +); + +dot_syntax_call_exprs( //dir=expr + unique int id: @dot_syntax_call_expr +); + +dynamic_member_ref_exprs( //dir=expr + unique int id: @dynamic_member_ref_expr +); + +dynamic_subscript_exprs( //dir=expr + unique int id: @dynamic_subscript_expr +); + +forced_checked_cast_exprs( //dir=expr + unique int id: @forced_checked_cast_expr +); + +initializer_ref_call_exprs( //dir=expr + unique int id: @initializer_ref_call_expr +); + +is_exprs( //dir=expr + unique int id: @is_expr +); + +magic_identifier_literal_exprs( //dir=expr + unique int id: @magic_identifier_literal_expr, + string kind: string ref +); + +@number_literal_expr = + @float_literal_expr +| @integer_literal_expr +; + +string_literal_exprs( //dir=expr + unique int id: @string_literal_expr, + string value: string ref +); + +float_literal_exprs( //dir=expr + unique int id: @float_literal_expr, + string string_value: string ref +); + +integer_literal_exprs( //dir=expr + unique int id: @integer_literal_expr, + string string_value: string ref +); + +@pattern = + @any_pattern +| @binding_pattern +| @bool_pattern +| @enum_element_pattern +| @expr_pattern +| @is_pattern +| @named_pattern +| @optional_some_pattern +| @paren_pattern +| @tuple_pattern +| @typed_pattern +; + +any_patterns( //dir=pattern + unique int id: @any_pattern +); + +binding_patterns( //dir=pattern + unique int id: @binding_pattern, + int sub_pattern: @pattern_or_none ref +); + +bool_patterns( //dir=pattern + unique int id: @bool_pattern, + boolean value: boolean ref +); + +enum_element_patterns( //dir=pattern + unique int id: @enum_element_pattern, + int element: @enum_element_decl_or_none ref +); + +#keyset[id] +enum_element_pattern_sub_patterns( //dir=pattern + int id: @enum_element_pattern ref, + int sub_pattern: @pattern_or_none ref +); + +expr_patterns( //dir=pattern + unique int id: @expr_pattern, + int sub_expr: @expr_or_none ref +); + +is_patterns( //dir=pattern + unique int id: @is_pattern +); + +#keyset[id] +is_pattern_cast_type_reprs( //dir=pattern + int id: @is_pattern ref, + int cast_type_repr: @type_repr_or_none ref +); + +#keyset[id] +is_pattern_sub_patterns( //dir=pattern + int id: @is_pattern ref, + int sub_pattern: @pattern_or_none ref +); + +named_patterns( //dir=pattern + unique int id: @named_pattern, + int var_decl: @var_decl_or_none ref +); + +optional_some_patterns( //dir=pattern + unique int id: @optional_some_pattern, + int sub_pattern: @pattern_or_none ref +); + +paren_patterns( //dir=pattern + unique int id: @paren_pattern, + int sub_pattern: @pattern_or_none ref +); + +tuple_patterns( //dir=pattern + unique int id: @tuple_pattern +); + +#keyset[id, index] +tuple_pattern_elements( //dir=pattern + int id: @tuple_pattern ref, + int index: int ref, + int element: @pattern_or_none ref +); + +typed_patterns( //dir=pattern + unique int id: @typed_pattern, + int sub_pattern: @pattern_or_none ref +); + +#keyset[id] +typed_pattern_type_reprs( //dir=pattern + int id: @typed_pattern ref, + int type_repr: @type_repr_or_none ref +); + +case_label_items( //dir=stmt + unique int id: @case_label_item, + int pattern: @pattern_or_none ref +); + +#keyset[id] +case_label_item_guards( //dir=stmt + int id: @case_label_item ref, + int guard: @expr_or_none ref +); + +condition_elements( //dir=stmt + unique int id: @condition_element +); + +#keyset[id] +condition_element_booleans( //dir=stmt + int id: @condition_element ref, + int boolean_: @expr_or_none ref +); + +#keyset[id] +condition_element_patterns( //dir=stmt + int id: @condition_element ref, + int pattern: @pattern_or_none ref +); + +#keyset[id] +condition_element_initializers( //dir=stmt + int id: @condition_element ref, + int initializer: @expr_or_none ref +); + +#keyset[id] +condition_element_availabilities( //dir=stmt + int id: @condition_element ref, + int availability: @availability_info_or_none ref +); + +@stmt = + @brace_stmt +| @break_stmt +| @case_stmt +| @continue_stmt +| @defer_stmt +| @fail_stmt +| @fallthrough_stmt +| @labeled_stmt +| @pound_assert_stmt +| @return_stmt +| @throw_stmt +| @yield_stmt +; + +stmt_conditions( //dir=stmt + unique int id: @stmt_condition +); + +#keyset[id, index] +stmt_condition_elements( //dir=stmt + int id: @stmt_condition ref, + int index: int ref, + int element: @condition_element_or_none ref +); + +brace_stmts( //dir=stmt + unique int id: @brace_stmt +); + +#keyset[id, index] +brace_stmt_elements( //dir=stmt + int id: @brace_stmt ref, + int index: int ref, + int element: @ast_node_or_none ref +); + +break_stmts( //dir=stmt + unique int id: @break_stmt +); + +#keyset[id] +break_stmt_target_names( //dir=stmt + int id: @break_stmt ref, + string target_name: string ref +); + +#keyset[id] +break_stmt_targets( //dir=stmt + int id: @break_stmt ref, + int target: @stmt_or_none ref +); + +case_stmts( //dir=stmt + unique int id: @case_stmt, + int body: @stmt_or_none ref +); + +#keyset[id, index] +case_stmt_labels( //dir=stmt + int id: @case_stmt ref, + int index: int ref, + int label: @case_label_item_or_none ref +); + +#keyset[id, index] +case_stmt_variables( //dir=stmt + int id: @case_stmt ref, + int index: int ref, + int variable: @var_decl_or_none ref +); + +continue_stmts( //dir=stmt + unique int id: @continue_stmt +); + +#keyset[id] +continue_stmt_target_names( //dir=stmt + int id: @continue_stmt ref, + string target_name: string ref +); + +#keyset[id] +continue_stmt_targets( //dir=stmt + int id: @continue_stmt ref, + int target: @stmt_or_none ref +); + +defer_stmts( //dir=stmt + unique int id: @defer_stmt, + int body: @brace_stmt_or_none ref +); + +fail_stmts( //dir=stmt + unique int id: @fail_stmt +); + +fallthrough_stmts( //dir=stmt + unique int id: @fallthrough_stmt, + int fallthrough_source: @case_stmt_or_none ref, + int fallthrough_dest: @case_stmt_or_none ref +); + +@labeled_stmt = + @do_catch_stmt +| @do_stmt +| @for_each_stmt +| @labeled_conditional_stmt +| @repeat_while_stmt +| @switch_stmt +; + +#keyset[id] +labeled_stmt_labels( //dir=stmt + int id: @labeled_stmt ref, + string label: string ref +); + +pound_assert_stmts( //dir=stmt + unique int id: @pound_assert_stmt, + int condition: @expr_or_none ref, + string message: string ref +); + +return_stmts( //dir=stmt + unique int id: @return_stmt +); + +#keyset[id] +return_stmt_results( //dir=stmt + int id: @return_stmt ref, + int result: @expr_or_none ref +); + +throw_stmts( //dir=stmt + unique int id: @throw_stmt, + int sub_expr: @expr_or_none ref +); + +yield_stmts( //dir=stmt + unique int id: @yield_stmt +); + +#keyset[id, index] +yield_stmt_results( //dir=stmt + int id: @yield_stmt ref, + int index: int ref, + int result: @expr_or_none ref +); + +do_catch_stmts( //dir=stmt + unique int id: @do_catch_stmt, + int body: @stmt_or_none ref +); + +#keyset[id, index] +do_catch_stmt_catches( //dir=stmt + int id: @do_catch_stmt ref, + int index: int ref, + int catch: @case_stmt_or_none ref +); + +do_stmts( //dir=stmt + unique int id: @do_stmt, + int body: @brace_stmt_or_none ref +); + +for_each_stmts( //dir=stmt + unique int id: @for_each_stmt, + int pattern: @pattern_or_none ref, + int body: @brace_stmt_or_none ref +); + +#keyset[id] +for_each_stmt_wheres( //dir=stmt + int id: @for_each_stmt ref, + int where: @expr_or_none ref +); + +#keyset[id] +for_each_stmt_iterator_vars( //dir=stmt + int id: @for_each_stmt ref, + int iteratorVar: @pattern_binding_decl_or_none ref +); + +#keyset[id] +for_each_stmt_next_calls( //dir=stmt + int id: @for_each_stmt ref, + int nextCall: @expr_or_none ref +); + +@labeled_conditional_stmt = + @guard_stmt +| @if_stmt +| @while_stmt +; + +#keyset[id] +labeled_conditional_stmts( //dir=stmt + int id: @labeled_conditional_stmt ref, + int condition: @stmt_condition_or_none ref +); + +repeat_while_stmts( //dir=stmt + unique int id: @repeat_while_stmt, + int condition: @expr_or_none ref, + int body: @stmt_or_none ref +); + +switch_stmts( //dir=stmt + unique int id: @switch_stmt, + int expr: @expr_or_none ref +); + +#keyset[id, index] +switch_stmt_cases( //dir=stmt + int id: @switch_stmt ref, + int index: int ref, + int case_: @case_stmt_or_none ref +); + +guard_stmts( //dir=stmt + unique int id: @guard_stmt, + int body: @brace_stmt_or_none ref +); + +if_stmts( //dir=stmt + unique int id: @if_stmt, + int then: @stmt_or_none ref +); + +#keyset[id] +if_stmt_elses( //dir=stmt + int id: @if_stmt ref, + int else: @stmt_or_none ref +); + +while_stmts( //dir=stmt + unique int id: @while_stmt, + int body: @stmt_or_none ref +); + +@type = + @any_function_type +| @any_generic_type +| @any_metatype_type +| @builtin_type +| @dependent_member_type +| @dynamic_self_type +| @error_type +| @existential_type +| @in_out_type +| @l_value_type +| @module_type +| @parameterized_protocol_type +| @protocol_composition_type +| @reference_storage_type +| @substitutable_type +| @sugar_type +| @tuple_type +| @unresolved_type +; + +#keyset[id] +types( //dir=type + int id: @type ref, + string name: string ref, + int canonical_type: @type_or_none ref +); + +type_reprs( //dir=type + unique int id: @type_repr, + int type_: @type_or_none ref +); + +@any_function_type = + @function_type +| @generic_function_type +; + +#keyset[id] +any_function_types( //dir=type + int id: @any_function_type ref, + int result: @type_or_none ref +); + +#keyset[id, index] +any_function_type_param_types( //dir=type + int id: @any_function_type ref, + int index: int ref, + int param_type: @type_or_none ref +); + +#keyset[id] +any_function_type_is_throwing( //dir=type + int id: @any_function_type ref +); + +#keyset[id] +any_function_type_is_async( //dir=type + int id: @any_function_type ref +); + +@any_generic_type = + @nominal_or_bound_generic_nominal_type +| @unbound_generic_type +; + +#keyset[id] +any_generic_types( //dir=type + int id: @any_generic_type ref, + int declaration: @generic_type_decl_or_none ref +); + +#keyset[id] +any_generic_type_parents( //dir=type + int id: @any_generic_type ref, + int parent: @type_or_none ref +); + +@any_metatype_type = + @existential_metatype_type +| @metatype_type +; + +@builtin_type = + @any_builtin_integer_type +| @builtin_bridge_object_type +| @builtin_default_actor_storage_type +| @builtin_executor_type +| @builtin_float_type +| @builtin_job_type +| @builtin_native_object_type +| @builtin_raw_pointer_type +| @builtin_raw_unsafe_continuation_type +| @builtin_unsafe_value_buffer_type +| @builtin_vector_type +; + +dependent_member_types( //dir=type + unique int id: @dependent_member_type, + int base_type: @type_or_none ref, + int associated_type_decl: @associated_type_decl_or_none ref +); + +dynamic_self_types( //dir=type + unique int id: @dynamic_self_type, + int static_self_type: @type_or_none ref +); + +error_types( //dir=type + unique int id: @error_type +); + +existential_types( //dir=type + unique int id: @existential_type, + int constraint: @type_or_none ref +); + +in_out_types( //dir=type + unique int id: @in_out_type, + int object_type: @type_or_none ref +); + +l_value_types( //dir=type + unique int id: @l_value_type, + int object_type: @type_or_none ref +); + +module_types( //dir=type + unique int id: @module_type, + int module: @module_decl_or_none ref +); + +parameterized_protocol_types( //dir=type + unique int id: @parameterized_protocol_type, + int base: @protocol_type_or_none ref +); + +#keyset[id, index] +parameterized_protocol_type_args( //dir=type + int id: @parameterized_protocol_type ref, + int index: int ref, + int arg: @type_or_none ref +); + +protocol_composition_types( //dir=type + unique int id: @protocol_composition_type +); + +#keyset[id, index] +protocol_composition_type_members( //dir=type + int id: @protocol_composition_type ref, + int index: int ref, + int member: @type_or_none ref +); + +@reference_storage_type = + @unmanaged_storage_type +| @unowned_storage_type +| @weak_storage_type +; + +#keyset[id] +reference_storage_types( //dir=type + int id: @reference_storage_type ref, + int referent_type: @type_or_none ref +); + +@substitutable_type = + @archetype_type +| @generic_type_param_type +; + +@sugar_type = + @paren_type +| @syntax_sugar_type +| @type_alias_type +; + +tuple_types( //dir=type + unique int id: @tuple_type +); + +#keyset[id, index] +tuple_type_types( //dir=type + int id: @tuple_type ref, + int index: int ref, + int type_: @type_or_none ref +); + +#keyset[id, index] +tuple_type_names( //dir=type + int id: @tuple_type ref, + int index: int ref, + string name: string ref +); + +unresolved_types( //dir=type + unique int id: @unresolved_type +); + +@any_builtin_integer_type = + @builtin_integer_literal_type +| @builtin_integer_type +; + +@archetype_type = + @opaque_type_archetype_type +| @opened_archetype_type +| @primary_archetype_type +; + +#keyset[id] +archetype_types( //dir=type + int id: @archetype_type ref, + int interface_type: @type_or_none ref +); + +#keyset[id] +archetype_type_superclasses( //dir=type + int id: @archetype_type ref, + int superclass: @type_or_none ref +); + +#keyset[id, index] +archetype_type_protocols( //dir=type + int id: @archetype_type ref, + int index: int ref, + int protocol: @protocol_decl_or_none ref +); + +builtin_bridge_object_types( //dir=type + unique int id: @builtin_bridge_object_type +); + +builtin_default_actor_storage_types( //dir=type + unique int id: @builtin_default_actor_storage_type +); + +builtin_executor_types( //dir=type + unique int id: @builtin_executor_type +); + +builtin_float_types( //dir=type + unique int id: @builtin_float_type +); + +builtin_job_types( //dir=type + unique int id: @builtin_job_type +); + +builtin_native_object_types( //dir=type + unique int id: @builtin_native_object_type +); + +builtin_raw_pointer_types( //dir=type + unique int id: @builtin_raw_pointer_type +); + +builtin_raw_unsafe_continuation_types( //dir=type + unique int id: @builtin_raw_unsafe_continuation_type +); + +builtin_unsafe_value_buffer_types( //dir=type + unique int id: @builtin_unsafe_value_buffer_type +); + +builtin_vector_types( //dir=type + unique int id: @builtin_vector_type +); + +existential_metatype_types( //dir=type + unique int id: @existential_metatype_type +); + +function_types( //dir=type + unique int id: @function_type +); + +generic_function_types( //dir=type + unique int id: @generic_function_type +); + +#keyset[id, index] +generic_function_type_generic_params( //dir=type + int id: @generic_function_type ref, + int index: int ref, + int generic_param: @generic_type_param_type_or_none ref +); + +generic_type_param_types( //dir=type + unique int id: @generic_type_param_type +); + +metatype_types( //dir=type + unique int id: @metatype_type +); + +@nominal_or_bound_generic_nominal_type = + @bound_generic_type +| @nominal_type +; + +paren_types( //dir=type + unique int id: @paren_type, + int type_: @type_or_none ref +); + +@syntax_sugar_type = + @dictionary_type +| @unary_syntax_sugar_type +; + +type_alias_types( //dir=type + unique int id: @type_alias_type, + int decl: @type_alias_decl_or_none ref +); + +unbound_generic_types( //dir=type + unique int id: @unbound_generic_type +); + +unmanaged_storage_types( //dir=type + unique int id: @unmanaged_storage_type +); + +unowned_storage_types( //dir=type + unique int id: @unowned_storage_type +); + +weak_storage_types( //dir=type + unique int id: @weak_storage_type +); + +@bound_generic_type = + @bound_generic_class_type +| @bound_generic_enum_type +| @bound_generic_struct_type +; + +#keyset[id, index] +bound_generic_type_arg_types( //dir=type + int id: @bound_generic_type ref, + int index: int ref, + int arg_type: @type_or_none ref +); + +builtin_integer_literal_types( //dir=type + unique int id: @builtin_integer_literal_type +); + +builtin_integer_types( //dir=type + unique int id: @builtin_integer_type +); + +#keyset[id] +builtin_integer_type_widths( //dir=type + int id: @builtin_integer_type ref, + int width: int ref +); + +dictionary_types( //dir=type + unique int id: @dictionary_type, + int key_type: @type_or_none ref, + int value_type: @type_or_none ref +); + +@nominal_type = + @class_type +| @enum_type +| @protocol_type +| @struct_type +; + +opaque_type_archetype_types( //dir=type + unique int id: @opaque_type_archetype_type, + int declaration: @opaque_type_decl_or_none ref +); + +opened_archetype_types( //dir=type + unique int id: @opened_archetype_type +); + +primary_archetype_types( //dir=type + unique int id: @primary_archetype_type +); + +@unary_syntax_sugar_type = + @array_slice_type +| @optional_type +| @variadic_sequence_type +; + +#keyset[id] +unary_syntax_sugar_types( //dir=type + int id: @unary_syntax_sugar_type ref, + int base_type: @type_or_none ref +); + +array_slice_types( //dir=type + unique int id: @array_slice_type +); + +bound_generic_class_types( //dir=type + unique int id: @bound_generic_class_type +); + +bound_generic_enum_types( //dir=type + unique int id: @bound_generic_enum_type +); + +bound_generic_struct_types( //dir=type + unique int id: @bound_generic_struct_type +); + +class_types( //dir=type + unique int id: @class_type +); + +enum_types( //dir=type + unique int id: @enum_type +); + +optional_types( //dir=type + unique int id: @optional_type +); + +protocol_types( //dir=type + unique int id: @protocol_type +); + +struct_types( //dir=type + unique int id: @struct_type +); + +variadic_sequence_types( //dir=type + unique int id: @variadic_sequence_type +); + +@accessor_or_none = + @accessor +| @unspecified_element +; + +@argument_or_none = + @argument +| @unspecified_element +; + +@associated_type_decl_or_none = + @associated_type_decl +| @unspecified_element +; + +@ast_node_or_none = + @ast_node +| @unspecified_element +; + +@availability_info_or_none = + @availability_info +| @unspecified_element +; + +@availability_spec_or_none = + @availability_spec +| @unspecified_element +; + +@brace_stmt_or_none = + @brace_stmt +| @unspecified_element +; + +@captured_decl_or_none = + @captured_decl +| @unspecified_element +; + +@case_label_item_or_none = + @case_label_item +| @unspecified_element +; + +@case_stmt_or_none = + @case_stmt +| @unspecified_element +; + +@closure_expr_or_none = + @closure_expr +| @unspecified_element +; + +@condition_element_or_none = + @condition_element +| @unspecified_element +; + +@decl_or_none = + @decl +| @unspecified_element +; + +@enum_element_decl_or_none = + @enum_element_decl +| @unspecified_element +; + +@expr_or_none = + @expr +| @unspecified_element +; + +@file_or_none = + @file +| @unspecified_element +; + +@function_or_none = + @function +| @unspecified_element +; + +@generic_type_decl_or_none = + @generic_type_decl +| @unspecified_element +; + +@generic_type_param_decl_or_none = + @generic_type_param_decl +| @unspecified_element +; + +@generic_type_param_type_or_none = + @generic_type_param_type +| @unspecified_element +; + +@initializer_or_none = + @initializer +| @unspecified_element +; + +@key_path_component_or_none = + @key_path_component +| @unspecified_element +; + +@location_or_none = + @location +| @unspecified_element +; + +@module_decl_or_none = + @module_decl +| @unspecified_element +; + +@nominal_type_decl_or_none = + @nominal_type_decl +| @unspecified_element +; + +@opaque_type_decl_or_none = + @opaque_type_decl +| @unspecified_element +; + +@opaque_value_expr_or_none = + @opaque_value_expr +| @unspecified_element +; + +@param_decl_or_none = + @param_decl +| @unspecified_element +; + +@pattern_or_none = + @pattern +| @unspecified_element +; + +@pattern_binding_decl_or_none = + @pattern_binding_decl +| @unspecified_element +; + +@precedence_group_decl_or_none = + @precedence_group_decl +| @unspecified_element +; + +@protocol_decl_or_none = + @protocol_decl +| @unspecified_element +; + +@protocol_type_or_none = + @protocol_type +| @unspecified_element +; + +@stmt_or_none = + @stmt +| @unspecified_element +; + +@stmt_condition_or_none = + @stmt_condition +| @unspecified_element +; + +@string_literal_expr_or_none = + @string_literal_expr +| @unspecified_element +; + +@tap_expr_or_none = + @tap_expr +| @unspecified_element +; + +@type_or_none = + @type +| @unspecified_element +; + +@type_alias_decl_or_none = + @type_alias_decl +| @unspecified_element +; + +@type_repr_or_none = + @type_repr +| @unspecified_element +; + +@value_decl_or_none = + @unspecified_element +| @value_decl +; + +@var_decl_or_none = + @unspecified_element +| @var_decl +; diff --git a/swift/ql/lib/upgrades/c0db61944f46ba5507f207ec2b1cff77ad0529a1/upgrade.properties b/swift/ql/lib/upgrades/c0db61944f46ba5507f207ec2b1cff77ad0529a1/upgrade.properties new file mode 100644 index 000000000000..e248d7acba21 --- /dev/null +++ b/swift/ql/lib/upgrades/c0db61944f46ba5507f207ec2b1cff77ad0529a1/upgrade.properties @@ -0,0 +1,4 @@ +description: change the second column in named_patterns to a var_decl +compatibility: partial + +named_patterns.rel: run named_patterns.ql \ No newline at end of file diff --git a/swift/ql/lib/upgrades/e69de29bb2d1d6434b8b29ae775ad8c2e48c5391/old.dbscheme b/swift/ql/lib/upgrades/e69de29bb2d1d6434b8b29ae775ad8c2e48c5391/old.dbscheme new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/swift/ql/lib/upgrades/e69de29bb2d1d6434b8b29ae775ad8c2e48c5391/swift.dbscheme b/swift/ql/lib/upgrades/e69de29bb2d1d6434b8b29ae775ad8c2e48c5391/swift.dbscheme new file mode 100644 index 000000000000..7c17e1f4b2d3 --- /dev/null +++ b/swift/ql/lib/upgrades/e69de29bb2d1d6434b8b29ae775ad8c2e48c5391/swift.dbscheme @@ -0,0 +1,2636 @@ +// generated by codegen/codegen.py + +// from prefix.dbscheme +/** + * The source location of the snapshot. + */ +sourceLocationPrefix( + string prefix: string ref +); + + +// from schema.py + +@element = + @callable +| @file +| @generic_context +| @locatable +| @location +| @type +; + +#keyset[id] +element_is_unknown( + int id: @element ref +); + +@callable = + @closure_expr +| @function +; + +#keyset[id] +callable_names( + int id: @callable ref, + string name: string ref +); + +#keyset[id] +callable_self_params( + int id: @callable ref, + int self_param: @param_decl_or_none ref +); + +#keyset[id, index] +callable_params( + int id: @callable ref, + int index: int ref, + int param: @param_decl_or_none ref +); + +#keyset[id] +callable_bodies( + int id: @callable ref, + int body: @brace_stmt_or_none ref +); + +#keyset[id, index] +callable_captures( + int id: @callable ref, + int index: int ref, + int capture: @captured_decl_or_none ref +); + +@file = + @db_file +; + +#keyset[id] +files( + int id: @file ref, + string name: string ref +); + +#keyset[id] +file_is_successfully_extracted( + int id: @file ref +); + +@locatable = + @argument +| @ast_node +| @comment +| @diagnostics +| @error_element +; + +#keyset[id] +locatable_locations( + int id: @locatable ref, + int location: @location_or_none ref +); + +@location = + @db_location +; + +#keyset[id] +locations( + int id: @location ref, + int file: @file_or_none ref, + int start_line: int ref, + int start_column: int ref, + int end_line: int ref, + int end_column: int ref +); + +@ast_node = + @availability_info +| @availability_spec +| @case_label_item +| @condition_element +| @decl +| @expr +| @key_path_component +| @pattern +| @stmt +| @stmt_condition +| @type_repr +; + +comments( + unique int id: @comment, + string text: string ref +); + +db_files( + unique int id: @db_file +); + +db_locations( + unique int id: @db_location +); + +diagnostics( + unique int id: @diagnostics, + string text: string ref, + int kind: int ref +); + +@error_element = + @error_expr +| @error_type +| @overloaded_decl_ref_expr +| @unresolved_decl_ref_expr +| @unresolved_dot_expr +| @unresolved_member_chain_result_expr +| @unresolved_member_expr +| @unresolved_pattern_expr +| @unresolved_specialize_expr +| @unresolved_type +| @unresolved_type_conversion_expr +| @unspecified_element +; + +availability_infos( + unique int id: @availability_info +); + +#keyset[id] +availability_info_is_unavailable( + int id: @availability_info ref +); + +#keyset[id, index] +availability_info_specs( + int id: @availability_info ref, + int index: int ref, + int spec: @availability_spec_or_none ref +); + +@availability_spec = + @other_availability_spec +| @platform_version_availability_spec +; + +key_path_components( + unique int id: @key_path_component, + int kind: int ref, + int component_type: @type_or_none ref +); + +#keyset[id, index] +key_path_component_subscript_arguments( + int id: @key_path_component ref, + int index: int ref, + int subscript_argument: @argument_or_none ref +); + +#keyset[id] +key_path_component_tuple_indices( + int id: @key_path_component ref, + int tuple_index: int ref +); + +#keyset[id] +key_path_component_decl_refs( + int id: @key_path_component ref, + int decl_ref: @value_decl_or_none ref +); + +unspecified_elements( + unique int id: @unspecified_element, + string property: string ref, + string error: string ref +); + +#keyset[id] +unspecified_element_parents( + int id: @unspecified_element ref, + int parent: @element ref +); + +#keyset[id] +unspecified_element_indices( + int id: @unspecified_element ref, + int index: int ref +); + +#keyset[id, index] +unspecified_element_children( + int id: @unspecified_element ref, + int index: int ref, + int child: @ast_node_or_none ref +); + +other_availability_specs( + unique int id: @other_availability_spec +); + +platform_version_availability_specs( + unique int id: @platform_version_availability_spec, + string platform: string ref, + string version: string ref +); + +@decl = + @captured_decl +| @enum_case_decl +| @extension_decl +| @if_config_decl +| @import_decl +| @missing_member_decl +| @operator_decl +| @pattern_binding_decl +| @pound_diagnostic_decl +| @precedence_group_decl +| @top_level_code_decl +| @value_decl +; + +#keyset[id] +decls( //dir=decl + int id: @decl ref, + int module: @module_decl_or_none ref +); + +#keyset[id, index] +decl_members( //dir=decl + int id: @decl ref, + int index: int ref, + int member: @decl_or_none ref +); + +@generic_context = + @extension_decl +| @function +| @generic_type_decl +| @subscript_decl +; + +#keyset[id, index] +generic_context_generic_type_params( //dir=decl + int id: @generic_context ref, + int index: int ref, + int generic_type_param: @generic_type_param_decl_or_none ref +); + +captured_decls( //dir=decl + unique int id: @captured_decl, + int decl: @value_decl_or_none ref +); + +#keyset[id] +captured_decl_is_direct( //dir=decl + int id: @captured_decl ref +); + +#keyset[id] +captured_decl_is_escaping( //dir=decl + int id: @captured_decl ref +); + +enum_case_decls( //dir=decl + unique int id: @enum_case_decl +); + +#keyset[id, index] +enum_case_decl_elements( //dir=decl + int id: @enum_case_decl ref, + int index: int ref, + int element: @enum_element_decl_or_none ref +); + +extension_decls( //dir=decl + unique int id: @extension_decl, + int extended_type_decl: @nominal_type_decl_or_none ref +); + +#keyset[id, index] +extension_decl_protocols( //dir=decl + int id: @extension_decl ref, + int index: int ref, + int protocol: @protocol_decl_or_none ref +); + +if_config_decls( //dir=decl + unique int id: @if_config_decl +); + +#keyset[id, index] +if_config_decl_active_elements( //dir=decl + int id: @if_config_decl ref, + int index: int ref, + int active_element: @ast_node_or_none ref +); + +import_decls( //dir=decl + unique int id: @import_decl +); + +#keyset[id] +import_decl_is_exported( //dir=decl + int id: @import_decl ref +); + +#keyset[id] +import_decl_imported_modules( //dir=decl + int id: @import_decl ref, + int imported_module: @module_decl_or_none ref +); + +#keyset[id, index] +import_decl_declarations( //dir=decl + int id: @import_decl ref, + int index: int ref, + int declaration: @value_decl_or_none ref +); + +missing_member_decls( //dir=decl + unique int id: @missing_member_decl, + string name: string ref +); + +@operator_decl = + @infix_operator_decl +| @postfix_operator_decl +| @prefix_operator_decl +; + +#keyset[id] +operator_decls( //dir=decl + int id: @operator_decl ref, + string name: string ref +); + +pattern_binding_decls( //dir=decl + unique int id: @pattern_binding_decl +); + +#keyset[id, index] +pattern_binding_decl_inits( //dir=decl + int id: @pattern_binding_decl ref, + int index: int ref, + int init: @expr_or_none ref +); + +#keyset[id, index] +pattern_binding_decl_patterns( //dir=decl + int id: @pattern_binding_decl ref, + int index: int ref, + int pattern: @pattern_or_none ref +); + +pound_diagnostic_decls( //dir=decl + unique int id: @pound_diagnostic_decl, + int kind: int ref, + int message: @string_literal_expr_or_none ref +); + +precedence_group_decls( //dir=decl + unique int id: @precedence_group_decl +); + +top_level_code_decls( //dir=decl + unique int id: @top_level_code_decl, + int body: @brace_stmt_or_none ref +); + +@value_decl = + @abstract_storage_decl +| @enum_element_decl +| @function +| @type_decl +; + +#keyset[id] +value_decls( //dir=decl + int id: @value_decl ref, + int interface_type: @type_or_none ref +); + +@abstract_storage_decl = + @subscript_decl +| @var_decl +; + +#keyset[id, index] +abstract_storage_decl_accessors( //dir=decl + int id: @abstract_storage_decl ref, + int index: int ref, + int accessor: @accessor_or_none ref +); + +enum_element_decls( //dir=decl + unique int id: @enum_element_decl, + string name: string ref +); + +#keyset[id, index] +enum_element_decl_params( //dir=decl + int id: @enum_element_decl ref, + int index: int ref, + int param: @param_decl_or_none ref +); + +@function = + @accessor_or_named_function +| @deinitializer +| @initializer +; + +infix_operator_decls( //dir=decl + unique int id: @infix_operator_decl +); + +#keyset[id] +infix_operator_decl_precedence_groups( //dir=decl + int id: @infix_operator_decl ref, + int precedence_group: @precedence_group_decl_or_none ref +); + +postfix_operator_decls( //dir=decl + unique int id: @postfix_operator_decl +); + +prefix_operator_decls( //dir=decl + unique int id: @prefix_operator_decl +); + +@type_decl = + @abstract_type_param_decl +| @generic_type_decl +| @module_decl +; + +#keyset[id] +type_decls( //dir=decl + int id: @type_decl ref, + string name: string ref +); + +#keyset[id, index] +type_decl_inherited_types( //dir=decl + int id: @type_decl ref, + int index: int ref, + int inherited_type: @type_or_none ref +); + +@abstract_type_param_decl = + @associated_type_decl +| @generic_type_param_decl +; + +@accessor_or_named_function = + @accessor +| @named_function +; + +deinitializers( //dir=decl + unique int id: @deinitializer +); + +@generic_type_decl = + @nominal_type_decl +| @opaque_type_decl +| @type_alias_decl +; + +initializers( //dir=decl + unique int id: @initializer +); + +module_decls( //dir=decl + unique int id: @module_decl +); + +#keyset[id] +module_decl_is_builtin_module( //dir=decl + int id: @module_decl ref +); + +#keyset[id] +module_decl_is_system_module( //dir=decl + int id: @module_decl ref +); + +module_decl_imported_modules( //dir=decl + int id: @module_decl ref, + int imported_module: @module_decl_or_none ref +); + +module_decl_exported_modules( //dir=decl + int id: @module_decl ref, + int exported_module: @module_decl_or_none ref +); + +subscript_decls( //dir=decl + unique int id: @subscript_decl, + int element_type: @type_or_none ref +); + +#keyset[id, index] +subscript_decl_params( //dir=decl + int id: @subscript_decl ref, + int index: int ref, + int param: @param_decl_or_none ref +); + +@var_decl = + @concrete_var_decl +| @param_decl +; + +#keyset[id] +var_decls( //dir=decl + int id: @var_decl ref, + string name: string ref, + int type_: @type_or_none ref +); + +#keyset[id] +var_decl_attached_property_wrapper_types( //dir=decl + int id: @var_decl ref, + int attached_property_wrapper_type: @type_or_none ref +); + +#keyset[id] +var_decl_parent_patterns( //dir=decl + int id: @var_decl ref, + int parent_pattern: @pattern_or_none ref +); + +#keyset[id] +var_decl_parent_initializers( //dir=decl + int id: @var_decl ref, + int parent_initializer: @expr_or_none ref +); + +#keyset[id] +var_decl_property_wrapper_backing_var_bindings( //dir=decl + int id: @var_decl ref, + int property_wrapper_backing_var_binding: @pattern_binding_decl_or_none ref +); + +#keyset[id] +var_decl_property_wrapper_backing_vars( //dir=decl + int id: @var_decl ref, + int property_wrapper_backing_var: @var_decl_or_none ref +); + +#keyset[id] +var_decl_property_wrapper_projection_var_bindings( //dir=decl + int id: @var_decl ref, + int property_wrapper_projection_var_binding: @pattern_binding_decl_or_none ref +); + +#keyset[id] +var_decl_property_wrapper_projection_vars( //dir=decl + int id: @var_decl ref, + int property_wrapper_projection_var: @var_decl_or_none ref +); + +accessors( //dir=decl + unique int id: @accessor +); + +#keyset[id] +accessor_is_getter( //dir=decl + int id: @accessor ref +); + +#keyset[id] +accessor_is_setter( //dir=decl + int id: @accessor ref +); + +#keyset[id] +accessor_is_will_set( //dir=decl + int id: @accessor ref +); + +#keyset[id] +accessor_is_did_set( //dir=decl + int id: @accessor ref +); + +#keyset[id] +accessor_is_read( //dir=decl + int id: @accessor ref +); + +#keyset[id] +accessor_is_modify( //dir=decl + int id: @accessor ref +); + +#keyset[id] +accessor_is_unsafe_address( //dir=decl + int id: @accessor ref +); + +#keyset[id] +accessor_is_unsafe_mutable_address( //dir=decl + int id: @accessor ref +); + +associated_type_decls( //dir=decl + unique int id: @associated_type_decl +); + +concrete_var_decls( //dir=decl + unique int id: @concrete_var_decl, + int introducer_int: int ref +); + +generic_type_param_decls( //dir=decl + unique int id: @generic_type_param_decl +); + +named_functions( //dir=decl + unique int id: @named_function +); + +@nominal_type_decl = + @class_decl +| @enum_decl +| @protocol_decl +| @struct_decl +; + +#keyset[id] +nominal_type_decls( //dir=decl + int id: @nominal_type_decl ref, + int type_: @type_or_none ref +); + +opaque_type_decls( //dir=decl + unique int id: @opaque_type_decl, + int naming_declaration: @value_decl_or_none ref +); + +#keyset[id, index] +opaque_type_decl_opaque_generic_params( //dir=decl + int id: @opaque_type_decl ref, + int index: int ref, + int opaque_generic_param: @generic_type_param_type_or_none ref +); + +param_decls( //dir=decl + unique int id: @param_decl +); + +#keyset[id] +param_decl_is_inout( //dir=decl + int id: @param_decl ref +); + +#keyset[id] +param_decl_property_wrapper_local_wrapped_var_bindings( //dir=decl + int id: @param_decl ref, + int property_wrapper_local_wrapped_var_binding: @pattern_binding_decl_or_none ref +); + +#keyset[id] +param_decl_property_wrapper_local_wrapped_vars( //dir=decl + int id: @param_decl ref, + int property_wrapper_local_wrapped_var: @var_decl_or_none ref +); + +type_alias_decls( //dir=decl + unique int id: @type_alias_decl, + int aliased_type: @type_or_none ref +); + +class_decls( //dir=decl + unique int id: @class_decl +); + +enum_decls( //dir=decl + unique int id: @enum_decl +); + +protocol_decls( //dir=decl + unique int id: @protocol_decl +); + +struct_decls( //dir=decl + unique int id: @struct_decl +); + +arguments( //dir=expr + unique int id: @argument, + string label: string ref, + int expr: @expr_or_none ref +); + +@expr = + @any_try_expr +| @applied_property_wrapper_expr +| @apply_expr +| @assign_expr +| @bind_optional_expr +| @capture_list_expr +| @closure_expr +| @collection_expr +| @decl_ref_expr +| @default_argument_expr +| @discard_assignment_expr +| @dot_syntax_base_ignored_expr +| @dynamic_type_expr +| @enum_is_case_expr +| @error_expr +| @explicit_cast_expr +| @force_value_expr +| @identity_expr +| @if_expr +| @implicit_conversion_expr +| @in_out_expr +| @key_path_application_expr +| @key_path_dot_expr +| @key_path_expr +| @lazy_initialization_expr +| @literal_expr +| @lookup_expr +| @make_temporarily_escapable_expr +| @obj_c_selector_expr +| @one_way_expr +| @opaque_value_expr +| @open_existential_expr +| @optional_evaluation_expr +| @other_initializer_ref_expr +| @overloaded_decl_ref_expr +| @property_wrapper_value_placeholder_expr +| @rebind_self_in_initializer_expr +| @sequence_expr +| @super_ref_expr +| @tap_expr +| @tuple_element_expr +| @tuple_expr +| @type_expr +| @unresolved_decl_ref_expr +| @unresolved_dot_expr +| @unresolved_member_expr +| @unresolved_pattern_expr +| @unresolved_specialize_expr +| @vararg_expansion_expr +; + +#keyset[id] +expr_types( //dir=expr + int id: @expr ref, + int type_: @type_or_none ref +); + +@any_try_expr = + @force_try_expr +| @optional_try_expr +| @try_expr +; + +#keyset[id] +any_try_exprs( //dir=expr + int id: @any_try_expr ref, + int sub_expr: @expr_or_none ref +); + +applied_property_wrapper_exprs( //dir=expr + unique int id: @applied_property_wrapper_expr, + int kind: int ref, + int value: @expr_or_none ref, + int param: @param_decl_or_none ref +); + +@apply_expr = + @binary_expr +| @call_expr +| @postfix_unary_expr +| @prefix_unary_expr +| @self_apply_expr +; + +#keyset[id] +apply_exprs( //dir=expr + int id: @apply_expr ref, + int function: @expr_or_none ref +); + +#keyset[id, index] +apply_expr_arguments( //dir=expr + int id: @apply_expr ref, + int index: int ref, + int argument: @argument_or_none ref +); + +assign_exprs( //dir=expr + unique int id: @assign_expr, + int dest: @expr_or_none ref, + int source: @expr_or_none ref +); + +bind_optional_exprs( //dir=expr + unique int id: @bind_optional_expr, + int sub_expr: @expr_or_none ref +); + +capture_list_exprs( //dir=expr + unique int id: @capture_list_expr, + int closure_body: @closure_expr_or_none ref +); + +#keyset[id, index] +capture_list_expr_binding_decls( //dir=expr + int id: @capture_list_expr ref, + int index: int ref, + int binding_decl: @pattern_binding_decl_or_none ref +); + +@closure_expr = + @auto_closure_expr +| @explicit_closure_expr +; + +@collection_expr = + @array_expr +| @dictionary_expr +; + +decl_ref_exprs( //dir=expr + unique int id: @decl_ref_expr, + int decl: @decl_or_none ref +); + +#keyset[id, index] +decl_ref_expr_replacement_types( //dir=expr + int id: @decl_ref_expr ref, + int index: int ref, + int replacement_type: @type_or_none ref +); + +#keyset[id] +decl_ref_expr_has_direct_to_storage_semantics( //dir=expr + int id: @decl_ref_expr ref +); + +#keyset[id] +decl_ref_expr_has_direct_to_implementation_semantics( //dir=expr + int id: @decl_ref_expr ref +); + +#keyset[id] +decl_ref_expr_has_ordinary_semantics( //dir=expr + int id: @decl_ref_expr ref +); + +#keyset[id] +decl_ref_expr_has_distributed_thunk_semantics( //dir=expr + int id: @decl_ref_expr ref +); + +default_argument_exprs( //dir=expr + unique int id: @default_argument_expr, + int param_decl: @param_decl_or_none ref, + int param_index: int ref +); + +#keyset[id] +default_argument_expr_caller_side_defaults( //dir=expr + int id: @default_argument_expr ref, + int caller_side_default: @expr_or_none ref +); + +discard_assignment_exprs( //dir=expr + unique int id: @discard_assignment_expr +); + +dot_syntax_base_ignored_exprs( //dir=expr + unique int id: @dot_syntax_base_ignored_expr, + int qualifier: @expr_or_none ref, + int sub_expr: @expr_or_none ref +); + +dynamic_type_exprs( //dir=expr + unique int id: @dynamic_type_expr, + int base: @expr_or_none ref +); + +enum_is_case_exprs( //dir=expr + unique int id: @enum_is_case_expr, + int sub_expr: @expr_or_none ref, + int element: @enum_element_decl_or_none ref +); + +error_exprs( //dir=expr + unique int id: @error_expr +); + +@explicit_cast_expr = + @checked_cast_expr +| @coerce_expr +; + +#keyset[id] +explicit_cast_exprs( //dir=expr + int id: @explicit_cast_expr ref, + int sub_expr: @expr_or_none ref +); + +force_value_exprs( //dir=expr + unique int id: @force_value_expr, + int sub_expr: @expr_or_none ref +); + +@identity_expr = + @await_expr +| @dot_self_expr +| @paren_expr +| @unresolved_member_chain_result_expr +; + +#keyset[id] +identity_exprs( //dir=expr + int id: @identity_expr ref, + int sub_expr: @expr_or_none ref +); + +if_exprs( //dir=expr + unique int id: @if_expr, + int condition: @expr_or_none ref, + int then_expr: @expr_or_none ref, + int else_expr: @expr_or_none ref +); + +@implicit_conversion_expr = + @abi_safe_conversion_expr +| @any_hashable_erasure_expr +| @archetype_to_super_expr +| @array_to_pointer_expr +| @bridge_from_obj_c_expr +| @bridge_to_obj_c_expr +| @class_metatype_to_object_expr +| @collection_upcast_conversion_expr +| @conditional_bridge_from_obj_c_expr +| @covariant_function_conversion_expr +| @covariant_return_conversion_expr +| @derived_to_base_expr +| @destructure_tuple_expr +| @differentiable_function_expr +| @differentiable_function_extract_original_expr +| @erasure_expr +| @existential_metatype_to_object_expr +| @foreign_object_conversion_expr +| @function_conversion_expr +| @in_out_to_pointer_expr +| @inject_into_optional_expr +| @linear_function_expr +| @linear_function_extract_original_expr +| @linear_to_differentiable_function_expr +| @load_expr +| @metatype_conversion_expr +| @pointer_to_pointer_expr +| @protocol_metatype_to_object_expr +| @string_to_pointer_expr +| @underlying_to_opaque_expr +| @unevaluated_instance_expr +| @unresolved_type_conversion_expr +; + +#keyset[id] +implicit_conversion_exprs( //dir=expr + int id: @implicit_conversion_expr ref, + int sub_expr: @expr_or_none ref +); + +in_out_exprs( //dir=expr + unique int id: @in_out_expr, + int sub_expr: @expr_or_none ref +); + +key_path_application_exprs( //dir=expr + unique int id: @key_path_application_expr, + int base: @expr_or_none ref, + int key_path: @expr_or_none ref +); + +key_path_dot_exprs( //dir=expr + unique int id: @key_path_dot_expr +); + +key_path_exprs( //dir=expr + unique int id: @key_path_expr +); + +#keyset[id] +key_path_expr_roots( //dir=expr + int id: @key_path_expr ref, + int root: @type_repr_or_none ref +); + +#keyset[id, index] +key_path_expr_components( //dir=expr + int id: @key_path_expr ref, + int index: int ref, + int component: @key_path_component_or_none ref +); + +lazy_initialization_exprs( //dir=expr + unique int id: @lazy_initialization_expr, + int sub_expr: @expr_or_none ref +); + +@literal_expr = + @builtin_literal_expr +| @interpolated_string_literal_expr +| @nil_literal_expr +| @object_literal_expr +| @regex_literal_expr +; + +@lookup_expr = + @dynamic_lookup_expr +| @member_ref_expr +| @subscript_expr +; + +#keyset[id] +lookup_exprs( //dir=expr + int id: @lookup_expr ref, + int base: @expr_or_none ref +); + +#keyset[id] +lookup_expr_members( //dir=expr + int id: @lookup_expr ref, + int member: @decl_or_none ref +); + +make_temporarily_escapable_exprs( //dir=expr + unique int id: @make_temporarily_escapable_expr, + int escaping_closure: @opaque_value_expr_or_none ref, + int nonescaping_closure: @expr_or_none ref, + int sub_expr: @expr_or_none ref +); + +obj_c_selector_exprs( //dir=expr + unique int id: @obj_c_selector_expr, + int sub_expr: @expr_or_none ref, + int method: @function_or_none ref +); + +one_way_exprs( //dir=expr + unique int id: @one_way_expr, + int sub_expr: @expr_or_none ref +); + +opaque_value_exprs( //dir=expr + unique int id: @opaque_value_expr +); + +open_existential_exprs( //dir=expr + unique int id: @open_existential_expr, + int sub_expr: @expr_or_none ref, + int existential: @expr_or_none ref, + int opaque_expr: @opaque_value_expr_or_none ref +); + +optional_evaluation_exprs( //dir=expr + unique int id: @optional_evaluation_expr, + int sub_expr: @expr_or_none ref +); + +other_initializer_ref_exprs( //dir=expr + unique int id: @other_initializer_ref_expr, + int initializer: @initializer_or_none ref +); + +overloaded_decl_ref_exprs( //dir=expr + unique int id: @overloaded_decl_ref_expr +); + +#keyset[id, index] +overloaded_decl_ref_expr_possible_declarations( //dir=expr + int id: @overloaded_decl_ref_expr ref, + int index: int ref, + int possible_declaration: @value_decl_or_none ref +); + +property_wrapper_value_placeholder_exprs( //dir=expr + unique int id: @property_wrapper_value_placeholder_expr, + int placeholder: @opaque_value_expr_or_none ref +); + +#keyset[id] +property_wrapper_value_placeholder_expr_wrapped_values( //dir=expr + int id: @property_wrapper_value_placeholder_expr ref, + int wrapped_value: @expr_or_none ref +); + +rebind_self_in_initializer_exprs( //dir=expr + unique int id: @rebind_self_in_initializer_expr, + int sub_expr: @expr_or_none ref, + int self: @var_decl_or_none ref +); + +sequence_exprs( //dir=expr + unique int id: @sequence_expr +); + +#keyset[id, index] +sequence_expr_elements( //dir=expr + int id: @sequence_expr ref, + int index: int ref, + int element: @expr_or_none ref +); + +super_ref_exprs( //dir=expr + unique int id: @super_ref_expr, + int self: @var_decl_or_none ref +); + +tap_exprs( //dir=expr + unique int id: @tap_expr, + int body: @brace_stmt_or_none ref, + int var: @var_decl_or_none ref +); + +#keyset[id] +tap_expr_sub_exprs( //dir=expr + int id: @tap_expr ref, + int sub_expr: @expr_or_none ref +); + +tuple_element_exprs( //dir=expr + unique int id: @tuple_element_expr, + int sub_expr: @expr_or_none ref, + int index: int ref +); + +tuple_exprs( //dir=expr + unique int id: @tuple_expr +); + +#keyset[id, index] +tuple_expr_elements( //dir=expr + int id: @tuple_expr ref, + int index: int ref, + int element: @expr_or_none ref +); + +type_exprs( //dir=expr + unique int id: @type_expr +); + +#keyset[id] +type_expr_type_reprs( //dir=expr + int id: @type_expr ref, + int type_repr: @type_repr_or_none ref +); + +unresolved_decl_ref_exprs( //dir=expr + unique int id: @unresolved_decl_ref_expr +); + +#keyset[id] +unresolved_decl_ref_expr_names( //dir=expr + int id: @unresolved_decl_ref_expr ref, + string name: string ref +); + +unresolved_dot_exprs( //dir=expr + unique int id: @unresolved_dot_expr, + int base: @expr_or_none ref, + string name: string ref +); + +unresolved_member_exprs( //dir=expr + unique int id: @unresolved_member_expr, + string name: string ref +); + +unresolved_pattern_exprs( //dir=expr + unique int id: @unresolved_pattern_expr, + int sub_pattern: @pattern_or_none ref +); + +unresolved_specialize_exprs( //dir=expr + unique int id: @unresolved_specialize_expr, + int sub_expr: @expr_or_none ref +); + +vararg_expansion_exprs( //dir=expr + unique int id: @vararg_expansion_expr, + int sub_expr: @expr_or_none ref +); + +abi_safe_conversion_exprs( //dir=expr + unique int id: @abi_safe_conversion_expr +); + +any_hashable_erasure_exprs( //dir=expr + unique int id: @any_hashable_erasure_expr +); + +archetype_to_super_exprs( //dir=expr + unique int id: @archetype_to_super_expr +); + +array_exprs( //dir=expr + unique int id: @array_expr +); + +#keyset[id, index] +array_expr_elements( //dir=expr + int id: @array_expr ref, + int index: int ref, + int element: @expr_or_none ref +); + +array_to_pointer_exprs( //dir=expr + unique int id: @array_to_pointer_expr +); + +auto_closure_exprs( //dir=expr + unique int id: @auto_closure_expr +); + +await_exprs( //dir=expr + unique int id: @await_expr +); + +binary_exprs( //dir=expr + unique int id: @binary_expr +); + +bridge_from_obj_c_exprs( //dir=expr + unique int id: @bridge_from_obj_c_expr +); + +bridge_to_obj_c_exprs( //dir=expr + unique int id: @bridge_to_obj_c_expr +); + +@builtin_literal_expr = + @boolean_literal_expr +| @magic_identifier_literal_expr +| @number_literal_expr +| @string_literal_expr +; + +call_exprs( //dir=expr + unique int id: @call_expr +); + +@checked_cast_expr = + @conditional_checked_cast_expr +| @forced_checked_cast_expr +| @is_expr +; + +class_metatype_to_object_exprs( //dir=expr + unique int id: @class_metatype_to_object_expr +); + +coerce_exprs( //dir=expr + unique int id: @coerce_expr +); + +collection_upcast_conversion_exprs( //dir=expr + unique int id: @collection_upcast_conversion_expr +); + +conditional_bridge_from_obj_c_exprs( //dir=expr + unique int id: @conditional_bridge_from_obj_c_expr +); + +covariant_function_conversion_exprs( //dir=expr + unique int id: @covariant_function_conversion_expr +); + +covariant_return_conversion_exprs( //dir=expr + unique int id: @covariant_return_conversion_expr +); + +derived_to_base_exprs( //dir=expr + unique int id: @derived_to_base_expr +); + +destructure_tuple_exprs( //dir=expr + unique int id: @destructure_tuple_expr +); + +dictionary_exprs( //dir=expr + unique int id: @dictionary_expr +); + +#keyset[id, index] +dictionary_expr_elements( //dir=expr + int id: @dictionary_expr ref, + int index: int ref, + int element: @expr_or_none ref +); + +differentiable_function_exprs( //dir=expr + unique int id: @differentiable_function_expr +); + +differentiable_function_extract_original_exprs( //dir=expr + unique int id: @differentiable_function_extract_original_expr +); + +dot_self_exprs( //dir=expr + unique int id: @dot_self_expr +); + +@dynamic_lookup_expr = + @dynamic_member_ref_expr +| @dynamic_subscript_expr +; + +erasure_exprs( //dir=expr + unique int id: @erasure_expr +); + +existential_metatype_to_object_exprs( //dir=expr + unique int id: @existential_metatype_to_object_expr +); + +explicit_closure_exprs( //dir=expr + unique int id: @explicit_closure_expr +); + +force_try_exprs( //dir=expr + unique int id: @force_try_expr +); + +foreign_object_conversion_exprs( //dir=expr + unique int id: @foreign_object_conversion_expr +); + +function_conversion_exprs( //dir=expr + unique int id: @function_conversion_expr +); + +in_out_to_pointer_exprs( //dir=expr + unique int id: @in_out_to_pointer_expr +); + +inject_into_optional_exprs( //dir=expr + unique int id: @inject_into_optional_expr +); + +interpolated_string_literal_exprs( //dir=expr + unique int id: @interpolated_string_literal_expr +); + +#keyset[id] +interpolated_string_literal_expr_interpolation_exprs( //dir=expr + int id: @interpolated_string_literal_expr ref, + int interpolation_expr: @opaque_value_expr_or_none ref +); + +#keyset[id] +interpolated_string_literal_expr_appending_exprs( //dir=expr + int id: @interpolated_string_literal_expr ref, + int appending_expr: @tap_expr_or_none ref +); + +linear_function_exprs( //dir=expr + unique int id: @linear_function_expr +); + +linear_function_extract_original_exprs( //dir=expr + unique int id: @linear_function_extract_original_expr +); + +linear_to_differentiable_function_exprs( //dir=expr + unique int id: @linear_to_differentiable_function_expr +); + +load_exprs( //dir=expr + unique int id: @load_expr +); + +member_ref_exprs( //dir=expr + unique int id: @member_ref_expr +); + +#keyset[id] +member_ref_expr_has_direct_to_storage_semantics( //dir=expr + int id: @member_ref_expr ref +); + +#keyset[id] +member_ref_expr_has_direct_to_implementation_semantics( //dir=expr + int id: @member_ref_expr ref +); + +#keyset[id] +member_ref_expr_has_ordinary_semantics( //dir=expr + int id: @member_ref_expr ref +); + +#keyset[id] +member_ref_expr_has_distributed_thunk_semantics( //dir=expr + int id: @member_ref_expr ref +); + +metatype_conversion_exprs( //dir=expr + unique int id: @metatype_conversion_expr +); + +nil_literal_exprs( //dir=expr + unique int id: @nil_literal_expr +); + +object_literal_exprs( //dir=expr + unique int id: @object_literal_expr, + int kind: int ref +); + +#keyset[id, index] +object_literal_expr_arguments( //dir=expr + int id: @object_literal_expr ref, + int index: int ref, + int argument: @argument_or_none ref +); + +optional_try_exprs( //dir=expr + unique int id: @optional_try_expr +); + +paren_exprs( //dir=expr + unique int id: @paren_expr +); + +pointer_to_pointer_exprs( //dir=expr + unique int id: @pointer_to_pointer_expr +); + +postfix_unary_exprs( //dir=expr + unique int id: @postfix_unary_expr +); + +prefix_unary_exprs( //dir=expr + unique int id: @prefix_unary_expr +); + +protocol_metatype_to_object_exprs( //dir=expr + unique int id: @protocol_metatype_to_object_expr +); + +regex_literal_exprs( //dir=expr + unique int id: @regex_literal_expr, + string pattern: string ref, + int version: int ref +); + +@self_apply_expr = + @dot_syntax_call_expr +| @initializer_ref_call_expr +; + +#keyset[id] +self_apply_exprs( //dir=expr + int id: @self_apply_expr ref, + int base: @expr_or_none ref +); + +string_to_pointer_exprs( //dir=expr + unique int id: @string_to_pointer_expr +); + +subscript_exprs( //dir=expr + unique int id: @subscript_expr +); + +#keyset[id, index] +subscript_expr_arguments( //dir=expr + int id: @subscript_expr ref, + int index: int ref, + int argument: @argument_or_none ref +); + +#keyset[id] +subscript_expr_has_direct_to_storage_semantics( //dir=expr + int id: @subscript_expr ref +); + +#keyset[id] +subscript_expr_has_direct_to_implementation_semantics( //dir=expr + int id: @subscript_expr ref +); + +#keyset[id] +subscript_expr_has_ordinary_semantics( //dir=expr + int id: @subscript_expr ref +); + +#keyset[id] +subscript_expr_has_distributed_thunk_semantics( //dir=expr + int id: @subscript_expr ref +); + +try_exprs( //dir=expr + unique int id: @try_expr +); + +underlying_to_opaque_exprs( //dir=expr + unique int id: @underlying_to_opaque_expr +); + +unevaluated_instance_exprs( //dir=expr + unique int id: @unevaluated_instance_expr +); + +unresolved_member_chain_result_exprs( //dir=expr + unique int id: @unresolved_member_chain_result_expr +); + +unresolved_type_conversion_exprs( //dir=expr + unique int id: @unresolved_type_conversion_expr +); + +boolean_literal_exprs( //dir=expr + unique int id: @boolean_literal_expr, + boolean value: boolean ref +); + +conditional_checked_cast_exprs( //dir=expr + unique int id: @conditional_checked_cast_expr +); + +dot_syntax_call_exprs( //dir=expr + unique int id: @dot_syntax_call_expr +); + +dynamic_member_ref_exprs( //dir=expr + unique int id: @dynamic_member_ref_expr +); + +dynamic_subscript_exprs( //dir=expr + unique int id: @dynamic_subscript_expr +); + +forced_checked_cast_exprs( //dir=expr + unique int id: @forced_checked_cast_expr +); + +initializer_ref_call_exprs( //dir=expr + unique int id: @initializer_ref_call_expr +); + +is_exprs( //dir=expr + unique int id: @is_expr +); + +magic_identifier_literal_exprs( //dir=expr + unique int id: @magic_identifier_literal_expr, + string kind: string ref +); + +@number_literal_expr = + @float_literal_expr +| @integer_literal_expr +; + +string_literal_exprs( //dir=expr + unique int id: @string_literal_expr, + string value: string ref +); + +float_literal_exprs( //dir=expr + unique int id: @float_literal_expr, + string string_value: string ref +); + +integer_literal_exprs( //dir=expr + unique int id: @integer_literal_expr, + string string_value: string ref +); + +@pattern = + @any_pattern +| @binding_pattern +| @bool_pattern +| @enum_element_pattern +| @expr_pattern +| @is_pattern +| @named_pattern +| @optional_some_pattern +| @paren_pattern +| @tuple_pattern +| @typed_pattern +; + +any_patterns( //dir=pattern + unique int id: @any_pattern +); + +binding_patterns( //dir=pattern + unique int id: @binding_pattern, + int sub_pattern: @pattern_or_none ref +); + +bool_patterns( //dir=pattern + unique int id: @bool_pattern, + boolean value: boolean ref +); + +enum_element_patterns( //dir=pattern + unique int id: @enum_element_pattern, + int element: @enum_element_decl_or_none ref +); + +#keyset[id] +enum_element_pattern_sub_patterns( //dir=pattern + int id: @enum_element_pattern ref, + int sub_pattern: @pattern_or_none ref +); + +expr_patterns( //dir=pattern + unique int id: @expr_pattern, + int sub_expr: @expr_or_none ref +); + +is_patterns( //dir=pattern + unique int id: @is_pattern +); + +#keyset[id] +is_pattern_cast_type_reprs( //dir=pattern + int id: @is_pattern ref, + int cast_type_repr: @type_repr_or_none ref +); + +#keyset[id] +is_pattern_sub_patterns( //dir=pattern + int id: @is_pattern ref, + int sub_pattern: @pattern_or_none ref +); + +named_patterns( //dir=pattern + unique int id: @named_pattern, + int var_decl: @var_decl_or_none ref +); + +optional_some_patterns( //dir=pattern + unique int id: @optional_some_pattern, + int sub_pattern: @pattern_or_none ref +); + +paren_patterns( //dir=pattern + unique int id: @paren_pattern, + int sub_pattern: @pattern_or_none ref +); + +tuple_patterns( //dir=pattern + unique int id: @tuple_pattern +); + +#keyset[id, index] +tuple_pattern_elements( //dir=pattern + int id: @tuple_pattern ref, + int index: int ref, + int element: @pattern_or_none ref +); + +typed_patterns( //dir=pattern + unique int id: @typed_pattern, + int sub_pattern: @pattern_or_none ref +); + +#keyset[id] +typed_pattern_type_reprs( //dir=pattern + int id: @typed_pattern ref, + int type_repr: @type_repr_or_none ref +); + +case_label_items( //dir=stmt + unique int id: @case_label_item, + int pattern: @pattern_or_none ref +); + +#keyset[id] +case_label_item_guards( //dir=stmt + int id: @case_label_item ref, + int guard: @expr_or_none ref +); + +condition_elements( //dir=stmt + unique int id: @condition_element +); + +#keyset[id] +condition_element_booleans( //dir=stmt + int id: @condition_element ref, + int boolean_: @expr_or_none ref +); + +#keyset[id] +condition_element_patterns( //dir=stmt + int id: @condition_element ref, + int pattern: @pattern_or_none ref +); + +#keyset[id] +condition_element_initializers( //dir=stmt + int id: @condition_element ref, + int initializer: @expr_or_none ref +); + +#keyset[id] +condition_element_availabilities( //dir=stmt + int id: @condition_element ref, + int availability: @availability_info_or_none ref +); + +@stmt = + @brace_stmt +| @break_stmt +| @case_stmt +| @continue_stmt +| @defer_stmt +| @fail_stmt +| @fallthrough_stmt +| @labeled_stmt +| @pound_assert_stmt +| @return_stmt +| @throw_stmt +| @yield_stmt +; + +stmt_conditions( //dir=stmt + unique int id: @stmt_condition +); + +#keyset[id, index] +stmt_condition_elements( //dir=stmt + int id: @stmt_condition ref, + int index: int ref, + int element: @condition_element_or_none ref +); + +brace_stmts( //dir=stmt + unique int id: @brace_stmt +); + +#keyset[id, index] +brace_stmt_elements( //dir=stmt + int id: @brace_stmt ref, + int index: int ref, + int element: @ast_node_or_none ref +); + +break_stmts( //dir=stmt + unique int id: @break_stmt +); + +#keyset[id] +break_stmt_target_names( //dir=stmt + int id: @break_stmt ref, + string target_name: string ref +); + +#keyset[id] +break_stmt_targets( //dir=stmt + int id: @break_stmt ref, + int target: @stmt_or_none ref +); + +case_stmts( //dir=stmt + unique int id: @case_stmt, + int body: @stmt_or_none ref +); + +#keyset[id, index] +case_stmt_labels( //dir=stmt + int id: @case_stmt ref, + int index: int ref, + int label: @case_label_item_or_none ref +); + +#keyset[id, index] +case_stmt_variables( //dir=stmt + int id: @case_stmt ref, + int index: int ref, + int variable: @var_decl_or_none ref +); + +continue_stmts( //dir=stmt + unique int id: @continue_stmt +); + +#keyset[id] +continue_stmt_target_names( //dir=stmt + int id: @continue_stmt ref, + string target_name: string ref +); + +#keyset[id] +continue_stmt_targets( //dir=stmt + int id: @continue_stmt ref, + int target: @stmt_or_none ref +); + +defer_stmts( //dir=stmt + unique int id: @defer_stmt, + int body: @brace_stmt_or_none ref +); + +fail_stmts( //dir=stmt + unique int id: @fail_stmt +); + +fallthrough_stmts( //dir=stmt + unique int id: @fallthrough_stmt, + int fallthrough_source: @case_stmt_or_none ref, + int fallthrough_dest: @case_stmt_or_none ref +); + +@labeled_stmt = + @do_catch_stmt +| @do_stmt +| @for_each_stmt +| @labeled_conditional_stmt +| @repeat_while_stmt +| @switch_stmt +; + +#keyset[id] +labeled_stmt_labels( //dir=stmt + int id: @labeled_stmt ref, + string label: string ref +); + +pound_assert_stmts( //dir=stmt + unique int id: @pound_assert_stmt, + int condition: @expr_or_none ref, + string message: string ref +); + +return_stmts( //dir=stmt + unique int id: @return_stmt +); + +#keyset[id] +return_stmt_results( //dir=stmt + int id: @return_stmt ref, + int result: @expr_or_none ref +); + +throw_stmts( //dir=stmt + unique int id: @throw_stmt, + int sub_expr: @expr_or_none ref +); + +yield_stmts( //dir=stmt + unique int id: @yield_stmt +); + +#keyset[id, index] +yield_stmt_results( //dir=stmt + int id: @yield_stmt ref, + int index: int ref, + int result: @expr_or_none ref +); + +do_catch_stmts( //dir=stmt + unique int id: @do_catch_stmt, + int body: @stmt_or_none ref +); + +#keyset[id, index] +do_catch_stmt_catches( //dir=stmt + int id: @do_catch_stmt ref, + int index: int ref, + int catch: @case_stmt_or_none ref +); + +do_stmts( //dir=stmt + unique int id: @do_stmt, + int body: @brace_stmt_or_none ref +); + +for_each_stmts( //dir=stmt + unique int id: @for_each_stmt, + int pattern: @pattern_or_none ref, + int body: @brace_stmt_or_none ref +); + +#keyset[id] +for_each_stmt_wheres( //dir=stmt + int id: @for_each_stmt ref, + int where: @expr_or_none ref +); + +#keyset[id] +for_each_stmt_iterator_vars( //dir=stmt + int id: @for_each_stmt ref, + int iteratorVar: @pattern_binding_decl_or_none ref +); + +#keyset[id] +for_each_stmt_next_calls( //dir=stmt + int id: @for_each_stmt ref, + int nextCall: @expr_or_none ref +); + +@labeled_conditional_stmt = + @guard_stmt +| @if_stmt +| @while_stmt +; + +#keyset[id] +labeled_conditional_stmts( //dir=stmt + int id: @labeled_conditional_stmt ref, + int condition: @stmt_condition_or_none ref +); + +repeat_while_stmts( //dir=stmt + unique int id: @repeat_while_stmt, + int condition: @expr_or_none ref, + int body: @stmt_or_none ref +); + +switch_stmts( //dir=stmt + unique int id: @switch_stmt, + int expr: @expr_or_none ref +); + +#keyset[id, index] +switch_stmt_cases( //dir=stmt + int id: @switch_stmt ref, + int index: int ref, + int case_: @case_stmt_or_none ref +); + +guard_stmts( //dir=stmt + unique int id: @guard_stmt, + int body: @brace_stmt_or_none ref +); + +if_stmts( //dir=stmt + unique int id: @if_stmt, + int then: @stmt_or_none ref +); + +#keyset[id] +if_stmt_elses( //dir=stmt + int id: @if_stmt ref, + int else: @stmt_or_none ref +); + +while_stmts( //dir=stmt + unique int id: @while_stmt, + int body: @stmt_or_none ref +); + +@type = + @any_function_type +| @any_generic_type +| @any_metatype_type +| @builtin_type +| @dependent_member_type +| @dynamic_self_type +| @error_type +| @existential_type +| @in_out_type +| @l_value_type +| @module_type +| @parameterized_protocol_type +| @protocol_composition_type +| @reference_storage_type +| @substitutable_type +| @sugar_type +| @tuple_type +| @unresolved_type +; + +#keyset[id] +types( //dir=type + int id: @type ref, + string name: string ref, + int canonical_type: @type_or_none ref +); + +type_reprs( //dir=type + unique int id: @type_repr, + int type_: @type_or_none ref +); + +@any_function_type = + @function_type +| @generic_function_type +; + +#keyset[id] +any_function_types( //dir=type + int id: @any_function_type ref, + int result: @type_or_none ref +); + +#keyset[id, index] +any_function_type_param_types( //dir=type + int id: @any_function_type ref, + int index: int ref, + int param_type: @type_or_none ref +); + +#keyset[id] +any_function_type_is_throwing( //dir=type + int id: @any_function_type ref +); + +#keyset[id] +any_function_type_is_async( //dir=type + int id: @any_function_type ref +); + +@any_generic_type = + @nominal_or_bound_generic_nominal_type +| @unbound_generic_type +; + +#keyset[id] +any_generic_types( //dir=type + int id: @any_generic_type ref, + int declaration: @generic_type_decl_or_none ref +); + +#keyset[id] +any_generic_type_parents( //dir=type + int id: @any_generic_type ref, + int parent: @type_or_none ref +); + +@any_metatype_type = + @existential_metatype_type +| @metatype_type +; + +@builtin_type = + @any_builtin_integer_type +| @builtin_bridge_object_type +| @builtin_default_actor_storage_type +| @builtin_executor_type +| @builtin_float_type +| @builtin_job_type +| @builtin_native_object_type +| @builtin_raw_pointer_type +| @builtin_raw_unsafe_continuation_type +| @builtin_unsafe_value_buffer_type +| @builtin_vector_type +; + +dependent_member_types( //dir=type + unique int id: @dependent_member_type, + int base_type: @type_or_none ref, + int associated_type_decl: @associated_type_decl_or_none ref +); + +dynamic_self_types( //dir=type + unique int id: @dynamic_self_type, + int static_self_type: @type_or_none ref +); + +error_types( //dir=type + unique int id: @error_type +); + +existential_types( //dir=type + unique int id: @existential_type, + int constraint: @type_or_none ref +); + +in_out_types( //dir=type + unique int id: @in_out_type, + int object_type: @type_or_none ref +); + +l_value_types( //dir=type + unique int id: @l_value_type, + int object_type: @type_or_none ref +); + +module_types( //dir=type + unique int id: @module_type, + int module: @module_decl_or_none ref +); + +parameterized_protocol_types( //dir=type + unique int id: @parameterized_protocol_type, + int base: @protocol_type_or_none ref +); + +#keyset[id, index] +parameterized_protocol_type_args( //dir=type + int id: @parameterized_protocol_type ref, + int index: int ref, + int arg: @type_or_none ref +); + +protocol_composition_types( //dir=type + unique int id: @protocol_composition_type +); + +#keyset[id, index] +protocol_composition_type_members( //dir=type + int id: @protocol_composition_type ref, + int index: int ref, + int member: @type_or_none ref +); + +@reference_storage_type = + @unmanaged_storage_type +| @unowned_storage_type +| @weak_storage_type +; + +#keyset[id] +reference_storage_types( //dir=type + int id: @reference_storage_type ref, + int referent_type: @type_or_none ref +); + +@substitutable_type = + @archetype_type +| @generic_type_param_type +; + +@sugar_type = + @paren_type +| @syntax_sugar_type +| @type_alias_type +; + +tuple_types( //dir=type + unique int id: @tuple_type +); + +#keyset[id, index] +tuple_type_types( //dir=type + int id: @tuple_type ref, + int index: int ref, + int type_: @type_or_none ref +); + +#keyset[id, index] +tuple_type_names( //dir=type + int id: @tuple_type ref, + int index: int ref, + string name: string ref +); + +unresolved_types( //dir=type + unique int id: @unresolved_type +); + +@any_builtin_integer_type = + @builtin_integer_literal_type +| @builtin_integer_type +; + +@archetype_type = + @opaque_type_archetype_type +| @opened_archetype_type +| @primary_archetype_type +; + +#keyset[id] +archetype_types( //dir=type + int id: @archetype_type ref, + int interface_type: @type_or_none ref +); + +#keyset[id] +archetype_type_superclasses( //dir=type + int id: @archetype_type ref, + int superclass: @type_or_none ref +); + +#keyset[id, index] +archetype_type_protocols( //dir=type + int id: @archetype_type ref, + int index: int ref, + int protocol: @protocol_decl_or_none ref +); + +builtin_bridge_object_types( //dir=type + unique int id: @builtin_bridge_object_type +); + +builtin_default_actor_storage_types( //dir=type + unique int id: @builtin_default_actor_storage_type +); + +builtin_executor_types( //dir=type + unique int id: @builtin_executor_type +); + +builtin_float_types( //dir=type + unique int id: @builtin_float_type +); + +builtin_job_types( //dir=type + unique int id: @builtin_job_type +); + +builtin_native_object_types( //dir=type + unique int id: @builtin_native_object_type +); + +builtin_raw_pointer_types( //dir=type + unique int id: @builtin_raw_pointer_type +); + +builtin_raw_unsafe_continuation_types( //dir=type + unique int id: @builtin_raw_unsafe_continuation_type +); + +builtin_unsafe_value_buffer_types( //dir=type + unique int id: @builtin_unsafe_value_buffer_type +); + +builtin_vector_types( //dir=type + unique int id: @builtin_vector_type +); + +existential_metatype_types( //dir=type + unique int id: @existential_metatype_type +); + +function_types( //dir=type + unique int id: @function_type +); + +generic_function_types( //dir=type + unique int id: @generic_function_type +); + +#keyset[id, index] +generic_function_type_generic_params( //dir=type + int id: @generic_function_type ref, + int index: int ref, + int generic_param: @generic_type_param_type_or_none ref +); + +generic_type_param_types( //dir=type + unique int id: @generic_type_param_type +); + +metatype_types( //dir=type + unique int id: @metatype_type +); + +@nominal_or_bound_generic_nominal_type = + @bound_generic_type +| @nominal_type +; + +paren_types( //dir=type + unique int id: @paren_type, + int type_: @type_or_none ref +); + +@syntax_sugar_type = + @dictionary_type +| @unary_syntax_sugar_type +; + +type_alias_types( //dir=type + unique int id: @type_alias_type, + int decl: @type_alias_decl_or_none ref +); + +unbound_generic_types( //dir=type + unique int id: @unbound_generic_type +); + +unmanaged_storage_types( //dir=type + unique int id: @unmanaged_storage_type +); + +unowned_storage_types( //dir=type + unique int id: @unowned_storage_type +); + +weak_storage_types( //dir=type + unique int id: @weak_storage_type +); + +@bound_generic_type = + @bound_generic_class_type +| @bound_generic_enum_type +| @bound_generic_struct_type +; + +#keyset[id, index] +bound_generic_type_arg_types( //dir=type + int id: @bound_generic_type ref, + int index: int ref, + int arg_type: @type_or_none ref +); + +builtin_integer_literal_types( //dir=type + unique int id: @builtin_integer_literal_type +); + +builtin_integer_types( //dir=type + unique int id: @builtin_integer_type +); + +#keyset[id] +builtin_integer_type_widths( //dir=type + int id: @builtin_integer_type ref, + int width: int ref +); + +dictionary_types( //dir=type + unique int id: @dictionary_type, + int key_type: @type_or_none ref, + int value_type: @type_or_none ref +); + +@nominal_type = + @class_type +| @enum_type +| @protocol_type +| @struct_type +; + +opaque_type_archetype_types( //dir=type + unique int id: @opaque_type_archetype_type, + int declaration: @opaque_type_decl_or_none ref +); + +opened_archetype_types( //dir=type + unique int id: @opened_archetype_type +); + +primary_archetype_types( //dir=type + unique int id: @primary_archetype_type +); + +@unary_syntax_sugar_type = + @array_slice_type +| @optional_type +| @variadic_sequence_type +; + +#keyset[id] +unary_syntax_sugar_types( //dir=type + int id: @unary_syntax_sugar_type ref, + int base_type: @type_or_none ref +); + +array_slice_types( //dir=type + unique int id: @array_slice_type +); + +bound_generic_class_types( //dir=type + unique int id: @bound_generic_class_type +); + +bound_generic_enum_types( //dir=type + unique int id: @bound_generic_enum_type +); + +bound_generic_struct_types( //dir=type + unique int id: @bound_generic_struct_type +); + +class_types( //dir=type + unique int id: @class_type +); + +enum_types( //dir=type + unique int id: @enum_type +); + +optional_types( //dir=type + unique int id: @optional_type +); + +protocol_types( //dir=type + unique int id: @protocol_type +); + +struct_types( //dir=type + unique int id: @struct_type +); + +variadic_sequence_types( //dir=type + unique int id: @variadic_sequence_type +); + +@accessor_or_none = + @accessor +| @unspecified_element +; + +@argument_or_none = + @argument +| @unspecified_element +; + +@associated_type_decl_or_none = + @associated_type_decl +| @unspecified_element +; + +@ast_node_or_none = + @ast_node +| @unspecified_element +; + +@availability_info_or_none = + @availability_info +| @unspecified_element +; + +@availability_spec_or_none = + @availability_spec +| @unspecified_element +; + +@brace_stmt_or_none = + @brace_stmt +| @unspecified_element +; + +@captured_decl_or_none = + @captured_decl +| @unspecified_element +; + +@case_label_item_or_none = + @case_label_item +| @unspecified_element +; + +@case_stmt_or_none = + @case_stmt +| @unspecified_element +; + +@closure_expr_or_none = + @closure_expr +| @unspecified_element +; + +@condition_element_or_none = + @condition_element +| @unspecified_element +; + +@decl_or_none = + @decl +| @unspecified_element +; + +@enum_element_decl_or_none = + @enum_element_decl +| @unspecified_element +; + +@expr_or_none = + @expr +| @unspecified_element +; + +@file_or_none = + @file +| @unspecified_element +; + +@function_or_none = + @function +| @unspecified_element +; + +@generic_type_decl_or_none = + @generic_type_decl +| @unspecified_element +; + +@generic_type_param_decl_or_none = + @generic_type_param_decl +| @unspecified_element +; + +@generic_type_param_type_or_none = + @generic_type_param_type +| @unspecified_element +; + +@initializer_or_none = + @initializer +| @unspecified_element +; + +@key_path_component_or_none = + @key_path_component +| @unspecified_element +; + +@location_or_none = + @location +| @unspecified_element +; + +@module_decl_or_none = + @module_decl +| @unspecified_element +; + +@nominal_type_decl_or_none = + @nominal_type_decl +| @unspecified_element +; + +@opaque_type_decl_or_none = + @opaque_type_decl +| @unspecified_element +; + +@opaque_value_expr_or_none = + @opaque_value_expr +| @unspecified_element +; + +@param_decl_or_none = + @param_decl +| @unspecified_element +; + +@pattern_or_none = + @pattern +| @unspecified_element +; + +@pattern_binding_decl_or_none = + @pattern_binding_decl +| @unspecified_element +; + +@precedence_group_decl_or_none = + @precedence_group_decl +| @unspecified_element +; + +@protocol_decl_or_none = + @protocol_decl +| @unspecified_element +; + +@protocol_type_or_none = + @protocol_type +| @unspecified_element +; + +@stmt_or_none = + @stmt +| @unspecified_element +; + +@stmt_condition_or_none = + @stmt_condition +| @unspecified_element +; + +@string_literal_expr_or_none = + @string_literal_expr +| @unspecified_element +; + +@tap_expr_or_none = + @tap_expr +| @unspecified_element +; + +@type_or_none = + @type +| @unspecified_element +; + +@type_alias_decl_or_none = + @type_alias_decl +| @unspecified_element +; + +@type_repr_or_none = + @type_repr +| @unspecified_element +; + +@value_decl_or_none = + @unspecified_element +| @value_decl +; + +@var_decl_or_none = + @unspecified_element +| @var_decl +; diff --git a/swift/ql/lib/upgrades/e69de29bb2d1d6434b8b29ae775ad8c2e48c5391/upgrade.properties b/swift/ql/lib/upgrades/e69de29bb2d1d6434b8b29ae775ad8c2e48c5391/upgrade.properties new file mode 100644 index 000000000000..19a3fbf5a0b6 --- /dev/null +++ b/swift/ql/lib/upgrades/e69de29bb2d1d6434b8b29ae775ad8c2e48c5391/upgrade.properties @@ -0,0 +1,2 @@ +description: update named_patterns table +compatibility: partial From 28eb2caacbf5a92476c93489834b503cfeb7c6b4 Mon Sep 17 00:00:00 2001 From: Mathias Vorreiter Pedersen Date: Fri, 27 Oct 2023 16:30:01 +0100 Subject: [PATCH 7/7] Swift: Accept test changes. --- .../test/library-tests/ast/PrintAst.expected | 56 ------------------- 1 file changed, 56 deletions(-) diff --git a/swift/ql/test/library-tests/ast/PrintAst.expected b/swift/ql/test/library-tests/ast/PrintAst.expected index c9287292b362..3bc839eccb80 100644 --- a/swift/ql/test/library-tests/ast/PrintAst.expected +++ b/swift/ql/test/library-tests/ast/PrintAst.expected @@ -246,10 +246,6 @@ cfg.swift: # 40| getExpr(): [DefaultArgumentExpr] default terminator # 42| getElement(1): [ReturnStmt] return ... # 42| getResult(): [IntegerLiteralExpr] 0 -# 35| [ConcreteVarDecl] withParam -# 35| Type = Int -# 39| [ConcreteVarDecl] error -# 39| Type = Error # 45| [NamedFunction] createClosure1(s:) # 45| InterfaceType = (String) -> () -> String # 45| getParam(0): [ParamDecl] s @@ -5983,10 +5979,6 @@ patterns.swift: # 50| getElement(0): [StringLiteralExpr] false # 16| [ConcreteVarDecl] $match # 16| Type = Int -# 28| [ConcreteVarDecl] i -# 28| Type = Int -# 34| [ConcreteVarDecl] n -# 34| Type = Int # 54| [NamedFunction] bound_and_unbound() # 54| InterfaceType = () -> () # 54| getBody(): [BraceStmt] { ... } @@ -6651,62 +6643,24 @@ patterns.swift: # 180| getPattern(): [AnyPattern] _ # 181| getBody(): [BraceStmt] { ... } # 181| getElement(0): [TupleExpr] (...) -# 83| [ConcreteVarDecl] a -# 83| Type = (Int) -# 85| [ConcreteVarDecl] a -# 85| Type = Int -# 85| [ConcreteVarDecl] b -# 85| Type = Int -# 88| [ConcreteVarDecl] a -# 88| Type = Int # 92| [ConcreteVarDecl] x # 92| Type = (Int) # 95| [ConcreteVarDecl] x # 95| Type = Int # 95| [ConcreteVarDecl] y # 95| Type = Int -# 105| [ConcreteVarDecl] a -# 105| Type = (Int) -# 107| [ConcreteVarDecl] a -# 107| Type = Int -# 107| [ConcreteVarDecl] b -# 107| Type = Int -# 110| [ConcreteVarDecl] a -# 110| Type = Int # 114| [ConcreteVarDecl] x # 114| Type = (Int) # 117| [ConcreteVarDecl] x # 117| Type = Int # 117| [ConcreteVarDecl] y # 117| Type = Int -# 127| [ConcreteVarDecl] a -# 127| Type = (Int) -# 129| [ConcreteVarDecl] a -# 129| Type = Int -# 129| [ConcreteVarDecl] b -# 129| Type = Int -# 132| [ConcreteVarDecl] a -# 132| Type = Int # 136| [ConcreteVarDecl] x # 136| Type = (Int) # 139| [ConcreteVarDecl] x # 139| Type = Int # 139| [ConcreteVarDecl] y # 139| Type = Int -# 149| [ConcreteVarDecl] a -# 149| Type = (Int) -# 151| [ConcreteVarDecl] a -# 151| Type = Int -# 151| [ConcreteVarDecl] b -# 151| Type = Int -# 154| [ConcreteVarDecl] a -# 154| Type = Int -# 154| [ConcreteVarDecl] b -# 154| Type = Int -# 154| [ConcreteVarDecl] c -# 154| Type = Int -# 158| [ConcreteVarDecl] a -# 158| Type = Int # 162| [ConcreteVarDecl] x # 162| Type = (Int) # 165| [ConcreteVarDecl] x @@ -6715,16 +6669,6 @@ patterns.swift: # 165| Type = Int # 169| [ConcreteVarDecl] c # 169| Type = Int -# 174| [ConcreteVarDecl] a -# 174| Type = Int -# 174| [ConcreteVarDecl] b -# 174| Type = Int -# 174| [ConcreteVarDecl] c -# 174| Type = Int -# 174| [ConcreteVarDecl] d -# 174| Type = Int -# 174| [ConcreteVarDecl] e -# 174| Type = Int statements.swift: # 1| [NamedFunction] loop() # 1| InterfaceType = () -> ()