1discard """ 2output: ''' 3@[(v: -1), (v: 2), (v: 3)] 4@[(v: -1), (v: 2), (v: 3)] 5[(v: -1), (v: 2), (v: 3)] 6[(v: -1), (v: 2), (v: 3)] 7((v: -1), (v: 2), (v: 3)) 8((v: -1), (v: 2), (v: 3)) 9@[(v: -1), (v: 2), (v: 3)] 10@[(v: -1), (v: 2), (v: 3)] 11@[(v: -1), (v: 2), (v: 3)] 12''' 13""" 14 15type mytype* = object 16 v:int 17 18proc f*(x:ptr mytype) = x.v = -1 19 20func g(x:int):mytype = mytype(v:x) 21 22 23import xseq9578 24block: 25 var x = @[1.g,2.g,3.g] 26 testSeq(x) 27 echo x 28block: 29 var x = @[1.g,2.g,3.g] 30 var y = addr x 31 testSeq2(y) 32 echo x 33 34 35import xarray9578 36block: 37 var x = [1.g,2.g,3.g] 38 testArray(x) 39 echo x 40block: 41 var x = [1.g,2.g,3.g] 42 var y = addr x 43 testArray2(y) 44 echo x 45 46 47import xtuple9578 48block: 49 var x = (1.g,2.g,3.g) 50 testTuple(x) 51 echo x 52block: 53 var x = (1.g,2.g,3.g) 54 var y = addr x 55 testTuple2(y) 56 echo x 57 58 59import xoa9578 60block: 61 var x = @[1.g,2.g,3.g] 62 testOpenArray(x) 63 echo x 64 65 66import xua9578 67block: 68 var x = @[1.g,2.g,3.g] 69 var y = cast[ptr UncheckedArray[mytype]](addr x[0]) 70 testUncheckedArray(y[]) 71 echo x 72block: 73 var x = @[1.g,2.g,3.g] 74 var y = cast[ptr UncheckedArray[mytype]](addr x[0]) 75 testUncheckedArray2(y) 76 echo x 77