File: tmust_compile.nim

package info (click to toggle)
nim 0.19.4-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 462,356 kB
  • sloc: sh: 11,089; ansic: 4,699; makefile: 706; python: 309; sql: 297; asm: 141; xml: 13
file content (65 lines) | stat: -rw-r--r-- 914 bytes parent folder | download | duplicates (4)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
discard """
  output: '''success'''
"""

# bug #6682
{.experimental: "notnil".}

type
    Fields = enum
        A=1, B, C

    Obj = object
        fld: array[Fields, int]

    AsGeneric[T] = array[Fields, T]
    Obj2[T] = object
      fld: AsGeneric[T]

var a: Obj # this works

var arr: array[Fields, int]

var b = Obj() # this doesn't (also doesn't works with additional fields)

var z = Obj2[int]()

echo "success"

# bug #6555

import tables

type
  TaskOrNil = ref object
  Task = TaskOrNil not nil

let table = newTable[string, Task]()
table.del("task")

# bug #6121

import json

type

  foo = object
    thing: ptr int not nil

  CTS = ref object
    subs_by_sid: Table[int, foo]


proc parse(cts: CTS, jn: JsonNode) =
  var y = jn.getInt(4523)
  let ces = foo(
    thing: addr y
  )

  cts.subs_by_sid[0] = ces


# bug #6489

proc p(x: proc(){.closure.} not nil) = discard
p(proc(){.closure.} = discard)