diff --git a/RegExpSupport/src/org/intellij/lang/regexp/inspection/DuplicateAlternationBranchInspection.java b/RegExpSupport/src/org/intellij/lang/regexp/inspection/DuplicateAlternationBranchInspection.java index 373b598e6e9d..fd122dbd0161 100644 --- a/RegExpSupport/src/org/intellij/lang/regexp/inspection/DuplicateAlternationBranchInspection.java +++ b/RegExpSupport/src/org/intellij/lang/regexp/inspection/DuplicateAlternationBranchInspection.java @@ -56,6 +56,9 @@ public class DuplicateAlternationBranchInspection extends LocalInspectionTool { final RegExpBranch[] branches = pattern.getBranches(); for (int i = 0; i < branches.length - 1; i++) { final RegExpBranch branch1 = branches[i]; + if (branch1.getAtoms().length == 0) { + continue; + } for (int j = i + 1; j < branches.length; j++) { final RegExpBranch branch2 = branches[j]; if (RegExpEquivalenceChecker.areElementsEquivalent(branch1, branch2)) { diff --git a/RegExpSupport/test/org/intellij/lang/regexp/inspection/DuplicateAlternationBranchInspectionTest.java b/RegExpSupport/test/org/intellij/lang/regexp/inspection/DuplicateAlternationBranchInspectionTest.java index 63c98fcc9900..3e79144f152a 100644 --- a/RegExpSupport/test/org/intellij/lang/regexp/inspection/DuplicateAlternationBranchInspectionTest.java +++ b/RegExpSupport/test/org/intellij/lang/regexp/inspection/DuplicateAlternationBranchInspectionTest.java @@ -35,6 +35,10 @@ public class DuplicateAlternationBranchInspectionTest extends RegExpInspectionTe highlightTest("[abc]|[cba]"); } + public void testEmptyBranches() { + highlightTest("|||"); + } + @NotNull @Override protected LocalInspectionTool getInspection() {