mirror of
https://github.com/github/codeql.git
synced 2026-05-24 08:07:07 +02:00
Merge branch 'main' into extsensitive
This commit is contained in:
@@ -9,8 +9,8 @@ toolchain go1.26.0
|
||||
// when adding or removing dependencies, run
|
||||
// bazel mod tidy
|
||||
require (
|
||||
golang.org/x/mod v0.35.0
|
||||
golang.org/x/tools v0.44.0
|
||||
golang.org/x/mod v0.36.0
|
||||
golang.org/x/tools v0.45.0
|
||||
)
|
||||
|
||||
require github.com/stretchr/testify v1.11.1
|
||||
|
||||
@@ -6,12 +6,12 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
|
||||
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
|
||||
golang.org/x/mod v0.35.0 h1:Ww1D637e6Pg+Zb2KrWfHQUnH2dQRLBQyAtpr/haaJeM=
|
||||
golang.org/x/mod v0.35.0/go.mod h1:+GwiRhIInF8wPm+4AoT6L0FA1QWAad3OMdTRx4tFYlU=
|
||||
golang.org/x/mod v0.36.0 h1:JJjpVx6myfUsUdAzZuOSTTmRE0PfZeNWzzvKrP7amb4=
|
||||
golang.org/x/mod v0.36.0/go.mod h1:moc6ELqsWcOw5Ef3xVprK5ul/MvtVvkIXLziUOICjUQ=
|
||||
golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4=
|
||||
golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
|
||||
golang.org/x/tools v0.44.0 h1:UP4ajHPIcuMjT1GqzDWRlalUEoY+uzoZKnhOjbIPD2c=
|
||||
golang.org/x/tools v0.44.0/go.mod h1:KA0AfVErSdxRZIsOVipbv3rQhVXTnlU6UhKxHd1seDI=
|
||||
golang.org/x/tools v0.45.0 h1:18qN3FAooORvApf5XjCXgsuayZOEtXf6JK18I3+ONa8=
|
||||
golang.org/x/tools v0.45.0/go.mod h1:LuUGqqaXcXMEFEruIVJVm5mgDD8vww/z/SR1gQ4uE/0=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
|
||||
@@ -34,44 +34,48 @@ pub const CHILD_FIELD: u16 = u16::MAX;
|
||||
#[derive(Debug)]
|
||||
pub struct AstCursor<'a> {
|
||||
ast: &'a Ast,
|
||||
/// A stack of parents, along with iterators for their children
|
||||
parents: Vec<(&'a Node, ChildrenIter<'a>)>,
|
||||
node: &'a Node,
|
||||
/// A stack of parents, along with iterators for their children.
|
||||
parents: Vec<(Id, ChildrenIter<'a>)>,
|
||||
node_id: Id,
|
||||
}
|
||||
|
||||
impl<'a> AstCursor<'a> {
|
||||
pub fn new(ast: &'a Ast) -> Self {
|
||||
// TODO: handle non-zero root
|
||||
let node = ast.get_node(ast.root).unwrap();
|
||||
Self {
|
||||
ast,
|
||||
parents: vec![],
|
||||
node,
|
||||
node_id: ast.root,
|
||||
}
|
||||
}
|
||||
|
||||
/// The Id of the node currently under the cursor.
|
||||
pub fn node_id(&self) -> Id {
|
||||
self.node_id
|
||||
}
|
||||
|
||||
fn goto_next_sibling_opt(&mut self) -> Option<()> {
|
||||
self.node = self.parents.last_mut()?.1.next()?;
|
||||
self.node_id = self.parents.last_mut()?.1.next()?;
|
||||
Some(())
|
||||
}
|
||||
|
||||
fn goto_first_child_opt(&mut self) -> Option<()> {
|
||||
let parent = self.node;
|
||||
let mut children = ChildrenIter::new(self.ast, parent);
|
||||
let parent_id = self.node_id;
|
||||
let parent = self.ast.get_node(parent_id)?;
|
||||
let mut children = ChildrenIter::new(parent);
|
||||
let first_child = children.next()?;
|
||||
self.node = first_child;
|
||||
self.parents.push((parent, children));
|
||||
self.node_id = first_child;
|
||||
self.parents.push((parent_id, children));
|
||||
Some(())
|
||||
}
|
||||
|
||||
fn goto_parent_opt(&mut self) -> Option<()> {
|
||||
self.node = self.parents.pop()?.0;
|
||||
self.node_id = self.parents.pop()?.0;
|
||||
Some(())
|
||||
}
|
||||
}
|
||||
impl<'a> Cursor<'a, Ast, Node, FieldId> for AstCursor<'a> {
|
||||
fn node(&self) -> &'a Node {
|
||||
self.node
|
||||
&self.ast.nodes[self.node_id]
|
||||
}
|
||||
|
||||
fn field_id(&self) -> Option<FieldId> {
|
||||
@@ -101,36 +105,30 @@ impl<'a> Cursor<'a, Ast, Node, FieldId> for AstCursor<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
/// An iterator over all the child nodes of a node.
|
||||
/// An iterator over the child Ids of a node.
|
||||
#[derive(Debug)]
|
||||
struct ChildrenIter<'a> {
|
||||
ast: &'a Ast,
|
||||
current_field: Option<FieldId>,
|
||||
fields: std::collections::btree_map::Iter<'a, FieldId, Vec<Id>>,
|
||||
field_children: Option<std::slice::Iter<'a, Id>>,
|
||||
}
|
||||
|
||||
impl<'a> ChildrenIter<'a> {
|
||||
fn new(ast: &'a Ast, node: &'a Node) -> Self {
|
||||
fn new(node: &'a Node) -> Self {
|
||||
Self {
|
||||
ast,
|
||||
current_field: None,
|
||||
fields: node.fields.iter(),
|
||||
field_children: None,
|
||||
}
|
||||
}
|
||||
|
||||
fn get_node(&self, id: Id) -> &'a Node {
|
||||
self.ast.get_node(id).unwrap()
|
||||
}
|
||||
|
||||
fn current_field(&self) -> Option<FieldId> {
|
||||
self.current_field
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Iterator for ChildrenIter<'a> {
|
||||
type Item = &'a Node;
|
||||
impl Iterator for ChildrenIter<'_> {
|
||||
type Item = Id;
|
||||
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
match self.field_children.as_mut() {
|
||||
@@ -151,7 +149,7 @@ impl<'a> Iterator for ChildrenIter<'a> {
|
||||
self.next()
|
||||
}
|
||||
},
|
||||
Some(child_id) => Some(self.get_node(*child_id)),
|
||||
Some(child_id) => Some(*child_id),
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -236,7 +234,6 @@ impl Ast {
|
||||
) -> Id {
|
||||
let id = self.nodes.len();
|
||||
self.nodes.push(Node {
|
||||
id,
|
||||
kind,
|
||||
kind_name: self.schema.node_kind_for_id(kind).unwrap(),
|
||||
fields,
|
||||
@@ -265,7 +262,6 @@ impl Ast {
|
||||
});
|
||||
let id = self.nodes.len();
|
||||
self.nodes.push(Node {
|
||||
id,
|
||||
kind: kind_id,
|
||||
kind_name: kind,
|
||||
is_named: true,
|
||||
@@ -345,7 +341,6 @@ impl Ast {
|
||||
/// A node in our AST
|
||||
#[derive(PartialEq, Eq, Debug, Clone, Serialize)]
|
||||
pub struct Node {
|
||||
id: Id,
|
||||
kind: KindId,
|
||||
kind_name: &'static str,
|
||||
pub(crate) fields: BTreeMap<FieldId, Vec<Id>>,
|
||||
@@ -361,10 +356,6 @@ pub struct Node {
|
||||
}
|
||||
|
||||
impl Node {
|
||||
pub fn id(&self) -> Id {
|
||||
self.id
|
||||
}
|
||||
|
||||
pub fn kind(&self) -> &'static str {
|
||||
self.kind_name
|
||||
}
|
||||
@@ -600,39 +591,41 @@ fn apply_rules_inner(
|
||||
}
|
||||
}
|
||||
|
||||
// Collect fields before recursing (avoids borrowing ast immutably during mutation)
|
||||
let field_entries: Vec<(FieldId, Vec<Id>)> = ast.nodes[id]
|
||||
.fields
|
||||
.iter()
|
||||
.map(|(&fid, children)| (fid, children.clone()))
|
||||
.collect();
|
||||
|
||||
// recursively descend into all the fields
|
||||
// Take the parent's fields by ownership: the recursion will rewrite
|
||||
// each child Id, and we'll write the (possibly mutated) field map back
|
||||
// when we're done. Avoids cloning the whole BTreeMap and its child
|
||||
// Vecs on entry. Each child Vec is only re-allocated if a rewrite
|
||||
// actually changes its contents.
|
||||
//
|
||||
// Child traversal does not increment rewrite depth and starts fresh
|
||||
// (no rule is skipped on child subtrees).
|
||||
let mut changed = false;
|
||||
let mut new_fields = BTreeMap::new();
|
||||
for (field_id, children) in field_entries {
|
||||
let mut new_children = Vec::new();
|
||||
for child_id in children {
|
||||
let mut fields = std::mem::take(&mut ast.nodes[id].fields);
|
||||
for children in fields.values_mut() {
|
||||
let mut new_children: Option<Vec<Id>> = None;
|
||||
for (i, &child_id) in children.iter().enumerate() {
|
||||
let result = apply_rules_inner(index, ast, child_id, fresh, rewrite_depth, None)?;
|
||||
if result.len() != 1 || result[0] != child_id {
|
||||
changed = true;
|
||||
let unchanged = result.len() == 1 && result[0] == child_id;
|
||||
match (&mut new_children, unchanged) {
|
||||
(None, true) => {} // unchanged so far, no allocation needed
|
||||
(None, false) => {
|
||||
// First divergence — copy already-processed Ids and
|
||||
// start collecting the rewritten sequence.
|
||||
let mut new = Vec::with_capacity(children.len());
|
||||
new.extend_from_slice(&children[..i]);
|
||||
new.extend(result);
|
||||
new_children = Some(new);
|
||||
}
|
||||
(Some(new), _) => {
|
||||
new.extend(result);
|
||||
}
|
||||
}
|
||||
new_children.extend(result);
|
||||
}
|
||||
new_fields.insert(field_id, new_children);
|
||||
if let Some(new) = new_children {
|
||||
*children = new;
|
||||
}
|
||||
}
|
||||
|
||||
if !changed {
|
||||
return Ok(vec![id]);
|
||||
}
|
||||
|
||||
let mut node = ast.nodes[id].clone();
|
||||
node.fields = new_fields;
|
||||
node.id = ast.nodes.len();
|
||||
ast.nodes.push(node);
|
||||
Ok(vec![ast.nodes.len() - 1])
|
||||
ast.nodes[id].fields = fields;
|
||||
Ok(vec![id])
|
||||
}
|
||||
|
||||
/// One phase of a desugaring pass: a named bundle of rules that runs to
|
||||
|
||||
@@ -49,7 +49,7 @@ impl Visitor {
|
||||
|
||||
pub fn build_with_schema(self, schema: crate::schema::Schema) -> Ast {
|
||||
Ast {
|
||||
root: self.nodes[0].inner.id,
|
||||
root: 0,
|
||||
schema,
|
||||
nodes: self.nodes.into_iter().map(|n| n.inner).collect(),
|
||||
}
|
||||
@@ -59,7 +59,6 @@ impl Visitor {
|
||||
let id = self.nodes.len();
|
||||
self.nodes.push(VisitorNode {
|
||||
inner: Node {
|
||||
id,
|
||||
kind: self.language.id_for_node_kind(n.kind(), is_named),
|
||||
kind_name: n.kind(),
|
||||
content,
|
||||
@@ -82,11 +81,10 @@ impl Visitor {
|
||||
}
|
||||
|
||||
fn leave_node(&mut self, field_name: Option<&'static str>, _node: tree_sitter::Node<'_>) {
|
||||
let node = self.current.map(|i| &self.nodes[i]).unwrap();
|
||||
let node_id = node.inner.id;
|
||||
let node_parent = node.parent;
|
||||
let node_id = self.current.unwrap();
|
||||
let node_parent = self.nodes[node_id].parent;
|
||||
|
||||
if let Some(parent_id) = node.parent {
|
||||
if let Some(parent_id) = node_parent {
|
||||
let parent = self.nodes.get_mut(parent_id).unwrap();
|
||||
if let Some(field) = field_name {
|
||||
let field_id = self.language.field_id_for_name(field).unwrap().get();
|
||||
|
||||
@@ -182,7 +182,7 @@ fn test_query_repeated_capture() {
|
||||
// Match against the assignment node (first named child of program)
|
||||
let mut cursor = AstCursor::new(&ast);
|
||||
cursor.goto_first_child();
|
||||
let assignment_id = cursor.node().id();
|
||||
let assignment_id = cursor.node_id();
|
||||
|
||||
let mut captures = yeast::captures::Captures::new();
|
||||
let matched = query.do_match(&ast, assignment_id, &mut captures).unwrap();
|
||||
@@ -206,7 +206,7 @@ fn test_capture_unnamed_node_parenthesized() {
|
||||
|
||||
let mut cursor = AstCursor::new(&ast);
|
||||
cursor.goto_first_child();
|
||||
let assignment_id = cursor.node().id();
|
||||
let assignment_id = cursor.node_id();
|
||||
|
||||
let mut captures = yeast::captures::Captures::new();
|
||||
let matched = query.do_match(&ast, assignment_id, &mut captures).unwrap();
|
||||
@@ -233,7 +233,7 @@ fn test_capture_unnamed_node_bare_literal() {
|
||||
|
||||
let mut cursor = AstCursor::new(&ast);
|
||||
cursor.goto_first_child();
|
||||
let assignment_id = cursor.node().id();
|
||||
let assignment_id = cursor.node_id();
|
||||
|
||||
let mut captures = yeast::captures::Captures::new();
|
||||
let matched = query.do_match(&ast, assignment_id, &mut captures).unwrap();
|
||||
@@ -254,7 +254,7 @@ fn test_bare_underscore_matches_unnamed() {
|
||||
|
||||
let mut cursor = AstCursor::new(&ast);
|
||||
cursor.goto_first_child();
|
||||
let assignment_id = cursor.node().id();
|
||||
let assignment_id = cursor.node_id();
|
||||
|
||||
// `(_)` skips unnamed children, so a query containing a single `(_)`
|
||||
// bare pattern fails to match the assignment (whose only unfielded
|
||||
@@ -293,7 +293,7 @@ fn test_bare_forms_in_field_position() {
|
||||
|
||||
let mut cursor = AstCursor::new(&ast);
|
||||
cursor.goto_first_child();
|
||||
let assignment_id = cursor.node().id();
|
||||
let assignment_id = cursor.node_id();
|
||||
|
||||
// Bare `_` in field position. Captures the named `identifier "x"`
|
||||
// child of the `left` field — bare `_` admits unnamed too, but the
|
||||
@@ -337,7 +337,7 @@ fn test_forward_scan_finds_unnamed_token_late() {
|
||||
while cursor.node().kind() != "do" || !cursor.node().is_named() {
|
||||
assert!(cursor.goto_next_sibling(), "expected to find named `do`");
|
||||
}
|
||||
let do_id = cursor.node().id();
|
||||
let do_id = cursor.node_id();
|
||||
|
||||
let query = yeast::query!((do ("end") @kw));
|
||||
let mut captures = yeast::captures::Captures::new();
|
||||
@@ -363,7 +363,7 @@ fn test_forward_scan_preserves_order() {
|
||||
while cursor.node().kind() != "do" || !cursor.node().is_named() {
|
||||
assert!(cursor.goto_next_sibling(), "expected to find named `do`");
|
||||
}
|
||||
let do_id = cursor.node().id();
|
||||
let do_id = cursor.node_id();
|
||||
|
||||
let query = yeast::query!((do ("end") @first ("do") @second));
|
||||
let mut captures = yeast::captures::Captures::new();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,3 @@
|
||||
description: Expose declared interface types
|
||||
compatibility: full
|
||||
type_decls.rel: reorder type_decls.rel (@type_decl id, string name, @type_or_none declared_interface_type) id name
|
||||
@@ -299,6 +299,7 @@ void DeclTranslator::fillTypeDecl(const swift::TypeDecl& decl, codeql::TypeDecl&
|
||||
entry.inherited_types.push_back(dispatcher.fetchLabel(type));
|
||||
}
|
||||
}
|
||||
entry.declared_interface_type = dispatcher.fetchLabel(decl.getDeclaredInterfaceType());
|
||||
fillValueDecl(decl, entry);
|
||||
}
|
||||
|
||||
|
||||
14
swift/ql/.generated.list
generated
14
swift/ql/.generated.list
generated
@@ -741,7 +741,7 @@ lib/codeql/swift/generated/Location.qll 5e20316c3e480ddfe632b7e88e016c19f10a67df
|
||||
lib/codeql/swift/generated/MacroRole.qll facf907e75490d69cd401c491215e4719324d751f40ea46c86ccf24cf3663c1f 969d8d4b44e3f1a9c193a152a4d83a303e56d2dbb871fc920c47a33f699cf018
|
||||
lib/codeql/swift/generated/ParentChild.qll 669d39245f2cb735cfd4bcebdb551ef8f334fef5297c5834a8b09ebfa655856e 59b283c8a30b6b364c853302ab919ea713e0289e7b793b08b46fc87178d14a6a
|
||||
lib/codeql/swift/generated/PureSynthConstructors.qll bc31a6c4d142fa3fbdcae69d5ba6f1cec00eb9ad92b46c8d7b91ebfa7ef6c1f4 bc31a6c4d142fa3fbdcae69d5ba6f1cec00eb9ad92b46c8d7b91ebfa7ef6c1f4
|
||||
lib/codeql/swift/generated/Raw.qll 0090c6509cb3fa5a67c996a2fc22e6338caef19701ca19463965b55b3c63096f 578329fa3abbabbadbff5e364e9c8d7ad76b41d4c17ad76e0660d41f48746659
|
||||
lib/codeql/swift/generated/Raw.qll a21e4f931d2bfcd9d964a7b930a81e7c169dc7ed7611f195087ea664745f90ea 3594391128bf4f3fb387ce386ab0f1ef070b7fa046425b6b4152f13b21d0a754
|
||||
lib/codeql/swift/generated/Synth.qll e30b50d2645d9c36719d81f1be70712c7c6e89a3f5b4a5ae894411e045d05bff 9bd0c9c90532db97cde9553dde4089b7cf12c462c690d853fa40cb36ea112c21
|
||||
lib/codeql/swift/generated/SynthConstructors.qll c40f01e1331bdbe238620a41d17409cefe34a6b23066708ef5d74f8631b54f48 c40f01e1331bdbe238620a41d17409cefe34a6b23066708ef5d74f8631b54f48
|
||||
lib/codeql/swift/generated/UnknownFile.qll 247ddf2ebb49ce5ed4bf7bf91a969ddff37de6c78d43d8affccaf7eb586e06f2 452b29f0465ef45e978ef8b647b75e5a2a1e53f2a568fc003bc8f52f73b3fa4d
|
||||
@@ -787,7 +787,7 @@ lib/codeql/swift/generated/decl/StructDecl.qll baa06ebff9619339b461342828f952693
|
||||
lib/codeql/swift/generated/decl/SubscriptDecl.qll 18d84b4ef27ecb732ac4350b8b01cb8c48db5182680f6893d392d5994919ca97 fcb5fe713326957a5bdf9bb9098f979c77778c02252dcb9c6d915a8d15eb65cf
|
||||
lib/codeql/swift/generated/decl/TopLevelCodeDecl.qll b327da6de5b1e40f5eea5893f4fcb01803cfdd78bd757ec93daadedb7169bf8d 2d316fff198707fae5a43e6b24d2a547ee9502fd278468846495d1b2f4ea62b1
|
||||
lib/codeql/swift/generated/decl/TypeAliasDecl.qll 041c098c276bc7369049e9a11540e99b061d50977338cceca47488f82b21694e 06deed614cbe77031fdbf3f9591780e80b9f545adec8b7831a2b5329ee49bc5f
|
||||
lib/codeql/swift/generated/decl/TypeDecl.qll 92f74709cce7e9f0f713598d3b20b730475c312957c518b8096206f8744419a2 305bda46c8bef48b7e30392698e724093ab2984ffed74cae3361f818cbf8c77a
|
||||
lib/codeql/swift/generated/decl/TypeDecl.qll f8382cfd5800b1165b11fe927b35b2406826f0d1239114376656352039249b56 0247872a700e15c9243dd36e564e93c8b2aeec9cdd26ee675eaaf01525787111
|
||||
lib/codeql/swift/generated/decl/UsingDecl.qll 3bb697961f5699ec9ed1b87511714eac4ee69f5d82e1fd8c6598f121e23a2f7b 4e72b98a84f796d3e0e556ae6b84bf7b7f08adc225dcdc00fd120461e287b472
|
||||
lib/codeql/swift/generated/decl/ValueDecl.qll d3b9c241fd6cb1ce8274435c0242775c28c08f6a47caae01ad1ecd38897b2cd5 bc81291b1394b47972d7b75b6a767ed847f881932a7d9345d28d161a55b66bd1
|
||||
lib/codeql/swift/generated/decl/VarDecl.qll 8978a73fa2d7a9f952b68a2638788eda857e62502311a33fa6de1dad49a6cb1c b8b6c8cf6773056c3a90494754b0a257dcae494c03d933f138ece7f531fb9158
|
||||
@@ -1048,13 +1048,13 @@ test/extractor-tests/generated/Diagnostics/Diagnostics.ql c1f8be2c283e13c1a4dada
|
||||
test/extractor-tests/generated/File/File.ql a1385ef2080e04e8757f61b8e1d0129df9f955edf03fbb3b83cc9cb5498b4e95 0364d8c7f108d01b2641f996efedab7084956307e875e6bc078ea677d04267e0
|
||||
test/extractor-tests/generated/KeyPathComponent/KeyPathComponent.ql 3fa617f8ed1b308d0c56f429ee8abe6d33ef60bf57d87f6dc89fdc8fe969a102 c2fa3153077dbe9e0fc608524dc03c82ff4ed460364d341ee6a817b0d75291c3
|
||||
test/extractor-tests/generated/decl/Accessor/Accessor.ql 3d4301ec9ec6284b547f8cccf94c3077f0baf70778f458bc21bebc5de55c86e5 2f263e79ecd1ac8da56c17caff400fd3c40d83b6aa3d501830f1d2eeb48a57cd
|
||||
test/extractor-tests/generated/decl/AssociatedTypeDecl/AssociatedTypeDecl.ql 55a78a6b96a17532178a39bd39aa4df23295f98019bb00de041ba15dfd4f84d9 51dbcd86203d5d031d748f77943a81c2c50de4ff559af20a4a1a682a19978d4f
|
||||
test/extractor-tests/generated/decl/AssociatedTypeDecl/AssociatedTypeDecl.ql b7ad6073733906adbffae03a0a227beea7b5ddeb46e31c81fa9c98d6688abd5c b9b9b01e358d37a154bd3e4d7e59765c5c0ef36cc1a3110718ec9d35946d1ab6
|
||||
test/extractor-tests/generated/decl/CapturedDecl/CapturedDecl.ql fd62be6c38d39f371c20e8c2f233e37a9da5aa234588920634f5db67e8beb3bd d51d35d4fd6a21cd596e064e0221d0c86e36312412a9bd4e64f431c123f3019a
|
||||
test/extractor-tests/generated/decl/ClassDecl/ClassDecl.ql d5fa7f68307e2e3e7ad060a125bda148e4a28f6acbef08a1a975bbf9ba947641 46d1e4f801414f1c869601dc706e41393e5fcd399e51da593c1e58737f6ff427
|
||||
test/extractor-tests/generated/decl/ClassDecl/ClassDecl.ql 28e453c11069b0266d950da1f32361863d10d870de0f6d11512a0bb686af2ec1 2524ee149a48902346b81bfac6f50c832f83680aed4a850e8ea15504253865be
|
||||
test/extractor-tests/generated/decl/ConcreteVarDecl/ConcreteVarDecl.ql 936ac4aa52a55bd5bb4c75c117fffcc00208b9f502ff7ee05acbaad7d48a52fb d80346fe34d40910f5ecdb33d7266b6e4d1ec79f8d767c7da5e2ab780f201457
|
||||
test/extractor-tests/generated/decl/Deinitializer/MISSING_SOURCE.txt 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d
|
||||
test/extractor-tests/generated/decl/EnumDecl/EnumCaseDecl.ql 7436bb7dfaa471f5a21ea2e3faba97d61bf53f930720999abdcc6745a65f0a1a 0241b2bb07c17136f6099185f65ea1266cd912296dfe481dce30eb9e3d1dd23f
|
||||
test/extractor-tests/generated/decl/EnumDecl/EnumDecl.ql 47f20279f49388a4850df4f5ee61634e30beed58567eff891688c09942862ec2 8e11af1ceb07cab9738ffb25ac877ced712d1883a6514de5e8895cd1809a7bd8
|
||||
test/extractor-tests/generated/decl/EnumDecl/EnumDecl.ql 329c3f6255ef3ed5441110291d40c4e409ad520d92504d8778aadf21e1359a27 ebda0c8f81c6c8383c8ecb68be66a14cc351a9b5f21d44f9a815ff8e149d74b8
|
||||
test/extractor-tests/generated/decl/EnumDecl/EnumElementDecl.ql 16caf5b014dea42a36b23eee6932c0818d94b1416e151ce46ba06a1fd2fb73ba cac704575b50613c8f8f297ce37c6d09ef943c94df4289643a4496103ac8388e
|
||||
test/extractor-tests/generated/decl/ExtensionDecl/ExtensionDecl.ql 04529ad447b7b0c529a54b0e0d009183c00cb1dcd7eb16378a7c4c7bc86bca4d 86379270a15fa014dc127607b720bb4d39b24b70d1c0f72ef8563c4144423ced
|
||||
test/extractor-tests/generated/decl/GenericTypeParamDecl/MISSING_SOURCE.txt 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d
|
||||
@@ -1064,9 +1064,9 @@ test/extractor-tests/generated/decl/InfixOperatorDecl/MISSING_SOURCE.txt 35fb32e
|
||||
test/extractor-tests/generated/decl/Initializer/MISSING_SOURCE.txt 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d
|
||||
test/extractor-tests/generated/decl/MacroDecl/MacroDecl.ql 61f092d4ed5972283b3eb0eeec81c8f299496dc548a98dca56a1aadaf8248d1d b9cd637cb0f6f34d8d0a4473f2c212a0534d49891d55593758bb03f8d225f32a
|
||||
test/extractor-tests/generated/decl/MacroDecl/MacroRole.ql 7ab0dc211663c1b09a54ccbee7d6be94ffa45f420b383d2e2f22b7ccfb8d7a48 92296b89fccf6aebe877e67796885bedd809ebb470f23f48f98b27c2922c4ba2
|
||||
test/extractor-tests/generated/decl/ModuleDecl/ModuleDecl.ql 63a41a3b393b29d19752379fe29f26fe649dad2927836e24832e07c503d092a6 927fa4056a5d7c65803f7baa1216e6bef9b3b6a223c4a2bb50f2a6a31580db6a
|
||||
test/extractor-tests/generated/decl/ModuleDecl/ModuleDecl.ql 814ec8b4d9947ff8a49e1c4726015d8a0a35b22851dd50eb516f7c91994481e8 d01548746991d765b8c508c88cfe5ff2e39b499dd177abafcd94e226e0efa016
|
||||
test/extractor-tests/generated/decl/NamedFunction/NamedFunction.ql c6be4c1314ffed2a8a91af2e08ea14ce721195ec993d18ebd4d7b90f4a60dac3 767fc36b64291ab7ecccd63bf74856983830267c992d1347236da314fca73d57
|
||||
test/extractor-tests/generated/decl/OpaqueTypeDecl/OpaqueTypeDecl.ql 85b041e1f791b40ff3d3c58c79e017cebf9ef535ea3d576984b7c093f25aa95b 9fcf314b02ac95fbd2c0e5fc95dc48c16522c74def57f5647dd5ad7e80f7c2c1
|
||||
test/extractor-tests/generated/decl/OpaqueTypeDecl/OpaqueTypeDecl.ql d764ddd50ee6faff51bee3a00349d660c32fd5548c7bda3a19866925688e96b0 e6534ba21371aef4d99a6206187d69cda77cd613606d7cb297192f21532fdcab
|
||||
test/extractor-tests/generated/decl/ParamDecl/ParamDecl.ql cc9d89731f7a5ecc2267923268e2d8046aa3f0eb9556c6a12e53b541347f45a4 6d06279172ff2c04be0f39293a2e9a9de5e41ff1efffd41a67d5a921e1afe9ea
|
||||
test/extractor-tests/generated/decl/PatternBindingDecl/MISSING_SOURCE.txt 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d
|
||||
test/extractor-tests/generated/decl/PostfixOperatorDecl/MISSING_SOURCE.txt 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d 35fb32ea5393152eb7a875b20b4e3e4b8c7a997a8959c32417140d57a16a052d
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
---
|
||||
category: feature
|
||||
---
|
||||
* The `TypeDecl` class now defines a `getDeclaredInterfaceType` predicate, which yields the declared interface type of the type declaration.
|
||||
7
swift/ql/lib/codeql/swift/generated/Raw.qll
generated
7
swift/ql/lib/codeql/swift/generated/Raw.qll
generated
@@ -1008,7 +1008,7 @@ module Raw {
|
||||
/**
|
||||
* Gets the name of this type declaration.
|
||||
*/
|
||||
string getName() { type_decls(this, result) }
|
||||
string getName() { type_decls(this, result, _) }
|
||||
|
||||
/**
|
||||
* Gets the `index`th inherited type of this type declaration (0-based).
|
||||
@@ -1024,6 +1024,11 @@ module Raw {
|
||||
int getNumberOfInheritedTypes() {
|
||||
result = count(int i | type_decl_inherited_types(this, i, _))
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the declared interface type of this type declaration.
|
||||
*/
|
||||
Type getDeclaredInterfaceType() { type_decls(this, _, result) }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -61,5 +61,28 @@ module Generated {
|
||||
final int getNumberOfInheritedTypes() {
|
||||
result = count(int i | exists(this.getInheritedType(i)))
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the declared interface type of this type declaration.
|
||||
*
|
||||
* This includes nodes from the "hidden" AST. It can be overridden in subclasses to change the
|
||||
* behavior of both the `Immediate` and non-`Immediate` versions.
|
||||
*/
|
||||
Type getImmediateDeclaredInterfaceType() {
|
||||
result =
|
||||
Synth::convertTypeFromRaw(Synth::convertTypeDeclToRaw(this)
|
||||
.(Raw::TypeDecl)
|
||||
.getDeclaredInterfaceType())
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the declared interface type of this type declaration.
|
||||
*/
|
||||
final Type getDeclaredInterfaceType() {
|
||||
exists(Type immediate |
|
||||
immediate = this.getImmediateDeclaredInterfaceType() and
|
||||
result = immediate.resolve()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
3
swift/ql/lib/swift.dbscheme
generated
3
swift/ql/lib/swift.dbscheme
generated
@@ -530,7 +530,8 @@ prefix_operator_decls( //dir=decl
|
||||
#keyset[id]
|
||||
type_decls( //dir=decl
|
||||
int id: @type_decl ref,
|
||||
string name: string ref
|
||||
string name: string ref,
|
||||
int declared_interface_type: @type_or_none ref
|
||||
);
|
||||
|
||||
#keyset[id, index]
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,4 @@
|
||||
description: Expose declared interface types
|
||||
compatibility: backwards
|
||||
type_decls.rel: run upgrade.ql new_type_decls
|
||||
unspecified_elements.rel: run upgrade.ql new_unspecified_elements
|
||||
@@ -0,0 +1,29 @@
|
||||
class TypeDecl extends @type_decl {
|
||||
string toString() { none() }
|
||||
}
|
||||
|
||||
newtype TAddedElement = TType(TypeDecl t)
|
||||
|
||||
module Fresh = QlBuiltins::NewEntity<TAddedElement>;
|
||||
|
||||
class TNewElement = @element or Fresh::EntityId;
|
||||
|
||||
class NewElement extends TNewElement {
|
||||
string toString() { none() }
|
||||
}
|
||||
|
||||
query predicate new_type_decls(TypeDecl typeDecl, string name, NewElement elementType) {
|
||||
type_decls(typeDecl, name) and
|
||||
Fresh::map(TType(typeDecl)) = elementType
|
||||
}
|
||||
|
||||
query predicate new_unspecified_elements(NewElement id, string property, string error) {
|
||||
unspecified_elements(id, property, error)
|
||||
or
|
||||
exists(TypeDecl typeDecl | type_decls(typeDecl, _) |
|
||||
id = Fresh::map(TType(typeDecl)) and
|
||||
error =
|
||||
"TypeDecl declared interface type missing after upgrade. Please update your CodeQL code." and
|
||||
property = ""
|
||||
)
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
instances
|
||||
| associated_type.swift:2:5:2:20 | Bar | getModule: | file://:0:0:0:0 | associated_type | getInterfaceType: | Self.Bar.Type | getName: | Bar |
|
||||
| associated_type.swift:3:5:3:25 | Baz | getModule: | file://:0:0:0:0 | associated_type | getInterfaceType: | Self.Baz.Type | getName: | Baz |
|
||||
| associated_type.swift:2:5:2:20 | Bar | getModule: | file://:0:0:0:0 | associated_type | getInterfaceType: | Self.Bar.Type | getName: | Bar | getDeclaredInterfaceType: | Self.Bar |
|
||||
| associated_type.swift:3:5:3:25 | Baz | getModule: | file://:0:0:0:0 | associated_type | getInterfaceType: | Self.Baz.Type | getName: | Baz | getDeclaredInterfaceType: | Self.Baz |
|
||||
getMember
|
||||
getInheritedType
|
||||
| associated_type.swift:3:5:3:25 | Baz | 0 | Equatable |
|
||||
|
||||
@@ -4,7 +4,8 @@ import TestUtils
|
||||
|
||||
query predicate instances(
|
||||
AssociatedTypeDecl x, string getModule__label, ModuleDecl getModule,
|
||||
string getInterfaceType__label, Type getInterfaceType, string getName__label, string getName
|
||||
string getInterfaceType__label, Type getInterfaceType, string getName__label, string getName,
|
||||
string getDeclaredInterfaceType__label, Type getDeclaredInterfaceType
|
||||
) {
|
||||
toBeTested(x) and
|
||||
not x.isUnknown() and
|
||||
@@ -13,7 +14,9 @@ query predicate instances(
|
||||
getInterfaceType__label = "getInterfaceType:" and
|
||||
getInterfaceType = x.getInterfaceType() and
|
||||
getName__label = "getName:" and
|
||||
getName = x.getName()
|
||||
getName = x.getName() and
|
||||
getDeclaredInterfaceType__label = "getDeclaredInterfaceType:" and
|
||||
getDeclaredInterfaceType = x.getDeclaredInterfaceType()
|
||||
}
|
||||
|
||||
query predicate getMember(AssociatedTypeDecl x, int index, Decl getMember) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
instances
|
||||
| class.swift:1:1:7:1 | Foo | getModule: | file://:0:0:0:0 | class | getInterfaceType: | Foo.Type | getName: | Foo | getType: | Foo |
|
||||
| class.swift:11:1:14:1 | Generic | getModule: | file://:0:0:0:0 | class | getInterfaceType: | Generic<X, Y>.Type | getName: | Generic | getType: | Generic |
|
||||
| class.swift:16:1:17:1 | Baz | getModule: | file://:0:0:0:0 | class | getInterfaceType: | Baz.Type | getName: | Baz | getType: | Baz |
|
||||
| class.swift:1:1:7:1 | Foo | getModule: | file://:0:0:0:0 | class | getInterfaceType: | Foo.Type | getName: | Foo | getDeclaredInterfaceType: | Foo | getType: | Foo |
|
||||
| class.swift:11:1:14:1 | Generic | getModule: | file://:0:0:0:0 | class | getInterfaceType: | Generic<X, Y>.Type | getName: | Generic | getDeclaredInterfaceType: | Generic<X, Y> | getType: | Generic |
|
||||
| class.swift:16:1:17:1 | Baz | getModule: | file://:0:0:0:0 | class | getInterfaceType: | Baz.Type | getName: | Baz | getDeclaredInterfaceType: | Baz | getType: | Baz |
|
||||
getGenericTypeParam
|
||||
| class.swift:11:1:14:1 | Generic | 0 | class.swift:11:15:11:15 | X |
|
||||
| class.swift:11:1:14:1 | Generic | 1 | class.swift:11:18:11:18 | Y |
|
||||
|
||||
@@ -4,7 +4,9 @@ import TestUtils
|
||||
|
||||
query predicate instances(
|
||||
ClassDecl x, string getModule__label, ModuleDecl getModule, string getInterfaceType__label,
|
||||
Type getInterfaceType, string getName__label, string getName, string getType__label, Type getType
|
||||
Type getInterfaceType, string getName__label, string getName,
|
||||
string getDeclaredInterfaceType__label, Type getDeclaredInterfaceType, string getType__label,
|
||||
Type getType
|
||||
) {
|
||||
toBeTested(x) and
|
||||
not x.isUnknown() and
|
||||
@@ -14,6 +16,8 @@ query predicate instances(
|
||||
getInterfaceType = x.getInterfaceType() and
|
||||
getName__label = "getName:" and
|
||||
getName = x.getName() and
|
||||
getDeclaredInterfaceType__label = "getDeclaredInterfaceType:" and
|
||||
getDeclaredInterfaceType = x.getDeclaredInterfaceType() and
|
||||
getType__label = "getType:" and
|
||||
getType = x.getType()
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
instances
|
||||
| enums.swift:1:1:4:1 | EnumValues | getModule: | file://:0:0:0:0 | enums | getInterfaceType: | EnumValues.Type | getName: | EnumValues | getType: | EnumValues |
|
||||
| enums.swift:7:1:10:1 | EnumValuesWithBase | getModule: | file://:0:0:0:0 | enums | getInterfaceType: | EnumValuesWithBase.Type | getName: | EnumValuesWithBase | getType: | EnumValuesWithBase |
|
||||
| enums.swift:12:1:16:1 | EnumWithParams | getModule: | file://:0:0:0:0 | enums | getInterfaceType: | EnumWithParams.Type | getName: | EnumWithParams | getType: | EnumWithParams |
|
||||
| enums.swift:18:1:21:1 | GenericEnum | getModule: | file://:0:0:0:0 | enums | getInterfaceType: | GenericEnum<T>.Type | getName: | GenericEnum | getType: | GenericEnum |
|
||||
| enums.swift:23:1:27:1 | EnumWithNamedParams | getModule: | file://:0:0:0:0 | enums | getInterfaceType: | EnumWithNamedParams.Type | getName: | EnumWithNamedParams | getType: | EnumWithNamedParams |
|
||||
| enums.swift:1:1:4:1 | EnumValues | getModule: | file://:0:0:0:0 | enums | getInterfaceType: | EnumValues.Type | getName: | EnumValues | getDeclaredInterfaceType: | EnumValues | getType: | EnumValues |
|
||||
| enums.swift:7:1:10:1 | EnumValuesWithBase | getModule: | file://:0:0:0:0 | enums | getInterfaceType: | EnumValuesWithBase.Type | getName: | EnumValuesWithBase | getDeclaredInterfaceType: | EnumValuesWithBase | getType: | EnumValuesWithBase |
|
||||
| enums.swift:12:1:16:1 | EnumWithParams | getModule: | file://:0:0:0:0 | enums | getInterfaceType: | EnumWithParams.Type | getName: | EnumWithParams | getDeclaredInterfaceType: | EnumWithParams | getType: | EnumWithParams |
|
||||
| enums.swift:18:1:21:1 | GenericEnum | getModule: | file://:0:0:0:0 | enums | getInterfaceType: | GenericEnum<T>.Type | getName: | GenericEnum | getDeclaredInterfaceType: | GenericEnum<T> | getType: | GenericEnum |
|
||||
| enums.swift:23:1:27:1 | EnumWithNamedParams | getModule: | file://:0:0:0:0 | enums | getInterfaceType: | EnumWithNamedParams.Type | getName: | EnumWithNamedParams | getDeclaredInterfaceType: | EnumWithNamedParams | getType: | EnumWithNamedParams |
|
||||
getGenericTypeParam
|
||||
| enums.swift:18:1:21:1 | GenericEnum | 0 | enums.swift:18:18:18:18 | T |
|
||||
getMember
|
||||
|
||||
@@ -4,7 +4,9 @@ import TestUtils
|
||||
|
||||
query predicate instances(
|
||||
EnumDecl x, string getModule__label, ModuleDecl getModule, string getInterfaceType__label,
|
||||
Type getInterfaceType, string getName__label, string getName, string getType__label, Type getType
|
||||
Type getInterfaceType, string getName__label, string getName,
|
||||
string getDeclaredInterfaceType__label, Type getDeclaredInterfaceType, string getType__label,
|
||||
Type getType
|
||||
) {
|
||||
toBeTested(x) and
|
||||
not x.isUnknown() and
|
||||
@@ -14,6 +16,8 @@ query predicate instances(
|
||||
getInterfaceType = x.getInterfaceType() and
|
||||
getName__label = "getName:" and
|
||||
getName = x.getName() and
|
||||
getDeclaredInterfaceType__label = "getDeclaredInterfaceType:" and
|
||||
getDeclaredInterfaceType = x.getDeclaredInterfaceType() and
|
||||
getType__label = "getType:" and
|
||||
getType = x.getType()
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
instances
|
||||
| file://:0:0:0:0 | Foo | getModule: | file://:0:0:0:0 | Foo | getInterfaceType: | module<Foo> | getName: | Foo | isBuiltinModule: | no | isSystemModule: | no |
|
||||
| file://:0:0:0:0 | __ObjC | getModule: | file://:0:0:0:0 | __ObjC | getInterfaceType: | module<__ObjC> | getName: | __ObjC | isBuiltinModule: | no | isSystemModule: | no |
|
||||
| file://:0:0:0:0 | default_module_name | getModule: | file://:0:0:0:0 | default_module_name | getInterfaceType: | module<default_module_name> | getName: | default_module_name | isBuiltinModule: | no | isSystemModule: | no |
|
||||
| file://:0:0:0:0 | Foo | getModule: | file://:0:0:0:0 | Foo | getInterfaceType: | module<Foo> | getName: | Foo | getDeclaredInterfaceType: | module<Foo> | isBuiltinModule: | no | isSystemModule: | no |
|
||||
| file://:0:0:0:0 | __ObjC | getModule: | file://:0:0:0:0 | __ObjC | getInterfaceType: | module<__ObjC> | getName: | __ObjC | getDeclaredInterfaceType: | module<__ObjC> | isBuiltinModule: | no | isSystemModule: | no |
|
||||
| file://:0:0:0:0 | default_module_name | getModule: | file://:0:0:0:0 | default_module_name | getInterfaceType: | module<default_module_name> | getName: | default_module_name | getDeclaredInterfaceType: | module<default_module_name> | isBuiltinModule: | no | isSystemModule: | no |
|
||||
getMember
|
||||
getInheritedType
|
||||
getAnImportedModule
|
||||
|
||||
@@ -4,8 +4,10 @@ import TestUtils
|
||||
|
||||
query predicate instances(
|
||||
ModuleDecl x, string getModule__label, ModuleDecl getModule, string getInterfaceType__label,
|
||||
Type getInterfaceType, string getName__label, string getName, string isBuiltinModule__label,
|
||||
string isBuiltinModule, string isSystemModule__label, string isSystemModule
|
||||
Type getInterfaceType, string getName__label, string getName,
|
||||
string getDeclaredInterfaceType__label, Type getDeclaredInterfaceType,
|
||||
string isBuiltinModule__label, string isBuiltinModule, string isSystemModule__label,
|
||||
string isSystemModule
|
||||
) {
|
||||
toBeTested(x) and
|
||||
not x.isUnknown() and
|
||||
@@ -15,6 +17,8 @@ query predicate instances(
|
||||
getInterfaceType = x.getInterfaceType() and
|
||||
getName__label = "getName:" and
|
||||
getName = x.getName() and
|
||||
getDeclaredInterfaceType__label = "getDeclaredInterfaceType:" and
|
||||
getDeclaredInterfaceType = x.getDeclaredInterfaceType() and
|
||||
isBuiltinModule__label = "isBuiltinModule:" and
|
||||
(if x.isBuiltinModule() then isBuiltinModule = "yes" else isBuiltinModule = "no") and
|
||||
isSystemModule__label = "isSystemModule:" and
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
instances
|
||||
| file://:0:0:0:0 | _ | getModule: | file://:0:0:0:0 | opaque_types | getInterfaceType: | (some Base).Type | getName: | _ | getNamingDeclaration: | opaque_types.swift:9:1:9:51 | baz(_:) |
|
||||
| file://:0:0:0:0 | _ | getModule: | file://:0:0:0:0 | opaque_types | getInterfaceType: | (some P).Type | getName: | _ | getNamingDeclaration: | opaque_types.swift:5:1:5:45 | bar(_:) |
|
||||
| file://:0:0:0:0 | _ | getModule: | file://:0:0:0:0 | opaque_types | getInterfaceType: | (some P).Type | getName: | _ | getNamingDeclaration: | opaque_types.swift:13:1:13:59 | bazz() |
|
||||
| file://:0:0:0:0 | _ | getModule: | file://:0:0:0:0 | opaque_types | getInterfaceType: | (some SignedInteger).Type | getName: | _ | getNamingDeclaration: | opaque_types.swift:1:1:1:45 | foo() |
|
||||
| file://:0:0:0:0 | _ | getModule: | file://:0:0:0:0 | opaque_types | getInterfaceType: | (some Base).Type | getName: | _ | getDeclaredInterfaceType: | some Base | getNamingDeclaration: | opaque_types.swift:9:1:9:51 | baz(_:) |
|
||||
| file://:0:0:0:0 | _ | getModule: | file://:0:0:0:0 | opaque_types | getInterfaceType: | (some P).Type | getName: | _ | getDeclaredInterfaceType: | some P | getNamingDeclaration: | opaque_types.swift:5:1:5:45 | bar(_:) |
|
||||
| file://:0:0:0:0 | _ | getModule: | file://:0:0:0:0 | opaque_types | getInterfaceType: | (some P).Type | getName: | _ | getDeclaredInterfaceType: | some P | getNamingDeclaration: | opaque_types.swift:13:1:13:59 | bazz() |
|
||||
| file://:0:0:0:0 | _ | getModule: | file://:0:0:0:0 | opaque_types | getInterfaceType: | (some SignedInteger).Type | getName: | _ | getDeclaredInterfaceType: | some SignedInteger | getNamingDeclaration: | opaque_types.swift:1:1:1:45 | foo() |
|
||||
getGenericTypeParam
|
||||
getMember
|
||||
getInheritedType
|
||||
|
||||
@@ -4,8 +4,9 @@ import TestUtils
|
||||
|
||||
query predicate instances(
|
||||
OpaqueTypeDecl x, string getModule__label, ModuleDecl getModule, string getInterfaceType__label,
|
||||
Type getInterfaceType, string getName__label, string getName, string getNamingDeclaration__label,
|
||||
ValueDecl getNamingDeclaration
|
||||
Type getInterfaceType, string getName__label, string getName,
|
||||
string getDeclaredInterfaceType__label, Type getDeclaredInterfaceType,
|
||||
string getNamingDeclaration__label, ValueDecl getNamingDeclaration
|
||||
) {
|
||||
toBeTested(x) and
|
||||
not x.isUnknown() and
|
||||
@@ -15,6 +16,8 @@ query predicate instances(
|
||||
getInterfaceType = x.getInterfaceType() and
|
||||
getName__label = "getName:" and
|
||||
getName = x.getName() and
|
||||
getDeclaredInterfaceType__label = "getDeclaredInterfaceType:" and
|
||||
getDeclaredInterfaceType = x.getDeclaredInterfaceType() and
|
||||
getNamingDeclaration__label = "getNamingDeclaration:" and
|
||||
getNamingDeclaration = x.getNamingDeclaration()
|
||||
}
|
||||
|
||||
@@ -278,6 +278,7 @@ class TypeDecl(ValueDecl):
|
||||
This only returns the types effectively appearing in the declaration. In particular it
|
||||
will not resolve `TypeAliasDecl`s or consider base types added by extensions.
|
||||
""")
|
||||
declared_interface_type: Type
|
||||
|
||||
class AbstractTypeParamDecl(TypeDecl):
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user