@Nullable
  static HighlightInfo.Builder checkPatternVariableRequired(@NotNull PsiReferenceExpression expression,
                                                    @NotNull JavaResolveResult resultForIncompleteCode) {
    if (!(expression.getParent() instanceof PsiCaseLabelElementList)) return null;
    PsiClass resolved = tryCast(resultForIncompleteCode.getElement(), PsiClass.class);
    if (resolved == null) return null;
    HighlightInfo.Builder info = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression)
      .descriptionAndTooltip(JavaErrorBundle.message("type.pattern.expected"));
    String patternVarName = new VariableNameGenerator(expression, VariableKind.LOCAL_VARIABLE).byName("ignored").generate(true);
    IntentionAction action = getFixFactory().createReplaceWithTypePatternFix(expression, resolved, patternVarName);
    info.registerFix(action, null, null, null, null);
    return info;
  }
@Nullable
  static HighlightInfo.Builder checkPatternVariableRequired(@NotNull PsiReferenceExpression expression,
                                                    @NotNull JavaResolveResult resultForIncompleteCode)