fixes #3195
This commit is contained in:
parent
d7a472743b
commit
a92f3bead3
1 changed files with 24 additions and 2 deletions
|
|
@ -1,8 +1,9 @@
|
|||
discard """
|
||||
output: '''(name: hello)'''
|
||||
output: '''(name: hello)
|
||||
(-1, 0)'''
|
||||
"""
|
||||
|
||||
# bug #2774
|
||||
# bug #2774, bug #3195
|
||||
|
||||
type Foo = object
|
||||
name: string
|
||||
|
|
@ -12,3 +13,24 @@ const fooArray = [
|
|||
]
|
||||
|
||||
echo fooArray[0]
|
||||
|
||||
|
||||
type
|
||||
Position = object
|
||||
x, y: int
|
||||
|
||||
proc `$`(pos: Position): string =
|
||||
result = "(" & $pos.x & ", " & $pos.y & ")"
|
||||
|
||||
proc newPos(x, y: int): Position =
|
||||
result = Position(x: x, y: y)
|
||||
|
||||
const
|
||||
offset: array[1..4, Position] = [
|
||||
newPos(-1, 0),
|
||||
newPos(1, 0),
|
||||
newPos(0, -1),
|
||||
newPos(0, 1)
|
||||
]
|
||||
|
||||
echo offset[1]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue