boolean (PsiExpression expression, PsiType requiredType) { final PsiType operandType = expression.getType(); if (PsiTypes.doubleType().equals(requiredType)) { return PsiTypes.floatType().equals(operandType) || PsiTypes.longType().equals(operandType) || PsiTypes.intType().equals(operandType) || PsiTypes.charType().equals(operandType) || PsiTypes.shortType().equals(operandType) || PsiTypes.byteType().equals(operandType); } else if (PsiTypes.floatType().equals(requiredType)) { return PsiTypes.longType().equals(operandType) || PsiTypes.intType().equals(operandType) || PsiTypes.charType().equals(operandType) || PsiTypes.shortType().equals(operandType) || PsiTypes.byteType().equals(operandType); } else if (PsiTypes.longType().equals(requiredType)) { return PsiTypes.intType().equals(operandType) || PsiTypes.charType().equals(operandType) || PsiTypes.shortType().equals(operandType) || PsiTypes.byteType().equals(operandType); } else if (PsiTypes.intType().equals(requiredType)) { return PsiTypes.charType().equals(operandType) || PsiTypes.shortType().equals(operandType) || PsiTypes.byteType().equals(operandType); } return false; }