enigma-dev/enigma-dev — pull request #612 by sorlok (2014-01-14 02:53:17+00:00)
Title: Bugfix: += and related operators now properly "hint" the type.

This fixes the following Issue:
https://github.com/enigma-dev/enigma-dev/issues/609

The motivation for this pull request is that, given "var x;" with no further initialization, the following statements have different effects:
```
x = x + 1; //x is a "real" of value "1".
x += 1; //x is a "-1" (type unknown) of value "1".
```

Note that the "variant" class actually treats "x += 1" as a real-valued addition, but the type is lost. Thus, "+=" and "= .. +" have different behavior.

This pull request fixes that, by "hinting" the type on +=, -=, and other self-setting operators when combined with a "real" type on the RHS (and, in the case of +=, a string). It does NOT overwrite the type if it is known; it only changes it if the type is unknown. I feel that this is reasonable, as it conforms to the way that "= ... +" resolves and doesn't affect any script that initializes its variables anyway.

Note that I did *not* change "var += var", since it is not clear to me how often this niche comes up in practice.

This fixes a bug in Iji save-file checksum calculation.