DfType (@NotNull PsiElement element, boolean assertionsDisabled) { if (!(element instanceof PsiExpression expression)) return DfType.TOP; PsiType expressionType = expression.getType(); if (TypeConversionUtil.isPrimitiveAndNotNull(expressionType) && myDfType instanceof DfReferenceType) { return DfTypes.typedObject(((PsiPrimitiveType)expressionType).getBoxedType(expression), Nullability.NOT_NULL); } if (!(expressionType instanceof PsiPrimitiveType) && myDfType instanceof DfPrimitiveType) { return DfTypes.typedObject(PsiPrimitiveType.getUnboxedType(expressionType), Nullability.NOT_NULL); } CommonDataflow.DataflowResult result = CommonDataflow.getDataflowResult(expression); if (result == null) return DfType.TOP; expression = PsiUtil.skipParenthesizedExprDown(expression); DfType type = assertionsDisabled ? result.getDfTypeNoAssertions(expression) : result.getDfType(expression); if (myDfType instanceof DfLongType && type instanceof DfIntType) { // Implicit widening conversion return DfTypes.longRange(((DfIntType)type).getRange()); } if (type instanceof DfReferenceType) { SpecialField field = ((DfReferenceType)type).getSpecialField(); if (field != null && !field.isStable()) { type = ((DfReferenceType)type).dropSpecialField(); } } return type; }