Skip to content

Commit 618049b

Browse files
committed
ir: Clarify comment on empty base_name in canonical_name.
1 parent 0a4a202 commit 618049b

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/ir/item.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -278,10 +278,16 @@ impl Item {
278278
TypeKind::Named(ref name, _) => {
279279
return name.to_owned();
280280
}
281-
// We really codegen and use the inner type, so use an empty
282-
// base name so codegen doesn't get confused.
281+
// We call codegen on the inner type, but we do not want
282+
// this alias's name to appear in the canonical name just
283+
// because it is in the inner type's parent chain, so we use
284+
// an empty base name.
283285
//
284-
// We should never have this in another kind of type, so...
286+
// Note that this would be incorrect if this type could be
287+
// referenced from, let's say, a member variable, but in
288+
// that case the referenced type is the inner alias, so
289+
// we're good there. If we wouldn't, a more complex solution
290+
// would be needed.
285291
TypeKind::TemplateAlias(..) => {
286292
Some("")
287293
}

0 commit comments

Comments
 (0)