tproveinit.nim 409 B

12345678910111213141516171819
  1. discard """
  2. joinable: false
  3. """
  4. {.warningAsError[ProveInit]:on.}
  5. template main() =
  6. proc fn(): var int =
  7. discard
  8. discard fn()
  9. doAssert not compiles(main())
  10. # bug #9901
  11. import std/[sequtils, times]
  12. proc parseMyDates(line: string): DateTime =
  13. result = parse(line, "yyyy-MM-dd")
  14. var dateStrings = @["2018-12-01", "2018-12-02", "2018-12-03"]
  15. var parsed = dateStrings.map(parseMyDates)
  16. discard parsed