mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-10 15:04:59 +00:00
…t holes fixes #22790
This commit is contained in:
@@ -160,3 +160,5 @@ proc initDefines*(symbols: StringTableRef) =
|
||||
|
||||
defineSymbol("nimUseStrictDefs")
|
||||
defineSymbol("nimHasNolineTooLong")
|
||||
|
||||
defineSymbol("nimHasCastExtendedVm")
|
||||
|
||||
@@ -16,7 +16,7 @@ iterator countdown*[T](a, b: T, step: Positive = 1): T {.inline.} =
|
||||
let x = collect(newSeq):
|
||||
for i in countdown(7, 3):
|
||||
i
|
||||
|
||||
|
||||
assert x == @[7, 6, 5, 4, 3]
|
||||
|
||||
let y = collect(newseq):
|
||||
@@ -32,7 +32,10 @@ iterator countdown*[T](a, b: T, step: Positive = 1): T {.inline.} =
|
||||
elif T is IntLikeForCount and T is Ordinal:
|
||||
var res = int(a)
|
||||
while res >= int(b):
|
||||
yield T(res)
|
||||
when defined(nimHasCastExtendedVm):
|
||||
yield cast[T](res)
|
||||
else:
|
||||
yield T(res)
|
||||
dec(res, step)
|
||||
else:
|
||||
var res = a
|
||||
@@ -64,7 +67,10 @@ iterator countup*[T](a, b: T, step: Positive = 1): T {.inline.} =
|
||||
when T is IntLikeForCount and T is Ordinal:
|
||||
var res = int(a)
|
||||
while res <= int(b):
|
||||
yield T(res)
|
||||
when defined(nimHasCastExtendedVm):
|
||||
yield cast[T](res)
|
||||
else:
|
||||
yield T(res)
|
||||
inc(res, step)
|
||||
else:
|
||||
var res = a
|
||||
@@ -89,7 +95,10 @@ iterator `..`*[T](a, b: T): T {.inline.} =
|
||||
when T is IntLikeForCount and T is Ordinal:
|
||||
var res = int(a)
|
||||
while res <= int(b):
|
||||
yield T(res)
|
||||
when defined(nimHasCastExtendedVm):
|
||||
yield cast[T](res)
|
||||
else:
|
||||
yield T(res)
|
||||
inc(res)
|
||||
else:
|
||||
var res = a
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
discard """
|
||||
matrix: "--mm:refc"
|
||||
disabled: true
|
||||
errormsg: "(k)..(k) not disjoint from (k)..(k)"
|
||||
line: 24
|
||||
action: compile
|
||||
|
||||
Reference in New Issue
Block a user