Minres / CoreDSL

Xtext project to parse CoreDSL files
Apache License 2.0
16 stars 3 forks source link

Unary minus operator's type rule is wrong #74

Closed jopperm closed 1 year ago

jopperm commented 1 year ago

Realized this while pondering over #29: Applying the - operator to a signed value must also add an extra bit.

Example:

signed<3> x = 1;
x = x << 2; // x is now 3'b100 a.k.a -4
x = -x; // currently ok, but actually 4 doesn't fit into signed<3> 💥
jopperm commented 1 year ago

Done (diff). @AtomCrafty please consider this while working on #73.