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

Distinct labels flagged as duplicate #2087

Closed
lhstrh opened this issue Nov 6, 2023 · 9 comments · Fixed by #2147
Closed

Distinct labels flagged as duplicate #2087

lhstrh opened this issue Nov 6, 2023 · 9 comments · Fixed by #2147
Assignees
Labels
bug Something isn't working

Comments

@lhstrh
Copy link
Member

lhstrh commented Nov 6, 2023

This bug has been found by @lsk567. The following code yields the error Duplicate AttrParm 'value':

reactor Source {
  output out: int
  timer t(1 nsec, 10 msec)
  state s: int = 0

  @label(value="Foo")
  reaction(startup) {= lf_print("Starting Source"); =}

  @label(value="Bar")
  reaction(t) -> out {=
    lf_set(out, self->s++);
    lf_print("Inside source reaction_0");
  =}
}

AFAIK, this should be equivalent to the following code, which does not yield errors:

reactor Source {
  output out: int
  timer t(1 nsec, 10 msec)
  state s: int = 0

  @label("Foo")
  reaction(startup) {= lf_print("Starting Source"); =}

  @label("Bar")
  reaction(t) -> out {=
    lf_set(out, self->s++);
    lf_print("Inside source reaction_0");
  =}
}

The problem appears to me that uniqueness checks are done at the level of the eContainer, and while the attributes are associated with the syntactic element they precede, which are different, they in the same container. There must be a way to override this behavior but I'm not sure how. Perhaps @a-sr knows?

@lhstrh lhstrh added the bug Something isn't working label Nov 6, 2023
@a-sr
Copy link
Collaborator

a-sr commented Nov 6, 2023

We already use an adjusted uniqueness validator for LF, so this would be the point of entry to fix this. The error is created by checkDescriptionForDuplicatedName (from NamesAreUniqueValidationHelper), so we need to override this method, but I have to take a closer look at how it works.

@lhstrh
Copy link
Member Author

lhstrh commented Nov 6, 2023

Ah, I was looking at that class but didn't understand which method we needed the override. Thanks!

@lhstrh
Copy link
Member Author

lhstrh commented Nov 6, 2023

I noticed that checkDescriptionForDuplicatedName is deprecated. Are you sure this is the method to override?

@a-sr
Copy link
Collaborator

a-sr commented Nov 7, 2023

Yes, I checked it with the debugger. Apparently, the fact that we use a costomized implementation leads us into the deprecated API but don't ask me why they implemented it like this.

@lhstrh
Copy link
Member Author

lhstrh commented Nov 7, 2023

The implementation looks a bit opaque to me. Would you know how to fix it?

@a-sr
Copy link
Collaborator

a-sr commented Nov 7, 2023

Not yet, I would have to take a closer look, but I can do that.

@a-sr a-sr self-assigned this Nov 7, 2023
@lhstrh
Copy link
Member Author

lhstrh commented Jan 6, 2024

@a-sr, have you been able to find out anything regarding this issue?

@a-sr
Copy link
Collaborator

a-sr commented Jan 8, 2024

It turns out to be a bit more tricky than I thought, but I am on it.

@a-sr a-sr mentioned this issue Jan 10, 2024
@a-sr
Copy link
Collaborator

a-sr commented Jan 10, 2024

It turned out easier than I thought, see #2147

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants