summary refs log tree commit diff stats
path: root/tests/isolate/tisolate.nim
blob: 9f3b1544122744800a449c2c0d75e994392781ac (plain) (blame)
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
35
36
discard """
  errormsg: "expression cannot be isolated: select(a, b)"
  line: 34
"""

import std / isolation

import json, streams

proc f(): seq[int] =
  @[1, 2, 3]

type
  Node = ref object
    x: string

proc g(): Node = nil

proc select(a, b: Node): Node =
  a

proc main =
  discard isolate f()


  discard isolate g()

  discard isolate select(Node(x: "a"), nil)
  discard isolate select(Node(x: "a"), Node(x: "b"))

  discard isolate parseJson(newFileStream("my.json"), "my.json")

  var a, b: Node
  discard isolate select(a, b)

main()