t12037.nim 821 B

1234567891011121314151617181920212223242526272829303132333435
  1. discard """
  2. cmd: '''nim c --gc:arc $file'''
  3. output: '''
  4. showing original type, length, and contents seq[int] 1 @[42]
  5. copy length and contents 1 @[42]
  6. '''
  7. """
  8. proc test() =
  9. var sq1 = @[42]
  10. echo "showing original type, length, and contents ", sq1.typeof, " ", sq1.len, " ", sq1
  11. doAssert cast[int](sq1[0].unsafeAddr) != 0
  12. var sq2 = sq1 # copy of original
  13. echo "copy length and contents ", sq2.len, " ", sq2
  14. doAssert cast[int](sq2[0].unsafeAddr) != 0
  15. doAssert cast[int](sq1[0].unsafeAddr) != 0
  16. test()
  17. #############################################
  18. ### bug 12820
  19. import tables
  20. var t = initTable[string, seq[ptr int]]()
  21. discard t.hasKeyOrPut("f1", @[])
  22. #############################################
  23. ### bug #12989
  24. proc bug(start: (seq[int], int)) =
  25. let (s, i) = start
  26. let input = @[0]
  27. bug((input, 0))