File tree Expand file tree Collapse file tree
liquidjava-example/src/main/java/testSuite Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package testSuite ;
2+
3+ import liquidjava .specification .Refinement ;
4+
5+ @ SuppressWarnings ("unused" )
6+ public class ErrorOperatorAssignments {
7+
8+ @ Refinement ("_ == 1" )
9+ int one () {
10+ return 1 ;
11+ }
12+
13+ @ Refinement ("_ == 0 || _ == 1" )
14+ int remainder (@ Refinement ("_ >= 0" ) int x ) {
15+ x %= 2 ;
16+ return x ;
17+ }
18+
19+ @ Refinement ("_ == 12" )
20+ int plusInvocation (@ Refinement ("_ >= 0" ) int x ) {
21+ int y = 10 ;
22+ y += remainder (x );
23+ return y ; // Refinement Error
24+ }
25+
26+ @ Refinement ("_ == 10" )
27+ int plusUnaryInvocation () {
28+ int y = 10 ;
29+ y += -one ();
30+ return y ; // Refinement Error
31+ }
32+
33+ @ Refinement ("_ == 12" )
34+ int plusConditional (@ Refinement ("_ >= 0" ) int x ) {
35+ int y = 10 ;
36+ y += x >= 0 ? one () : 2 ;
37+ return y ; // Refinement Error
38+ }
39+
40+ @ Refinement ("_ == 14" )
41+ int plusBinaryExpression () {
42+ int y = 10 ;
43+ y += one () + 2 ;
44+ return y ; // Refinement Error
45+ }
46+
47+ @ Refinement ("_ == 10" )
48+ int plusArrayRead (int [] values ) {
49+ int y = 10 ;
50+ y += values [0 ];
51+ return y ; // Refinement Error
52+ }
53+
54+ @ Refinement ("_ == 12" )
55+ int plusCast () {
56+ int y = 10 ;
57+ y += (int ) one ();
58+ return y ; // Refinement Error
59+ }
60+ }
You can’t perform that action at this time.
0 commit comments