From 35e949945dc213680cf3488b61b529c4ad501478 Mon Sep 17 00:00:00 2001 From: Alex Denisov Date: Tue, 5 Sep 2023 12:05:27 +0200 Subject: [PATCH] Swift: add queries for unresolved AST nodes --- swift/ql/consistency-queries/UnresolvedAstNodes.ql | 5 +++++ .../ql/src/diagnostics/internal/UnresolvedAstNodes.ql | 11 +++++++++++ .../errors/CONSISTENCY/UnresolvedAstNodes.expected | 2 ++ 3 files changed, 18 insertions(+) create mode 100644 swift/ql/consistency-queries/UnresolvedAstNodes.ql create mode 100644 swift/ql/src/diagnostics/internal/UnresolvedAstNodes.ql create mode 100644 swift/ql/test/extractor-tests/errors/CONSISTENCY/UnresolvedAstNodes.expected diff --git a/swift/ql/consistency-queries/UnresolvedAstNodes.ql b/swift/ql/consistency-queries/UnresolvedAstNodes.ql new file mode 100644 index 000000000000..d2369ab94366 --- /dev/null +++ b/swift/ql/consistency-queries/UnresolvedAstNodes.ql @@ -0,0 +1,5 @@ +import swift + +from AstNode n +where n.getAPrimaryQlClass().matches("Unresolved%") +select n diff --git a/swift/ql/src/diagnostics/internal/UnresolvedAstNodes.ql b/swift/ql/src/diagnostics/internal/UnresolvedAstNodes.ql new file mode 100644 index 000000000000..97c14eb4ca76 --- /dev/null +++ b/swift/ql/src/diagnostics/internal/UnresolvedAstNodes.ql @@ -0,0 +1,11 @@ +/** + * @name Number of unresolved AST nodes + * @description Count all unresolved AST nodes. + * @kind metric + * @id swift/diagnostics/unresolved-ast-nodes + * @tags summary + */ + +import swift + +select count(AstNode n | n.getAPrimaryQlClass().matches("Unresolved%") | n) diff --git a/swift/ql/test/extractor-tests/errors/CONSISTENCY/UnresolvedAstNodes.expected b/swift/ql/test/extractor-tests/errors/CONSISTENCY/UnresolvedAstNodes.expected new file mode 100644 index 000000000000..c88a81e5fc79 --- /dev/null +++ b/swift/ql/test/extractor-tests/errors/CONSISTENCY/UnresolvedAstNodes.expected @@ -0,0 +1,2 @@ +| file://:0:0:0:0 | ... .combine(_:) | +| unresolved.swift:5:1:5:14 | UnresolvedSpecializeExpr |