Skip to content

Commit c3fd4a7

Browse files
Never take a built-in function for a ghost of the same name
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 36f1115 commit c3fd4a7

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

‎liquidjava-verifier/src/main/java/liquidjava/processor/refinement_checker/OriginNotes.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ private static boolean applies(Expression expression, String name) {
128128

129129
/** Whether {@code name} is a declared ghost, unlike a built-in such as {@code length}, which may be interpreted */
130130
private static boolean isGhost(String name, Context context) {
131-
return context.getGhosts().stream().anyMatch(g -> g.matches(name))
132-
|| context.getGhostStates().stream().anyMatch(g -> g.getParent() == null && g.matches(name));
131+
return !Utils.isBuiltin(name) && (context.getGhosts().stream().anyMatch(g -> g.matches(name))
132+
|| context.getGhostStates().stream().anyMatch(g -> g.getParent() == null && g.matches(name)));
133133
}
134134

135135
/** Whether {@code fact} is {@code variable == ghost}, the argument's own definition */

‎liquidjava-verifier/src/main/java/liquidjava/utils/Utils.java‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ public class Utils {
3939
private static final Set<String> DEFAULT_NAMES = Set.of("old", "length", "addToIndex", "getFromIndex");
4040
private static final List<String> REFINEMENT_KEYS = List.of("value", "to", "from");
4141

42+
/** Whether {@code name} is a function the refinement language provides, such as {@code length} */
43+
public static boolean isBuiltin(String name) {
44+
return DEFAULT_NAMES.contains(name);
45+
}
46+
4247
public static CtTypeReference<?> getType(String type, Factory factory) {
4348
// TODO: complete with other types
4449
return switch (type) {

0 commit comments

Comments
 (0)