summary refs log tree commit diff stats
path: root/tests/arc/t17812.nim
blob: dd8ac89b07fa6d60d1de23955110513ec315cca8 (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
37
38
39
40
41
discard """
  targets: "c js"
  matrix: "--gc:refc; --gc:arc"
"""

import std/times

block: # bug #17812
  block:
    type
      Task = object
        cb: proc ()

    proc hello() = discard


    let t = Task(cb: hello)

    doAssert t.repr.len > 0


  block:
    type MyObj = object
      field: DateTime


    proc `$`(o: MyObj): string = o.repr

    doAssert ($MyObj()).len > 0

# bug #22175

type Xxx = object
  value: string

proc complete(xxx: ref Xxx, v: sink string) =
  xxx.value = move(v)

let yyy = (ref Xxx)()

yyy.complete("test")