Commit Graph

6 Commits

Author SHA1 Message Date
whitequark d6eb2b023a compiler: monomorphize casts first, but more carefully.
This reverts 425cd7851, which broke the use of casts to define
integer width.

Instead of it, two steps are taken:
  * First, literals are monomorphized, leading to predictable result.
  * Second, casts are monomorphized, in a top-bottom way. I.e.
    consider the expression `int64(round(x))`. If round() was visited
    first, the intermediate precision would be 32-bit, which is
    clearly undesirable. Therefore, contextual rules should take
    priority over non-contextual ones.

Fixes #1252.
2019-02-07 06:24:32 +00:00
whitequark 425cd7851e compiler: first monomorphize ints, then casts.
Fixes #1242.
2019-01-12 13:40:12 +00:00
whitequark f68e4ae519 compiler: rein in overzealous cast monomorphization. 2016-12-05 05:08:57 +00:00
whitequark 218720cfa7 Revert "compiler: rein in overzealous cast monomorphization."
This reverts commit 4305903dde.

This broke the monomorphizer/round.py test.
2016-12-05 05:04:26 +00:00
whitequark 4305903dde compiler: rein in overzealous cast monomorphization.
This caused failures on e.g. "int32(var64a >> var64b)", where
the type of the argument is already fully known, but was unified
with the result of the cast anyway.
2016-12-05 04:38:25 +00:00
whitequark 68de724554 compiler: monomorphize int64(round(x)) to not lose precision.
This applies to any expression with an indeterminate integer type
cast to int64(), not just round().
2016-12-02 15:02:44 +00:00