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

Fix nested choice when no struct/set present #169

Merged
merged 5 commits into from
Oct 10, 2023

Conversation

Nicceboy
Copy link
Contributor

@Nicceboy Nicceboy commented Oct 6, 2023

Fixes #168

@Nicceboy Nicceboy changed the title Draft: Fix nested choice when no struct/set present Fix nested choice when no struct/set present Oct 6, 2023
@Nicceboy
Copy link
Contributor Author

Nicceboy commented Oct 6, 2023

Build seems to fail for third party issue:

  = note: /usr/local/lib/gcc/x86_64-unknown-netbsd/9.4.0/../../../../x86_64-unknown-netbsd/bin/ld: cannot find -lexecinfo
          collect2: error: ld returned 1 exit status
          

error: could not compile `rasn-compiler` (bin "rasn-compiler") due to previous error
warning: build failed, waiting for other jobs to finish...
Error: Process completed with exit code 101.

@XAMPPRocky
Copy link
Collaborator

Thank you for your PR! I think the question I have is, is why is the variance wrong? If there's two variants, the variance should be two, not three. This PR solves this case, but doesn't really answer the root issue.

@Nicceboy
Copy link
Contributor Author

Nicceboy commented Oct 7, 2023

The variance is correct but the range for constraint is incorrectly set because index starts from zero (classic).

@XAMPPRocky
Copy link
Collaborator

Ah gotcha, would you be able to make this a function? Having - 1 peppered in the code is a bit of a smell as it's not obvious just by looking at it why, so it could be forgotten when the code is revisited.

@Nicceboy
Copy link
Contributor Author

Nicceboy commented Oct 8, 2023

I added separate variable declaration and some comments. Also debug asserts that variance length should be always greater than 0, which in theory should be always greater, but no other checks. (You cannot pass variant if enum does not have one...).
Would that be okay?

@XAMPPRocky
Copy link
Collaborator

Thank you for your PR!

@XAMPPRocky XAMPPRocky merged commit 6f4bf31 into librasn:main Oct 10, 2023
17 of 68 checks passed
@github-actions github-actions bot mentioned this pull request Oct 10, 2023
@Nicceboy Nicceboy deleted the fix-nested-choice branch October 20, 2023 18:19
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

Successfully merging this pull request may close these issues.

Nested choices not completly fixed on PER
2 participants