Skip to content

Relax assignment rules for constant RHS #75

@jopperm

Description

@jopperm

@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> 

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentationenhancementNew feature or request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions