Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redefining a privat field in a child feature causes java.lang.Error: Value.setField in DFA #3369

Closed
simonvonhackewitz opened this issue Jul 11, 2024 · 7 comments · Fixed by #3412
Labels
bug Something isn't working middle end related to the Middle End that creates Fuzion Application from Fuzion Modules

Comments

@simonvonhackewitz
Copy link
Contributor

Steps to reproduce

  1. checkout 99c6c7f
  2. run fz tests/base32hex/base32hex_test.fz from fuzion directory

Caused by redefinition of the field alphabet in base32hex

@michaellilltokiwa
Copy link
Member

This is not a redefinition of the field, but two separate independent fields that happen to have the same name. Of course this should not lead to such a horrible error. ;-)

@fridis
Copy link
Member

fridis commented Jul 15, 2024

@simonvonhackewitz, can you please extract this into a small, stand-alone example and include the complete error output in the issue, in particular, are there any previous errors reported?

@michaellilltokiwa michaellilltokiwa added bug Something isn't working middle end related to the Middle End that creates Fuzion Application from Fuzion Modules labels Jul 15, 2024
@simonvonhackewitz
Copy link
Contributor Author

Code needs to be in separate files

exception.fz

ex is
  say child.introduce

parent.fz

public parent is

  module get_name => "PARENT"

  name := get_name

  public introduce => "I'm $name"

child.fz

public child : parent is

  redef get_name => "CHILD"

  # NYI: This causes a java exception
  name := get_name

Error

fz -sourceDirs=/tmp/exception/  /tmp/exception/exception.fz                                                 ✔ 

error 1: java.lang.Error: Value.setField for 'child.name' called on class UNIT (class dev.flang.fuir.analysis.dfa.Value$3), expected class dev.flang.fuir.analysis.dfa.Instance
        at dev.flang.fuir.analysis.dfa.Value.setField(Value.java:248)
        at dev.flang.fuir.analysis.dfa.Value$3.setField(Value.java:138)
        at dev.flang.fuir.analysis.dfa.DFA$Analyze.access0(DFA.java:338)
        at dev.flang.fuir.analysis.dfa.DFA$Analyze.lambda$access$0(DFA.java:281)
        at dev.flang.fuir.analysis.dfa.Value.forAll(Value.java:388)
        at dev.flang.fuir.analysis.dfa.DFA$Analyze.access(DFA.java:273)
        at dev.flang.fuir.analysis.dfa.DFA$Analyze.assign(DFA.java:207)
        at dev.flang.fuir.analysis.dfa.DFA$Analyze.assign(DFA.java:90)
        at dev.flang.fuir.analysis.AbstractInterpreter.process(AbstractInterpreter.java:565)
        at dev.flang.fuir.analysis.AbstractInterpreter.processCode(AbstractInterpreter.java:503)
        at dev.flang.fuir.analysis.AbstractInterpreter.processClazz(AbstractInterpreter.java:479)
        at dev.flang.fuir.analysis.dfa.DFA.analyze(DFA.java:1142)
        at dev.flang.fuir.analysis.dfa.DFA.analyzeNewCall(DFA.java:2139)
        at dev.flang.fuir.analysis.dfa.DFA.newCall(DFA.java:2101)
        at dev.flang.fuir.analysis.dfa.DFA$Analyze.call0(DFA.java:376)
        at dev.flang.fuir.analysis.dfa.DFA$Analyze.access0(DFA.java:326)
        at dev.flang.fuir.analysis.dfa.DFA$Analyze.lambda$access$0(DFA.java:281)
        at dev.flang.fuir.analysis.dfa.Value.forAll(Value.java:388)
        at dev.flang.fuir.analysis.dfa.DFA$Analyze.access(DFA.java:273)
        at dev.flang.fuir.analysis.dfa.DFA$Analyze.call(DFA.java:244)
        at dev.flang.fuir.analysis.dfa.DFA$Analyze.call(DFA.java:90)
        at dev.flang.fuir.analysis.AbstractInterpreter.process(AbstractInterpreter.java:596)
        at dev.flang.fuir.analysis.AbstractInterpreter.processCode(AbstractInterpreter.java:503)
        at dev.flang.fuir.analysis.AbstractInterpreter.processClazz(AbstractInterpreter.java:479)
        at dev.flang.fuir.analysis.dfa.DFA.analyze(DFA.java:1142)
        at dev.flang.fuir.analysis.dfa.DFA.analyzeNewCall(DFA.java:2139)
        at dev.flang.fuir.analysis.dfa.DFA.newCall(DFA.java:2101)
        at dev.flang.fuir.analysis.dfa.DFA.dfa(DFA.java:1014)
        at dev.flang.fuir.analysis.dfa.DFA.new_fuir(DFA.java:886)
        at dev.flang.be.jvm.JVM.<init>(JVM.java:794)
        at dev.flang.tools.Fuzion$Backend$3.process(Fuzion.java:191)
        at dev.flang.tools.Fuzion$Backend.processFrontEnd(Fuzion.java:507)
        at dev.flang.tools.Fuzion.lambda$parseArgsForBackend$3(Fuzion.java:1070)
        at dev.flang.tools.Tool.lambda$run$0(Tool.java:141)
        at dev.flang.util.Errors.runAndExit(Errors.java:957)
        at dev.flang.tools.Tool.run(Tool.java:141)
        at dev.flang.tools.Fuzion.main(Fuzion.java:626)


*** fatal errors encountered, stopping.
one error.

@michaellilltokiwa
Copy link
Member

duplicate of #3108 ?

@maxteufel
Copy link
Collaborator

@simonvonhackewitz: does #3387 fix this?

@simonvonhackewitz
Copy link
Contributor Author

No, with the current main branch this still happens.

@maxteufel
Copy link
Collaborator

so it's not a duplicate!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working middle end related to the Middle End that creates Fuzion Application from Fuzion Modules
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants