Nim/tests/types/tparameterizedparent4.nim

30 lines
510 B
Nim

discard """
file: "tparameterizedparent4.nim"
line: 23
errormsg: "redefinition of 'grain'"
"""
# bug #5264
type
Texture = enum
Smooth
Coarse
FruitBase = object of RootObj
color: int
grain: string
Apple[T] = object of T
width: int
tast_e: float64
case kind: Texture
of Smooth:
skin: float64
of Coarse:
grain: int
proc setColor(self: var FruitBase, c: int) =
self.color = c
var x = Apple[FruitBase](kind: Smooth, skin: 1.5)
x.setColor(14)
echo x