mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
RegExp: don't warn on incomplete quantifier (IJPL-101794)
in "Regular expression can be simplified" inspection" GitOrigin-RevId: b3207ab9da853781017e5b782caaff9083d33ace
This commit is contained in:
committed by
intellij-monorepo-bot
parent
3a8dccfbc7
commit
602cb1bafd
+2
-1
@@ -9,6 +9,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiElementVisitor;
|
||||
import com.intellij.psi.PsiErrorElement;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import org.intellij.lang.regexp.RegExpBundle;
|
||||
import org.intellij.lang.regexp.RegExpTT;
|
||||
@@ -107,7 +108,7 @@ public class RegExpSimplifiableInspection extends LocalInspectionTool {
|
||||
|
||||
@Override
|
||||
public void visitRegExpQuantifier(RegExpQuantifier quantifier) {
|
||||
if (!quantifier.isCounted()) {
|
||||
if (!quantifier.isCounted() || quantifier.getLastChild() instanceof PsiErrorElement) {
|
||||
return;
|
||||
}
|
||||
final RegExpNumber minElement = quantifier.getMin();
|
||||
|
||||
+4
@@ -42,6 +42,10 @@ public class RegExpSimplifiableInspectionTest extends RegExpInspectionTestCase {
|
||||
highlightTest("[\\W&&\\S]");
|
||||
}
|
||||
|
||||
public void testIncomplete() {
|
||||
highlightTest(".{<EOLError descr=\"Number expected\"></EOLError>");
|
||||
}
|
||||
|
||||
public void testSingleElementClass() {
|
||||
doTest("[a]", "a");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user