tresult_of_array.nim 584 B

123456789101112131415161718192021222324252627282930
  1. discard """
  2. output: '''false
  3. true
  4. false
  5. [false, false, false]
  6. '''
  7. """
  8. # bug #7332
  9. # resetLoc generate incorrect memset code
  10. # because of array passed as argument decaying into a pointer
  11. import tables
  12. const tableOfArray = {
  13. "one": [true, false, false],
  14. "two": [false, true, false],
  15. "three": [false, false, true]
  16. }.toTable()
  17. for i in 0..2:
  18. echo tableOfArray["two"][i]
  19. var seqOfArray = @[
  20. [true, false, false],
  21. [false, true, false],
  22. [false, false, true]
  23. ]
  24. proc crashingProc*[B](t: seq[B], index: Natural): B =
  25. discard
  26. echo seqOfArray.crashingProc(0)