@Contract(value = "null -> false", pure = true)
  public static boolean containsNamedPatternVariable(@Nullable PsiCaseLabelElement pattern) {
    if (pattern instanceof PsiTypeTestPattern) {
      PsiPatternVariable variable = ((PsiTypeTestPattern)pattern).getPatternVariable();
      return variable != null && !variable.isUnnamed();
    }
    else if (pattern instanceof PsiDeconstructionPattern) {
      PsiDeconstructionPattern deconstructionPattern = (PsiDeconstructionPattern)pattern;
      return deconstructionPattern.getPatternVariable() != null ||
             ContainerUtil.exists(deconstructionPattern.getDeconstructionList().getDeconstructionComponents(),
                                  component -> containsNamedPatternVariable(component));
    }
    return false;
  }
@Contract(value = "null -> false", pure = true)
  public static boolean containsNamedPatternVariable(@Nullable PsiCaseLabelElement pattern)