Skip to content

Conversation

@rcosta358
Copy link
Collaborator

This PR replaces the toString() methods from the AST classes with the toSimplifiedString() methods. This way, the error messages don't include the fully qualified names for ghosts, which improves their readability by reducing their verbosity.

Example

Before

Refinement Error: #index_7 == 1 && java.util.ArrayList.size(#list_8) == java.util.ArrayList.size(#list_4) + 1 && java.util.ArrayList.size(#list_4) == 0 is not a subtype of 0 <= #index_7 && #index_7 < com.arraylist.ArrayListRefinements.size(#list_8)

After

Refinement Error: #index_7 == 1 && size(#list_8) == size(#list_4) + 1 && size(#list_4) == 0 is not a subtype of 0 <= #index_7 && #index_7 < size(#list_8)

@rcosta358 rcosta358 self-assigned this Feb 11, 2026
@rcosta358 rcosta358 marked this pull request as draft February 11, 2026 15:19
@rcosta358 rcosta358 removed the request for review from CatarinaGamboa February 11, 2026 15:20
@rcosta358 rcosta358 marked this pull request as ready for review February 11, 2026 15:22
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.

nice refactoring! But what if we have two ghosts from different classes like ArrayList.size and Stack.size? would there be a way to only show the full name if theere are more than 1?

@rcosta358
Copy link
Collaborator Author

I think so, but in that case we need both methods, toString and toSimplifiedString and then choose which one to call.

@rcosta358
Copy link
Collaborator Author

I'll try to do that in another PR and leave this one open.

@rcosta358
Copy link
Collaborator Author

This seems to be a bit harder than I originally thought, so I'll do that in a follow-up PR in the future.

@rcosta358 rcosta358 merged commit f3e86b3 into main Feb 11, 2026
1 check passed
@rcosta358 rcosta358 deleted the ast-simplified-string branch February 12, 2026 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants