mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
DfaFactType: fixed default range for float/double; tests
Fixes test DataFlowRangeAnalysisTest.testLongRangeBasics
This commit is contained in:
@@ -114,9 +114,8 @@ public abstract class DfaFactType<T> extends Key<T> {
|
||||
}
|
||||
}
|
||||
PsiModifierListOwner psiVariable = var.getPsiVariable();
|
||||
LongRangeSet fromAnnotation = LongRangeSet.fromAnnotation(psiVariable);
|
||||
LongRangeSet fromType = LongRangeSet.fromType(var.getVariableType());
|
||||
return fromType == null ? fromAnnotation : fromAnnotation.intersect(fromType);
|
||||
return fromType == null ? null : LongRangeSet.fromAnnotation(psiVariable).intersect(fromType);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -6,6 +6,18 @@ public class LongRangeAnnotation {
|
||||
return new Random().nextInt(100);
|
||||
}
|
||||
|
||||
@Nonnegative int x;
|
||||
@Nonnegative double y;
|
||||
|
||||
void testField() {
|
||||
if(<warning descr="Condition 'x < 0' is always 'false'">x < 0</warning>) {
|
||||
System.out.println("Impossible");
|
||||
}
|
||||
if(y < 0) {
|
||||
System.out.println("Doubles are not supported yet");
|
||||
}
|
||||
}
|
||||
|
||||
void testAnnotated() {
|
||||
int value = method();
|
||||
if(value == 0) {
|
||||
|
||||
Reference in New Issue
Block a user