diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2017-11-01 15:33:20 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2017-11-01 15:33:28 +0100 |
commit | 286f89528028fc3ae9e441a18be2be11cf499174 (patch) | |
tree | a80b1ab92cc5090f5f3ef3206f3ecd93b085139d /tests | |
parent | 6f9cd35733211d04ba9ba6e7b7a5d32e5f3e5299 (diff) | |
download | Nim-286f89528028fc3ae9e441a18be2be11cf499174.tar.gz |
make range type checking more restrictive, see tn8vsint16 test case; minor breaking change
Diffstat (limited to 'tests')
-rw-r--r-- | tests/range/tn8vsint16.nim | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/range/tn8vsint16.nim b/tests/range/tn8vsint16.nim new file mode 100644 index 000000000..612b6d0e7 --- /dev/null +++ b/tests/range/tn8vsint16.nim @@ -0,0 +1,18 @@ +discard """ + output: '''9''' +""" + +type + n32 = range[0..high(int)] + n8* = range[0'i8..high(int8)] + +proc `+`*(a: n32, b: n32{nkIntLit}): n32 = discard + +proc `-`*(a: n8, b: n8): n8 = n8(system.`-`(a, b)) + +var x, y: n8 +var z: int16 + +# ensure this doesn't call our '-' but system.`-` for int16: +echo z - n8(9) + |