'isolate' builtin; refs https://github.com/nim-lang/RFCs/issues/244 (#15011)
This commit is contained in:
parent
bb1adf6a70
commit
71dd5f85b9
9 changed files with 194 additions and 6 deletions
36
tests/isolate/tisolate.nim
Normal file
36
tests/isolate/tisolate.nim
Normal file
|
|
@ -0,0 +1,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()
|
||||
Loading…
Add table
Add a link
Reference in a new issue