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

Name lookup not working on iterators of record type #7767

Closed
perost opened this issue Aug 16, 2021 · 0 comments
Closed

Name lookup not working on iterators of record type #7767

perost opened this issue Aug 16, 2021 · 0 comments
Assignees
Labels
COMP/OMC/Frontend Issue and pull request related to the frontend

Comments

@perost
Copy link
Member

perost commented Aug 16, 2021

Description

Looking up a field in an iterator of record type does not work.

Steps to Reproduce

Trying to instantiate a model such as this:

record R
  Real x;
end R;

model M
  R r[3];
  Real x[:] = {i.x for i in r};
end M;

gives the error:

Error: Variable i.x not found in scope M.

Expected Behavior

The model should work, since it's allowed for an iterator to be of record type.

@perost perost added the COMP/OMC/Frontend Issue and pull request related to the frontend label Aug 16, 2021
@perost perost self-assigned this Aug 16, 2021
perost added a commit to perost/OpenModelica that referenced this issue Oct 25, 2021
- Fix lookup so that it works also on iterators of complex type.
- Improve Expression.replaceIterator so it handles qualified iterator
  names.
- Improve construction of record array bindings in Ceval, evaluate each
  element instead of evaluating only one and filling an array.
- Add simplification of record element expressions, to make sure mutable
  expressions are simplified away properly.
perost added a commit to perost/OpenModelica that referenced this issue Oct 25, 2021
- Fix lookup so that it works also on iterators of complex type.
- Improve Expression.replaceIterator so it handles qualified iterator
  names.
- Improve construction of record array bindings in Ceval, evaluate each
  element instead of evaluating only one and filling an array.
- Add simplification of record element expressions, to make sure mutable
  expressions are simplified away properly.
@perost perost closed this as completed in 7e091bb Oct 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
COMP/OMC/Frontend Issue and pull request related to the frontend
Projects
None yet
Development

No branches or pull requests

1 participant