summary refs log tree commit diff stats
path: root/changelogs/changelog_X_XX_X.md
Commit message (Expand)AuthorAgeFilesLines
* fixes #9376: old changelogs should be kept instead of erased (#9428)Timothee Cour2018-10-191-0/+27
uthor Adam Strzelecki <ono@java.pl> 2015-09-04 23:04:32 +0200 committer Adam Strzelecki <ono@java.pl> 2015-09-04 23:04:32 +0200 tests: Trim .nim files trailing whitespace' href='/ahoang/Nim/commit/tests/generics/t1789.nim?h=devel&id=e80465dacf50f260abec30ae57d37b298c93fd83'>e80465dac ^
da36a847a ^


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44







































                                                         
 


                  
discard """
  output: "3\n0"
"""

# https://github.com/Araq/Nim/issues/1789

type
  Foo[N: static[int]] = object

proc bindStaticN[N](foo: Foo[N]) =
  var ar0: array[3, int]
  var ar1: array[N, int]
  var ar2: array[1..N, int]
  var ar3: array[0..(N+10), float]
  echo N

var f: Foo[3]
f.bindStaticN

# case 2

type
  ObjectWithStatic[X, Y: static[int], T] = object
    bar: array[X * Y, T]   # this one works

  AliasWithStatic[X, Y: static[int], T] = array[X * Y, T]

var
  x: ObjectWithStatic[1, 2, int]
  y: AliasWithStatic[2, 3, int]

# case 3

type
  Bar[N: static[int], T] = object
    bar: array[N, T]

proc `[]`*[N, T](f: Bar[N, T], n: range[0..(N - 1)]): T =
  assert high(n) == N-1
  result = f.bar[n]

var b: Bar[3, int]
echo b[2]