Skip to content

Conversation

olivier-aws
Copy link
Contributor

@olivier-aws olivier-aws commented Jan 15, 2025

What was changed?

The Java code generated for a codatatype always contained a method named Get(). This would cause a conflict if the user defined a method with same name in this datatype, e.g. by:

codatatype NameclashCo = CoCtor(x: int)
{
  method Get() returns (u: int) { return 79; }
}

This PR changes the name of the automatically generated method to _Get() to avoid name clashes. As Dafny method cannot start with an underscore _, it is safe to chose this name.

How has this been tested?

Added test Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-4153.dfy

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

@olivier-aws olivier-aws marked this pull request as ready for review January 15, 2025 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Java compilation error when user code defines Get() in a codatatype
1 participant