From 0257f389fef6492906e47761f7e366921113bba6 Mon Sep 17 00:00:00 2001 From: Araq Date: Sat, 30 Aug 2014 20:16:35 +0200 Subject: [PATCH] fixes #1366 --- compiler/semmagic.nim | 2 +- tests/generics/tgeneric0.nim | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/compiler/semmagic.nim b/compiler/semmagic.nim index 7b612c806f..a72a6ab7d0 100644 --- a/compiler/semmagic.nim +++ b/compiler/semmagic.nim @@ -126,7 +126,7 @@ proc magicsAfterOverloadResolution(c: PContext, n: PNode, result.typ = getSysType(tyString) of mInstantiationInfo: result = semInstantiationInfo(c, n) of mOrd: result = semOrd(c, n) - of mHigh: result = semLowHigh(c, n, mHigh) + of mHigh, mLow: result = semLowHigh(c, n, n[0].sym.magic) of mShallowCopy: result = semShallowCopy(c, n, flags) of mNBindSym: result = semBindSym(c, n) of mLocals: result = semLocals(c, n) diff --git a/tests/generics/tgeneric0.nim b/tests/generics/tgeneric0.nim index 9292b729fa..45450ccca1 100644 --- a/tests/generics/tgeneric0.nim +++ b/tests/generics/tgeneric0.nim @@ -1,9 +1,9 @@ import tables type - TX = TTable[string, int] + TX = Table[string, int] -proc foo(models: seq[TTable[string, float]]): seq[float] = +proc foo(models: seq[Table[string, float]]): seq[float] = result = @[] for model in models.items: result.add model["foobar"] @@ -16,4 +16,12 @@ proc foo[T](p: TType[T, range[0..1]]) = proc foo[T](p: TType[T, range[0..2]]) = echo "bar" +#bug #1366 + +proc reversed(x) = + for i in countdown(x.low, x.high): + echo i + +reversed(@[-19, 7, -4, 6]) +