summary refs log tree commit diff stats
path: root/tests/template/twrongopensymchoice.nim
blob: 5a02a813cd44f2e63b910238270271710cf9a3f8 (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
discard """
  output: '''10'''
"""

# bug #940

type 
  Foo* = ref object 
    b*: int

proc new*(this: var Foo) = 
  assert this != nil
  this.b = 10

proc new*(T: typedesc[Foo]): Foo =
  system.new(result)
  twrongopensymchoice.new(result)

proc main =
  var f = Foo.new()
  echo f.b

when isMainModule:
  main()