parent
976095c894
commit
0ff1190fe7
6 changed files with 184 additions and 2 deletions
30
tests/types/tparameterizedparent4.nim
Normal file
30
tests/types/tparameterizedparent4.nim
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue