tparameterizedparent4.nim 515 B

12345678910111213141516171819202122232425262728293031
  1. discard """
  2. file: "tparameterizedparent4.nim"
  3. line: 23
  4. errormsg: "attempt to redefine: 'grain'"
  5. """
  6. # bug #5264
  7. type
  8. Texture = enum
  9. Smooth
  10. Coarse
  11. FruitBase = object of RootObj
  12. color: int
  13. grain: string
  14. Apple[T] = object of T
  15. width: int
  16. tast_e: float64
  17. case kind: Texture
  18. of Smooth:
  19. skin: float64
  20. of Coarse:
  21. grain: int
  22. proc setColor(self: var FruitBase, c: int) =
  23. self.color = c
  24. var x = Apple[FruitBase](kind: Smooth, skin: 1.5)
  25. x.setColor(14)
  26. echo x