diff options
-rw-r--r-- | src/ir/item.rs | 11 | ||||
-rw-r--r-- | src/ir/ty.rs | 6 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/ir/item.rs b/src/ir/item.rs index 0c1de20a..9ebda88e 100644 --- a/src/ir/item.rs +++ b/src/ir/item.rs @@ -713,6 +713,17 @@ impl ItemCanonicalPath for Item { } let mut parent_path = self.parent_id().canonical_path(&ctx); + if parent_path.last().map_or(false, |parent_name| parent_name.is_empty()) { + // This only happens (or should only happen) when we're an alias, + // and our parent is a templated alias, in which case the last + // component of the path will be empty. + let is_alias = match *self.expect_type().kind() { + TypeKind::Alias(..) => true, + _ => false, + }; + debug_assert!(is_alias, "How can this ever happen?"); + parent_path.pop().unwrap(); + } parent_path.push(self.real_canonical_name(ctx, true)); parent_path diff --git a/src/ir/ty.rs b/src/ir/ty.rs index 769b7650..0cf8174e 100644 --- a/src/ir/ty.rs +++ b/src/ir/ty.rs @@ -472,6 +472,12 @@ impl Type { ctx); } CXCursor_TemplateTypeParameter => { + // See the comment in src/ir/comp.rs + // about the same situation. + if cur.spelling().is_empty() { + return CXChildVisit_Continue; + } + let default_type = Item::from_ty(&cur.cur_type(), Some(*cur), |