summary refs log tree commit diff stats
path: root/tests/distinct
diff options
context:
space:
mode:
authorjcosborn <jcosborn@users.noreply.github.com>2018-10-09 06:34:03 -0500
committerAndreas Rumpf <rumpf_a@web.de>2018-10-09 13:34:03 +0200
commitdd659867955d87affde0b6271cc9bf86208462dc (patch)
treeb2317e1ded202fd13eab262a5ceff096cd7aa4d3 /tests/distinct
parentb90b45b01bba1f3fc241a96abd4ae5c8c314bb92 (diff)
downloadNim-dd659867955d87affde0b6271cc9bf86208462dc.tar.gz
fixes #4435 (#9185)
Diffstat (limited to 'tests/distinct')
-rw-r--r--tests/distinct/t4435.nim21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/distinct/t4435.nim b/tests/distinct/t4435.nim
new file mode 100644
index 000000000..4d9979fab
--- /dev/null
+++ b/tests/distinct/t4435.nim
@@ -0,0 +1,21 @@
+discard """
+  output: '''
+A
+A
+'''
+"""
+
+type
+  A[T] = distinct T
+  B[T] = distinct T
+
+proc foo[T](x:A[T]) = echo "A"
+proc foo[T](x:B[T]) = echo "B"
+proc bar(x:A) = echo "A"
+proc bar(x:B) = echo "B"
+
+var
+  a:A[int]
+
+foo(a) # fine
+bar(a) # testdistinct.nim(14, 4) Error: ambiguous call; both testdistinct.bar(x: A) and testdistinct.bar(x: B) match for: (A[system.int])