diff options
author | Ryan McConnell <rammcconnell@gmail.com> | 2024-07-22 01:13:43 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-22 07:13:43 +0200 |
commit | 7b50d05d6be3662431e990b707379bac6f100821 (patch) | |
tree | afdd3c212ec6949e10fb3325b07158df18b44b98 /tests/proc | |
parent | 2d2a7f23471270392baf64855ae205c287888e7d (diff) | |
download | Nim-7b50d05d6be3662431e990b707379bac6f100821.tar.gz |
fixes #23869; sink generic typeclass (#23874)
Still have to look this over some. We'll see. I put sink in this branch simply because I saw `tyVar` there and for no other reason. In any case the problem appears to be coming from `liftParamType` as it removes the `sink` type from the formals. #23869
Diffstat (limited to 'tests/proc')
-rw-r--r-- | tests/proc/t23874.nim | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/proc/t23874.nim b/tests/proc/t23874.nim new file mode 100644 index 000000000..940bc4ac8 --- /dev/null +++ b/tests/proc/t23874.nim @@ -0,0 +1,26 @@ +block: + type Head[T] = object + wasc: bool + + proc `=destroy`[T](x: var Head[T]) = + discard + + proc `=copy`[T](x: var Head[T], y: Head[T]) = + x.wasc = true + + proc `=dup`[T](x: Head[T]): Head[T] = + result.wasc = true + + proc update(h: var Head) = + discard + + proc digest(h: sink Head) = + assert h.wasc + + var h = Head[int](wasc: false) + h.digest() # sink h + h.update() # use after sink + +block: + proc two(a: sink auto) =discard + assert typeof(two[int]) is proc(a: sink int) {.nimcall.} |