fixes #2420; negative indexing for slicing is obsolete (breaking change!)
This commit is contained in:
parent
46fb0e0bac
commit
2b80d75aa2
8 changed files with 82 additions and 79 deletions
|
|
@ -167,10 +167,10 @@ proc magicsAfterOverloadResolution(c: PContext, n: PNode,
|
|||
result.typ = n[1].typ
|
||||
of mDotDot:
|
||||
result = n
|
||||
# we only need to warnings here about negative indexing:
|
||||
if isNegative(n.sons[1]) or (n.len > 2 and isNegative(n.sons[2])):
|
||||
message(n.info, warnDeprecated,
|
||||
"use '^' instead of '-'; negative indexing")
|
||||
# disallow negative indexing for now:
|
||||
if not c.p.bracketExpr.isNil:
|
||||
if isNegative(n.sons[1]) or (n.len > 2 and isNegative(n.sons[2])):
|
||||
localError(n.info, "use '^' instead of '-'; negative indexing is obsolete")
|
||||
of mRoof:
|
||||
# error correction:
|
||||
result = n.sons[1]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue