Initial import
This commit is contained in:
commit
405b86068e
324 changed files with 163599 additions and 0 deletions
29
tests/tconstr1.nim
Executable file
29
tests/tconstr1.nim
Executable file
|
|
@ -0,0 +1,29 @@
|
|||
# Test array, record constructors
|
||||
|
||||
import
|
||||
io
|
||||
|
||||
type
|
||||
TComplexRecord = record
|
||||
s: string
|
||||
x, y: int
|
||||
z: float
|
||||
chars: set[Char]
|
||||
|
||||
proc testSem =
|
||||
var
|
||||
things: array [0..1, TComplexRecord] = [
|
||||
(chars: {'a', 'b', 'c'}, s: "hi", x: 69, y: 45, z: 0.0),
|
||||
(chars: {'a', 'b', 'c'}, s: "hi", x: 69, y: 45, z: 1.0)
|
||||
]
|
||||
write(stdout, things[0].x)
|
||||
|
||||
const
|
||||
things: array [0..] of TComplexRecord = [
|
||||
(chars: {'a', 'b', 'c'}, s: "hi", x: 69, y: 45, z: 0.0),
|
||||
(chars: {'a', 'b', 'c'}, s: "hi", x: 69, y: 45) #ERROR
|
||||
]
|
||||
otherThings = [ # the same
|
||||
(chars: {'a', 'b', 'c'}, s: "hi", x: 69, y: 45, z: 0.0),
|
||||
(chars: {'a', 'b', 'c'}, s: "hi", x: 69, y: 45)
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue