mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
@@ -330,7 +330,7 @@ proc semArrayIndex(c: PContext, n: PNode): PType =
|
||||
elif e.kind == nkSym and e.typ.kind == tyStatic:
|
||||
if e.sym.ast != nil:
|
||||
return semArrayIndex(c, e.sym.ast)
|
||||
if not isOrdinalType(e.typ.lastSon):
|
||||
if e.typ.lastSon.kind != tyGenericParam and not isOrdinalType(e.typ.lastSon):
|
||||
let info = if n.safeLen > 1: n[1].info else: n.info
|
||||
localError(c.config, info, errOrdinalTypeExpected % typeToString(e.typ, preferDesc))
|
||||
result = makeRangeWithStaticExpr(c, e)
|
||||
|
||||
9
tests/generics/t6637.nim
Normal file
9
tests/generics/t6637.nim
Normal file
@@ -0,0 +1,9 @@
|
||||
|
||||
type
|
||||
Grid2D*[I: SomeInteger, w, h: static[I], T] = object
|
||||
grid: array[w, array[h, T]]
|
||||
Grid2DIns = Grid2D[int, 2, 3, uint8]
|
||||
|
||||
let a = Grid2DIns()
|
||||
doAssert a.grid.len == 2
|
||||
doAssert a.grid[0].len == 3
|
||||
Reference in New Issue
Block a user