summary refs log tree commit diff stats
path: root/tests/converter
diff options
context:
space:
mode:
authorflywind <43030857+xflywind@users.noreply.github.com>2020-10-30 16:57:02 +0800
committerGitHub <noreply@github.com>2020-10-30 09:57:02 +0100
commit1655c04aa3b980bf0a9d65bf658c19efa6af7d94 (patch)
treef9980f220bd005b1dc982a582211976d62c82a65 /tests/converter
parentc274d9aed637af05f7acf553edb57721bd91d021 (diff)
downloadNim-1655c04aa3b980bf0a9d65bf658c19efa6af7d94.tar.gz
add testcase for #9165 (#15787)
Diffstat (limited to 'tests/converter')
-rw-r--r--tests/converter/t9165.nim11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/converter/t9165.nim b/tests/converter/t9165.nim
new file mode 100644
index 000000000..d0225ffbc
--- /dev/null
+++ b/tests/converter/t9165.nim
@@ -0,0 +1,11 @@
+type ustring = distinct string
+
+converter toUString(s: string): ustring = ustring(s)
+converter toString(s: ustring): string = string(s)
+
+proc `[]=`*(s: var ustring, slice: Slice[int], replacement: ustring) {.inline.} =
+  s = replacement
+
+var s = ustring("123")
+s[1..2] = "3"
+doAssert s == "3"
\ No newline at end of file