diff options
author | cooldome <ariabushenko@gmail.com> | 2020-11-09 11:21:56 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-09 12:21:56 +0100 |
commit | d5a0a5dfffcf77e3221e8522e023e5485a2c37cc (patch) | |
tree | 4eaf5d392bba430243b13ed45840e21b95c58577 | |
parent | 3bff12b96612be4e47e20d880d3ba9e57e8bf713 (diff) | |
download | Nim-d5a0a5dfffcf77e3221e8522e023e5485a2c37cc.tar.gz |
Fix #15858 (#15887)
* fix #15858 * fix space * fix #15629 * Revert "fix #15629"
-rw-r--r-- | compiler/semtypes.nim | 2 | ||||
-rw-r--r-- | tests/statictypes/tstatictypes.nim | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim index 467645aee..f111f6308 100644 --- a/compiler/semtypes.nim +++ b/compiler/semtypes.nim @@ -306,7 +306,7 @@ proc semArrayIndex(c: PContext, n: PNode): PType = result = makeRangeWithStaticExpr(c, e) if c.inGenericContext > 0: result.flags.incl tfUnresolved elif e.kind in (nkCallKinds + {nkBracketExpr}) and hasUnresolvedArgs(c, e): - if not isOrdinalType(e.typ): + if not isOrdinalType(e.typ.skipTypes({tyStatic, tyAlias, tyGenericInst, tySink})): localError(c.config, n[1].info, errOrdinalTypeExpected) # This is an int returning call, depending on an # yet unknown generic param (see tgenericshardcases). diff --git a/tests/statictypes/tstatictypes.nim b/tests/statictypes/tstatictypes.nim index 359ae4c9f..fe1d1c8ca 100644 --- a/tests/statictypes/tstatictypes.nim +++ b/tests/statictypes/tstatictypes.nim @@ -349,3 +349,11 @@ type a: array[n, int] Tile = TileCT #Commenting this out to make it work + +#------------------------------------------------------------------------------------------ +# issue #15858 + +proc fn(N1: static int, N2: static int, T: typedesc): array[N1 * N2, T] = + doAssert(len(result) == N1 * N2) + +let yy = fn(5, 10, float) |