Implemented integer literal type promotion.

This follows the wording of the spec very closely (also visible in the
comments in the source code).