diff options
author | Oscar NihlgÄrd <oscarnihlgard@gmail.com> | 2019-05-10 11:10:11 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2019-05-10 11:10:11 +0200 |
commit | de5c0d3aa9fd713a698f7f596c9bf925d00729c2 (patch) | |
tree | d08841d1d4e5184fd997202b4f83c1ec05bb31b3 /tests/misc | |
parent | 3a479ff53f04b1d42243f4c76a0ac0414ffd0277 (diff) | |
download | Nim-de5c0d3aa9fd713a698f7f596c9bf925d00729c2.tar.gz |
Make range checks in semConv (#7164)
* Remove NaN/Inf/NegInf magic * Make range checks in semConv * fix the failing line * fix `firstOrd` and `lastOrd` * fix `localError` * remove debug comment * Cleanup, fix failing test * make tests green
Diffstat (limited to 'tests/misc')
-rw-r--r-- | tests/misc/tconv.nim | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/misc/tconv.nim b/tests/misc/tconv.nim new file mode 100644 index 000000000..2384c3e9d --- /dev/null +++ b/tests/misc/tconv.nim @@ -0,0 +1,43 @@ +template reject(x) = + static: assert(not compiles(x)) + +reject: + const x = int8(300) + +reject: + const x = int64(NaN) + +type + R = range[0..10] + +reject: + const x = R(11) + +reject: + const x = R(11.0) + +reject: + const x = R(NaN) + +reject: + const x = R(Inf) + +type + FloatRange = range[0'f..10'f] + +reject: + const x = FloatRange(-1'f) + +reject: + const x = FloatRange(-1) + +reject: + const x = FloatRange(NaN) + +block: + const x = float32(NaN) + +type E = enum a, b, c + +reject: + const e = E(4) |