summary refs log tree commit diff stats
path: root/tests/lookups
diff options
context:
space:
mode:
authorRyan McConnell <rammcconnell@gmail.com>2024-01-06 05:50:09 +0000
committerGitHub <noreply@github.com>2024-01-06 06:50:09 +0100
commita4f3bf374238df96f0982b7106e3702da6b485b1 (patch)
tree65b803a89211ffefcf0dc4d0cbfa3842e79f3581 /tests/lookups
parent3dee1a3e4c81448b67b75068fef06a121f320758 (diff)
downloadNim-a4f3bf374238df96f0982b7106e3702da6b485b1.tar.gz
Fixes #23172 (#23173)
#23172
Diffstat (limited to 'tests/lookups')
-rw-r--r--tests/lookups/issue_23172/m23172.nim6
-rw-r--r--tests/lookups/t23172.nim9
2 files changed, 15 insertions, 0 deletions
diff --git a/tests/lookups/issue_23172/m23172.nim b/tests/lookups/issue_23172/m23172.nim
new file mode 100644
index 000000000..36af48761
--- /dev/null
+++ b/tests/lookups/issue_23172/m23172.nim
@@ -0,0 +1,6 @@
+type
+  Foo* = object
+  Bar* = object
+
+func `$`*(x: Foo | Bar): string =
+  "X"
diff --git a/tests/lookups/t23172.nim b/tests/lookups/t23172.nim
new file mode 100644
index 000000000..9edf9905a
--- /dev/null
+++ b/tests/lookups/t23172.nim
@@ -0,0 +1,9 @@
+import issue_23172/m23172
+
+type FooX = distinct Foo
+
+func `$`*(x: FooX): string =
+  $m23172.Foo(x)
+
+var a: FooX
+doAssert $a == "X"