summary refs log tree commit diff stats
path: root/tests/concepts/t8558.nim
diff options
context:
space:
mode:
authorflywind <43030857+xflywind@users.noreply.github.com>2020-11-07 15:59:47 +0800
committerGitHub <noreply@github.com>2020-11-07 07:59:47 +0000
commit8f7a013cc7bf0a1f47aec8d5b2037951a36eb4f1 (patch)
treec5a424a9f4a1f0b1d18258a609a35a63fa99a05b /tests/concepts/t8558.nim
parent5828620d47b3100e30da280442946e02c5eca18d (diff)
downloadNim-8f7a013cc7bf0a1f47aec8d5b2037951a36eb4f1.tar.gz
close #8558(add testcase for #8558) (#15872)
Diffstat (limited to 'tests/concepts/t8558.nim')
-rw-r--r--tests/concepts/t8558.nim26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/concepts/t8558.nim b/tests/concepts/t8558.nim
new file mode 100644
index 000000000..acb2de30e
--- /dev/null
+++ b/tests/concepts/t8558.nim
@@ -0,0 +1,26 @@
+discard """
+  output: '''10
+9
+8
+7
+6
+5
+4
+3
+2
+1
+go!
+'''
+"""
+
+type Integral = concept x
+  x == 0 is bool
+  x - 1 is type(x)
+
+proc countToZero(n: Integral) =
+  if n == 0: echo "go!"
+  else:
+    echo n
+    countToZero(n-1)
+
+countToZero(10)
\ No newline at end of file