Skip to content

Conversation

@rcosta358
Copy link
Collaborator

@rcosta358 rcosta358 commented Sep 22, 2025

Summary

Added qualified names so ghosts/states with the same name from different classes don't conflict with each other.

Motivation

Different classes frequently reuse ghost/state names (e.g., open, close, size). Without qualification, simple name lookups collide, causing wrong substitutions and sort mismatches in the SMT solver.

Key Changes

  • Qualified names: ghosts/states are stored and looked up with their declaring class prefix (e.g., java.util.ArrayList.size, com.example.SM1.initialized).
  • Keep built-ins unqualified: old, length, addToIndex and getFromIndex.
  • Safe resolution: VCChecker filters candidate ghosts/states to those whose prefix matches the types (and supertypes) of variables in the current VC, preventing unrelated classes with the same simple name from matching (removes ambiguity).
  • Hierarchy-aware: added functionality in AuxStateHandler so subclasses can reference superclass states (Bus.close -> Car.close)
  • Simple name fallback: added fallback in TranslatorToZ3to match by simple name and number of parameters, preferring exact qualified names.

Copy link
Collaborator

@CatarinaGamboa CatarinaGamboa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a hugeee PR. I’m gonna stamp it for now since all tests are passing, it looks good overall and we discussed it offline, but we should try to split them into smaller pieces. For example, 1)add the new methods needed; 2) change call sites and add tests 3) remove unused code

@rcosta358 rcosta358 merged commit 88f2c7f into liquid-java:main Sep 28, 2025
1 check passed
@rcosta358 rcosta358 deleted the qualify-ghost-names branch October 2, 2025 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Similar Ghost Variable names in different classes should be allowed Similar state names in different classes should be allowed

2 participants