You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
labels with same letters but different cases break the compilation on the c backend #479
If you have labels with the same letters (like Eexp and EExp), bnfc will check and not accuse an error, but the compilation will fail with an error stating that duplicate members exist.
for instance, the following generate code and compile ok in cpp and haskell, but not in C (didn't test with others):
test/Absyn/Eexp.java:5: error: class EExp is public, should be declared in a file named EExp.java
public class EExp extends Exp {
^
test/Absyn/Exp.java:12: error: cannot access Eexp
public R visit(test.Absyn.Eexp p, A arg);
^
bad source file: ./test/Absyn/Eexp.java
file does not contain class test.Absyn.Eexp
Please remove or make sure it appears in the correct subdirectory of the sourcepath.
test/Absyn/Exp.java:8: error: name clash: interface Visitor has two methods with the same erasure, yet neither overrides the other
public R visit(test.Absyn.EAdd p, A arg);
^
first method: visit(Eexp,A) in Visitor
second method: visit(EDiv,A) in Visitor
I suppose we want a warning for labels that clash in case-insensitive mode, and an error for the C and Java backends.
Or maybe for C we could preserve the case in field names instead.
Activity
andreasabel commentedon Apr 23, 2024
This is also a problem in the
javabackends:Related:
andreasabel commentedon Apr 23, 2024
I suppose we want a warning for labels that clash in case-insensitive mode, and an error for the C and Java backends.
Or maybe for C we could preserve the case in field names instead.
Fix #479: C: case-sensitive labels: preserve case in union member names
Fix #479: C: case-sensitive labels: preserve case in union member names
Fix #479: C: case-sensitive labels: preserve case in union member names
Fix #479: C: case-sensitive labels: preserve case in union member names