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

Trying to match to a typedef value in a receive statement causes "bad node type 44" error message #17

Closed
tgonzalez89 opened this issue Dec 10, 2019 · 9 comments

Comments

@tgonzalez89
Copy link

tgonzalez89 commented Dec 10, 2019

When I try to match a message in a receive statement I get a "bad node type 44" error message. This happens when the message's type is a typedef. The error message is rather cryptic and doesn't give much insight. I would like to know if this is a bug or the intended behavior. I don't think the documentation mentions anything related to the restriction of using struct types for doing matching in receive statements.

Code example:

typedef t {
    int i
}
init {
    chan c = [1] of {t}
    t x;
    !(c ?? [eval(x)]) // <--- ERROR
}

Link to StackOverflow question here.

@nimble-code
Copy link
Owner

that's a bug -- i'll check it out and find a fix if i can

@nimble-code
Copy link
Owner

fixed with update to pangen2.c and pangen4.c
not entirely sure that the fix covers all cases, but it does work for the example code and a few small variations of it

@tgonzalez89
Copy link
Author

Thank you. The issue seems to be fixed.

@tgonzalez89
Copy link
Author

tgonzalez89 commented Dec 11, 2019

I played around with the fixed code and in some cases where the struct type is more complex there seems to be some issues. I attached two examples. In complex_id.pml I see the following error: "invalid end state". In test.pml I see this other error: "missing pars in receive". I think both files should pass the simulation. Should I open a new issue or can this one be reused/reopened? I think there might be some issues when there are more than one eval()'s that evaluate a typedef variable in the receive statements and/or when the typedef is composed of other typedefs.

testcases.zip

@nimble-code
Copy link
Owner

made a further update -- 6 files changed -- that should now cover all cases.
i don't think the invalid endstate is in error, but let me know if that's not the case

@tgonzalez89
Copy link
Author

Hmm... I still see the same issues. I simplified test.pml even further. The asserts here should pass but they are failing: pan:1: assertion violated Q_has(c, 1, receiver_id.t2.t1a.i, 1, sender_id1.t2.t1a.i, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
test.txt

@nimble-code
Copy link
Owner

agreed -- good example -- that'll take some more checking

@nimble-code
Copy link
Owner

i have a fix -- will update once i've tested it a little more

@nimble-code
Copy link
Owner

fix uploaded -- 7 files changed -- this now passes the test.txt example and everything else I could think of. fingers crossed....

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

No branches or pull requests

2 participants