Skip to content

Commit

Permalink
prevent to check for final attribs inside templates
Browse files Browse the repository at this point in the history
since they might be mixed or not, in structs or not
  • Loading branch information
Lars-Kristiansen committed Feb 4, 2017
1 parent 1ee0333 commit 7686dd0
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/analysis/final_attribute.d
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,16 @@ public:
_parent = saved;
}

override void visit(const(MixinTemplateDeclaration) mtd)
{
// can't really know where it'll be mixed (class |final class | struct ?)
}

override void visit(const(TemplateDeclaration) mtd)
{
// regular template are also mixable
}

override void visit(const(Declaration) d)
{
const Parent savedParent = _parent;
Expand Down Expand Up @@ -266,6 +276,13 @@ public:
}
}, sac);

assertAnalyzerWarnings(q{
mixin template Impl()
{
protected final void mixin_template_can() {}
}
}, sac);

// fail

assertAnalyzerWarnings(q{
Expand Down

0 comments on commit 7686dd0

Please sign in to comment.