File: t12037.nim

package info (click to toggle)
nim 2.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,911,644 kB
  • sloc: sh: 24,603; ansic: 1,761; python: 1,492; makefile: 1,013; sql: 298; asm: 141; xml: 13
file content (34 lines) | stat: -rw-r--r-- 803 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
discard """
  cmd: '''nim c --gc:arc $file'''
  output: '''
showing original type, length, and contents seq[int] 1 @[42]
copy length and contents 1 @[42]
'''
"""

proc test() =
  var sq1 = @[42]
  echo "showing original type, length, and contents ", sq1.typeof, " ", sq1.len, " ", sq1
  doAssert cast[int](sq1[0].addr) != 0
  var sq2 = sq1 # copy of original
  echo "copy length and contents ", sq2.len, " ", sq2
  doAssert cast[int](sq2[0].addr) != 0
  doAssert cast[int](sq1[0].addr) != 0

test()


#############################################
### bug 12820
import tables
var t = initTable[string, seq[ptr int]]()
discard t.hasKeyOrPut("f1", @[])


#############################################
### bug #12989
proc bug(start: (seq[int], int)) =
  let (s, i) = start

let input = @[0]
bug((input, 0))