Skip to content

Commit

Permalink
tests: add a test for the sink issue
Browse files Browse the repository at this point in the history
  • Loading branch information
zerbina committed Aug 13, 2024
1 parent 30cc438 commit ec5ca7a
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/lang_types/tuples/tsink_generic_tuple_assignment.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
discard """
description: '''
Regression test for a bug where assigning a ``sink`` generic tuple type
to a variable of non-``sink`` type led to the value being shallow copied.
'''
matrix: "--showir:mir_in:test --hints:off"
nimout: '''
-- MIR: test
scope:
def x: sink Tuple[system.int]
def v: Tuple[system.int]
v = sink x
-- end
'''
"""

type Tuple[T] = (T, T)

proc test(x: sink Tuple[int]) =
var v: Tuple[int]
v = x # this assignment was considered to involve a conversion

test default(Tuple[int])

0 comments on commit ec5ca7a

Please sign in to comment.