summary refs log tree commit diff stats
path: root/tests/distinct
diff options
context:
space:
mode:
authorJason Beetham <beefers331@gmail.com>2021-09-07 09:11:08 -0600
committerGitHub <noreply@github.com>2021-09-07 17:11:08 +0200
commitee2eb5cae2585c5cd0a476814bd5879c130e5d30 (patch)
treebec1b50ea11881c0db48f683f3d3ad66175b77eb /tests/distinct
parent30d28bcefcad0da8900cfa231be9d77bb98c5097 (diff)
downloadNim-ee2eb5cae2585c5cd0a476814bd5879c130e5d30.tar.gz
Fix subranges of distinct types (#18816) [backport]
Diffstat (limited to 'tests/distinct')
-rw-r--r--tests/distinct/tdistinct.nim14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/distinct/tdistinct.nim b/tests/distinct/tdistinct.nim
index 876975a7c..fd60b4ac0 100644
--- a/tests/distinct/tdistinct.nim
+++ b/tests/distinct/tdistinct.nim
@@ -167,6 +167,20 @@ template main() =
         s.Foo.add('c')
         doAssert s.string == "c" # was failing
       test()
+    block: #18061
+      type
+        A = distinct (0..100)
+        B = A(0) .. A(10)
+      proc test(b: B) = discard
+      let
+        a = A(10)
+        b = B(a)
+      test(b)
+
+      proc test(a: A) = discard
+      discard cast[B](A(1))
+      var c: B
+
 
 static: main()
 main()