You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pages/annotations/refinements.md
+13-9Lines changed: 13 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,17 +35,21 @@ public class RefinementExamples {
35
35
36
36
## Predicate Syntax
37
37
38
-
Refinement predicates use a language similar to Java, where you can write boolean expressions using comparisons, logical connectives, arithmetic operators, conditional expressions, and calls to ghosts or aliases, which are covered in later sections.
38
+
Refinement predicates use a language similar to Java, where you can write boolean expressions using comparisons, logical connectives, arithmetic operators, conditional expressions, ghosts and alias calls, and enum and field constants.
39
39
40
40
| Form | Syntax | Example |
41
41
| --- | --- | --- |
42
-
| Comparison |`==``!=``>``>=``<``<=`|`@Refinement("x > 0") int x = 1;`|
43
-
| Logical operators |`!``&&` <code>||</code> `-->`|`@Refinement("0 <= y && y <= 100") int y = 25;`|
44
-
| Arithmetic |`+``-``*``/``%`|`@Refinement("v + 20 < 100") int v = 79;`|
45
-
| Conditional |`cond ? e1 : e2`|`@Refinement("a > b ? _ == a : _ == b") int max(int a, int b)`|
46
-
| Ghost and alias calls |`a(b)``A(b)`|`@Refinement("Positive(_)") int c = 10;`|
47
-
| Literals |`true``false``0``1.5`|`@Refinement("_ == true") boolean ok = true;`|
48
-
49
-
LiquidJava currently only supports a small set of types in refinements:
42
+
| Comparison operators |`==``!=``>``>=``<``<=`|`@Refinement("x > 0") int x = 1`|
43
+
| Logical operators |`!``&&` <code>||</code> `-->`|`@Refinement("0 <= y && y <= 100") int y = 25`|
44
+
| Arithmetic operators |`+``-``*``/``%`|`@Refinement("v + 20 < 100") int v = 79`|
45
+
| Ternary operator |`cond ? e1 : e2`|`@Refinement("a > b ? _ == a : _ == b") int max(int a, int b)`|
46
+
| Ghost calls |`ghost(...args)`|`@Refinement("0 <= _ < size(this)") int index`|
47
+
| Alias calls |`Alias(...args)`|`@Refinement("Positive(_)") int c = 10`|
0 commit comments