summary refs log tree commit diff stats
path: root/tests/concepts/tcomparable.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/concepts/tcomparable.nim')
-rw-r--r--tests/concepts/tcomparable.nim13
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
+