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

Relax assignment rules for constant RHS #75

Open
jopperm opened this issue Nov 17, 2022 · 2 comments
Open

Relax assignment rules for constant RHS #75

jopperm opened this issue Nov 17, 2022 · 2 comments
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Milestone

Comments

@jopperm
Copy link
Contributor

jopperm commented Nov 17, 2022

@AtomCrafty suggested in #29:

What about if we instead calculate all expressions in the same manner, but allow assignments where the assigned value is a constant that fits into the assignment target, even if the static type of the expression is larger?

This would be in line with the other casting rules: A narrowing cast, but with the guarantee that no precision is lost. Comes in handy in certain edge cases, e.g. the following probably should be valid but isn't right now:

signed<4> x = -8; // UnaryMinus(IntLiteral(8) : unsigned<4>) : signed<5> 
@jopperm jopperm added documentation Improvements or additions to documentation enhancement New feature or request labels Nov 17, 2022
@jopperm jopperm added this to the CoreDSL 2.1 (202x) milestone Nov 17, 2022
@AtomCrafty AtomCrafty self-assigned this Jun 21, 2023
@AtomCrafty
Copy link
Contributor

@eyck we should make a decision on this.

@eyck
Copy link
Contributor

eyck commented Dec 31, 2023

I don't see an issue with this so it should be implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants