@Contract(pure = true)
  public static boolean areTypesAssignmentCompatible(PsiType lType, PsiExpression rExpr) {
    if (lType == null || rExpr == null) return true;
    PsiType rType = rExpr.getType();
    if (rType == null) return false;
    if (isAssignable(lType, rType)) return true;
    if (lType instanceof PsiClassType) {
        lType = PsiPrimitiveType.getUnboxedType(lType);
        if (lType == null) return false;
    }

    final int rTypeRank = getTypeRank(rType);
    if (lType instanceof PsiPrimitiveType
        && rType instanceof PsiPrimitiveType
        && rTypeRank >= BYTE_RANK && rTypeRank <= INT_RANK) {
      final Object rValue = JavaPsiFacade.getInstance(rExpr.getProject()).getConstantEvaluationHelper().computeConstantExpression(rExpr);
      final long value;
      if (rValue instanceof Number) {
        value = ((Number)rValue).longValue();
      }
      else if (rValue instanceof Character) {
        value = (Character)rValue;
      }
      else {
        return false;
      }

      if (PsiTypes.byteType().equals(lType)) {
        return -128 <= value && value <= 127;
      }
      else if (PsiTypes.shortType().equals(lType)) {
        return -32768 <= value && value <= 32767;
      }
      else if (PsiTypes.charType().equals(lType)) {
        return 0 <= value && value <= 0xFFFF;
      }
    }
    return false;
  }
@Contract(pure = true)
  public static boolean areTypesAssignmentCompatible(PsiType lType, PsiExpression rExpr)