From 2b80d75aa298f490aedb8970b877f3edd7fd4bab Mon Sep 17 00:00:00 2001 From: Araq Date: Sat, 28 Mar 2015 00:15:04 +0100 Subject: fixes #2420; negative indexing for slicing is obsolete (breaking change!) --- compiler/semmagic.nim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'compiler/semmagic.nim') diff --git a/compiler/semmagic.nim b/compiler/semmagic.nim index 56746ce26..de7700be6 100644 --- a/compiler/semmagic.nim +++ b/compiler/semmagic.nim @@ -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] -- cgit 1.4.1-2-gfad0