tisolate.nim 669 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. discard """
  2. errormsg: "expression cannot be isolated: select(a, b)"
  3. line: 39
  4. """
  5. import std / isolation
  6. import json, streams
  7. proc myParseJson(s: Stream; filename: string): JsonNode =
  8. {.cast(noSideEffect).}:
  9. result = parseJson(s, filename)
  10. proc f(): seq[int] =
  11. @[1, 2, 3]
  12. type
  13. Node = ref object
  14. x: string
  15. proc g(): Node = nil
  16. proc select(a, b: Node): Node =
  17. a
  18. proc main =
  19. discard isolate f()
  20. discard isolate g()
  21. discard isolate select(Node(x: "a"), nil)
  22. discard isolate select(Node(x: "a"), Node(x: "b"))
  23. discard isolate myParseJson(newFileStream("my.json"), "my.json")
  24. var a, b: Node
  25. discard isolate select(a, b)
  26. main()