diff options
author | Jason Beetham <beefers331@gmail.com> | 2021-10-26 03:27:11 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-26 11:27:11 +0200 |
commit | 83a2515af7aeb9a1c12015321243399a0d1f4c95 (patch) | |
tree | c660cd8c910c3e4687a08cf9e63828365f695b1f /tests/distinct/tdistinct.nim | |
parent | 3ecb369ca1a12754486429bda4ab0bc60f9b86d7 (diff) | |
download | Nim-83a2515af7aeb9a1c12015321243399a0d1f4c95.tar.gz |
Fixed generic distinct conversions for 'var' (#18837)
* SameTypeAux now properly traverses generic distincts * Smarter traversal of distincts * Removed redundant check * Fixed nkConv for jsgen * Added test for non distinct nkConv * using skiptypes for distinct now * Fixed genaddr for nkconv
Diffstat (limited to 'tests/distinct/tdistinct.nim')
-rw-r--r-- | tests/distinct/tdistinct.nim | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/distinct/tdistinct.nim b/tests/distinct/tdistinct.nim index fd60b4ac0..dd8237854 100644 --- a/tests/distinct/tdistinct.nim +++ b/tests/distinct/tdistinct.nim @@ -8,6 +8,7 @@ false false false Foo +foo ''' """ @@ -140,6 +141,22 @@ block tRequiresInit: let s = "test" doAssert s == "test" +block: #17322 + type + A[T] = distinct string + + proc foo(a: var A) = + a.string.add "foo" + + type + B = distinct A[int] + + var b: B + foo(A[int](b)) + echo A[int](b).string + b.string.add "bar" + assert b.string == "foobar" + type Foo = distinct string template main() = |