t18125_1.nim 274 B

123456789101112131415
  1. # issue #18125 solved with type inference
  2. type
  3. Parent = ref object of RootObj
  4. Child = ref object of Parent
  5. c: char
  6. func foo(c: char): (Parent, int) =
  7. # Works if you use (Parent(Child(c: c)), 0)
  8. (Child(c: c), 0)
  9. let x = foo('x')[0]
  10. doAssert Child(x).c == 'x'