Skip to content

Conversation

@AtomCrafty
Copy link
Contributor

@AtomCrafty AtomCrafty commented Dec 1, 2023

No description provided.

@AtomCrafty AtomCrafty marked this pull request as draft December 1, 2023 15:29
@AtomCrafty
Copy link
Contributor Author

AtomCrafty commented Dec 1, 2023

Looks like that broke things during elaboration since the expression analysis hasn't happened yet at that point. It looks to me like that is a more general issue with how the elaboration works, so I'll need to investigate that further.

.expectError(IssueCodes.InvalidIsaStateElementValue, 1)
.expectError(IssueCodes.UnsupportedSizeOfDuringElaboration, 3)
.expectError(IssueCodes.UnsupportedSizeOfDuringElaboration, 4)
.run();
Copy link
Contributor Author

@AtomCrafty AtomCrafty Dec 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please note this test. The way type analysis works, sizeof(255+1) (=9) is not able to be used in elaboration-time constants. This is because the types of expressions are only determined during analysis, which happens after elaboration. If we wanted to support this case we'd have to do full type analysis during elaboration, which would require a major restructuring of the analysis framework.

The constant expression evaluator has special handling of sizeof(<type>) and sizeof(<identifier>), so those can still be used, but expressions using any operator are unsupported.

@AtomCrafty AtomCrafty marked this pull request as ready for review December 3, 2023 13:46
@AtomCrafty AtomCrafty requested a review from eyck December 3, 2023 16:56
@eyck eyck merged commit 0cf2a39 into Minres:develop Feb 4, 2024
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.

2 participants