diff options
author | Zahary Karadjov <zahary@gmail.com> | 2017-10-07 21:49:11 +0300 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2017-12-21 11:04:05 +0100 |
commit | 70380882c54a6eea08c715b015399673b55e9bc0 (patch) | |
tree | dab050442b9ad7073e6d3a65df5ea726590ff07e /tests/concepts | |
parent | 765116d54736c4d0ad50e1cf222c325f7d8a4d1c (diff) | |
download | Nim-70380882c54a6eea08c715b015399673b55e9bc0.tar.gz |
fix #6108
Diffstat (limited to 'tests/concepts')
-rw-r--r-- | tests/concepts/tcomparable.nim | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/concepts/tcomparable.nim b/tests/concepts/tcomparable.nim new file mode 100644 index 000000000..06612a47e --- /dev/null +++ b/tests/concepts/tcomparable.nim @@ -0,0 +1,13 @@ +type + Comparable = concept a + (a < a) is bool + +proc myMax(a, b: Comparable): Comparable = + if a < b: + return b + else: + return a + +doAssert myMax(5, 10) == 10 +doAssert myMax(31.3, 1.23124) == 31.3 + |