parent
58f79e7c3e
commit
841d9d5975
1 changed files with 12 additions and 0 deletions
|
|
@ -107,6 +107,18 @@ template main() =
|
||||||
return (x,y)
|
return (x,y)
|
||||||
doAssert bar() == (10, (11,))
|
doAssert bar() == (10, (11,))
|
||||||
|
|
||||||
|
block: # bug #16331
|
||||||
|
type T1 = tuple[a, b: int]
|
||||||
|
|
||||||
|
proc p(b: bool): T1 =
|
||||||
|
var x: T1 = (10, 20)
|
||||||
|
x = if b: (x.b, x.a) else: (-x.b, -x.a)
|
||||||
|
x
|
||||||
|
|
||||||
|
doAssert p(false) == (-20, -10)
|
||||||
|
doAssert p(true) == (20, 10)
|
||||||
|
|
||||||
|
|
||||||
proc mainProc() =
|
proc mainProc() =
|
||||||
# other tests should be in `main`
|
# other tests should be in `main`
|
||||||
block:
|
block:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue