Skip to content

Commit

Permalink
fix #20248;fix #6215;turns into simple CT error (#21141)
Browse files Browse the repository at this point in the history
  • Loading branch information
bung87 authored Dec 20, 2022
1 parent 886572a commit 40b5c4c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions compiler/semtypes.nim
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,8 @@ proc semRange(c: PContext, n: PNode, prev: PType): PType =
proc semArrayIndex(c: PContext, n: PNode): PType =
if isRange(n):
result = semRangeAux(c, n, nil)
elif n.kind == nkInfix and n[0].kind == nkIdent and n[0].ident.s == "..<":
result = errorType(c)
else:
let e = semExprWithType(c, n, {efDetermineType})
if e.typ.kind == tyFromExpr:
Expand Down
14 changes: 14 additions & 0 deletions tests/array/t20248.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
discard """
cmd: "nim check --hints:off $file"
errormsg: "ordinal type expected; given: Error Type"
nimout: '''
t20248.nim(10, 36) Error: ordinal type expected; given: Error Type
t20248.nim(14, 20) Error: ordinal type expected; given: Error Type
'''
"""

type Vec[N: static[int]] = array[0 ..< N, float]

var v: Vec[32]

var stuff: array[0 ..< 16, int]

0 comments on commit 40b5c4c

Please sign in to comment.