Skip to content

Commit abf341f

Browse files
Keep the instance counter on a call argument written as code
Two calls written alike can return different values, so the counter tells them apart, as it does for every other instance. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 639de86 commit abf341f

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎liquidjava-verifier/src/main/java/liquidjava/rj_language/ast/formatter/VariableFormatter.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ public static String format(String name) {
1616
if (name == null)
1717
return null;
1818

19-
String argument = ArgumentDisplayNames.argumentCode(name);
20-
if (argument != null)
21-
return argument;
22-
2319
if (isApplication(name))
2420
return formatApplication(name);
2521

@@ -29,6 +25,10 @@ public static String format(String name) {
2925

3026
String baseName = matcher.group(1);
3127
String counter = matcher.group(2);
28+
// the counter tells apart calls written alike, which can return different values
29+
String argument = ArgumentDisplayNames.argumentCode(name);
30+
if (argument != null)
31+
return argument + toSuperscript(counter);
3232
String receiver = FieldDisplayNames.writeReceiver(name);
3333
if (receiver != null && isField(baseName))
3434
return (receiver.isEmpty() ? "" : receiver + ".") + fieldOf(baseName) + toSuperscript(counter);

‎liquidjava-verifier/src/test/java/liquidjava/rj_language/ast/formatter/ExpressionNameResolverTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,6 @@ void writesACallArgumentAsTheCallerWroteIt() {
6464
Expression expression = Predicate
6565
.createEquals(Predicate.createVar("#bound_83"), Predicate.createLit("0", "int")).getExpression();
6666

67-
assertEquals("failures.size() == 0", expression.toDisplayString());
67+
assertEquals("failures.size()⁸³ == 0", expression.toDisplayString());
6868
}
6969
}

0 commit comments

Comments
 (0)