diff options
Diffstat (limited to 'tests/ccgbugs/tstringslice.nim')
-rw-r--r-- | tests/ccgbugs/tstringslice.nim | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/ccgbugs/tstringslice.nim b/tests/ccgbugs/tstringslice.nim new file mode 100644 index 000000000..0ff448dcf --- /dev/null +++ b/tests/ccgbugs/tstringslice.nim @@ -0,0 +1,20 @@ +discard """ + output: '''1 +1234 +2 +234 +3 +34 +4 +4''' +""" + +# bug #794 +type TRange = range[0..3] + +const str = "123456789" + +for i in TRange.low .. TRange.high: + echo str[i] #This works fine + echo str[int(i) .. int(TRange.high)] #So does this + #echo str[i .. TRange.high] #The compiler complains about this |