-
Notifications
You must be signed in to change notification settings - Fork 34
Closed
Labels
enhancementNew feature or requestNew feature or requesterror messagesRelated to error messagesRelated to error messages
Description
Why
Adding constant propagation and constant folding to predicates would greatly simplify the error messages in many cases.
Example
public class Example {
public static void handleNegative(@Refinement("x < 0") int x) {}
public static void example() {
int a = 6;
int b = 2;
int result = a / b;
handleNegative(result);
}
}Current error message:
Type expected: (#result_4 < 0)
Refinement found: #result_4 == #a_2 / #b_3 && #a_2 == #a_0 && #a_0 == 6 && #b_3 == #b_1 && #b_1 == 2
Intended error message:
Type expected: (#result_4 < 0)
Refinement found: #result_4 == 3
So, the variables a and b should be propagated with their constant values to 6 / 2 and then this should be folded to 3.
This should also work for booleans, e.g. !true => false.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requesterror messagesRelated to error messagesRelated to error messages