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

Common keyword default values of a data declaration disappear #485

Closed
PaulKlint opened this issue Jan 12, 2014 · 4 comments
Closed

Common keyword default values of a data declaration disappear #485

PaulKlint opened this issue Jan 12, 2014 · 4 comments

Comments

@PaulKlint
Copy link
Member

It seems that the common keyword definitions in a data declaration disappear somewhere. In the following example fillcolor is the culprit.The following code:

  • Passes the type checker
  • Is compiled. Note: in the generated companion function fillColor is missing.
  • During execution the index of fillColor cannot be found.

Any ideas @Anastassija or @mahills: is the typechcker creating these data and is the backend not using them or does the typechecker not generate it.

module experiments::Compiler::Examples::Tst

  data Figure (str fillColor = "white")  =  emptyFigure();

 public value main(list[value] args) = emptyFigure().fillColor == "white";

gives

|rascal://experiments::Compiler::RVM::Run|(217,618,<12,0>,<22,28>): Java("RuntimeException","PANIC: (instruction execution): instruction: CALLPRIM adt_field_access, 2; message: null",Java("UndeclaredFieldException","tuple[] does not have a field with label fillColor declared for it"))
@Anastassija
Copy link
Contributor

It seems that all the necessary information is provided by the type checker. I will check the compiler side.

@mahills
Copy link
Member

mahills commented Jan 12, 2014

Inside the checker the common keyword parameters are merged over into the constructor-specific parameters, so they should be in with that information. There is also a map, kept off to the side, that maps from IDs (in this case, of the constructor) to names to expressions, which are the defining expressions for the defaults. It sounds like @Anastassija checked and all the checker info is there, but if anything is missing just let me know.

Anastassija added a commit that referenced this issue Jan 13, 2014
@Anastassija
Copy link
Contributor

This issue has been fixed.

@PaulKlint
Copy link
Member Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants