Destructors: move into nkTupleConstr and move on tuple unpacking (#9776)
This commit is contained in:
parent
f8fa94cb20
commit
962b2e4b39
3 changed files with 96 additions and 9 deletions
|
|
@ -1,21 +1,26 @@
|
|||
discard """
|
||||
exitcode: 0
|
||||
output: '''assingment
|
||||
assingment
|
||||
assingment
|
||||
assingment
|
||||
'''
|
||||
output: ""
|
||||
"""
|
||||
|
||||
type
|
||||
Foo* = object
|
||||
boo: int
|
||||
|
||||
var sink_counter = 0
|
||||
var assign_counter = 0
|
||||
|
||||
proc `=sink`(dest: var Foo, src: Foo) =
|
||||
sink_counter.inc
|
||||
|
||||
proc `=`(dest: var Foo, src: Foo) =
|
||||
debugEcho "assingment"
|
||||
assign_counter.inc
|
||||
|
||||
proc test(): auto =
|
||||
var a,b : Foo
|
||||
return (a, b)
|
||||
return (a, b, Foo(boo: 5))
|
||||
|
||||
var (a, b) = test()
|
||||
var (a, b, _) = test()
|
||||
|
||||
doAssert: assign_counter == 0
|
||||
doAssert: sink_counter == 9
|
||||
Loading…
Add table
Add a link
Reference in a new issue