Module name "Module" cannot be used with Java #4256
Labels
during 2: compilation of correct program
Dafny rejects a valid program during compilation
kind: bug
Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label
lang: java
Dafny's Java transpiler and its runtime
priority: next
Will consider working on this after in progress work is done
Dafny version
2023-06-03 (post 4.1.0)
Code to produce this issue
Command to run and resulting output
What happened?
For some reason, the name
Module
cannot be used as a module in Java. Everything works by renaming the module to, say,ModuleM
orMODULE
, in the Dafny source.Another repro that shows the same problem is to rename
Module
toString
in the example above.It seems that Java is resolving these names to
java.lang.Module
orjava.lang.String
.Notes:
Module
,String
, ...) among the reserved keywords. A more precise solution would be to build a similar mechanism that's applied only to module names.enum
in Python, which seems to always resolve to the standard-libraryenum
in Python. If this bug gets fixed, Python should be updated accordingly. See alsoTest/dafny4/Bug116.dfy
.What type of operating system are you experiencing the problem on?
Mac
The text was updated successfully, but these errors were encountered: