diff options
author | metagn <metagngn@gmail.com> | 2023-04-17 21:55:22 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-17 20:55:22 +0200 |
commit | b0a98cc01e14a33d75866c10c290f63031dc2112 (patch) | |
tree | 8d73def13ac7699326e885be4b9bd6260aa454ea /lib | |
parent | 2621f78b683592dced21cd93aa241deac8a9232f (diff) | |
download | Nim-b0a98cc01e14a33d75866c10c290f63031dc2112.tar.gz |
warn on set types bigger than max size, default to 0..255 for int literals (#21659)
* test implicitly huge set types refs https://github.com/nim-lang/RFCs/issues/298 * oh my god * boot at least * don't error, fix remaining issues, no 2 len arrays * fix runnable example * test assuming 0..255 for int literal * test refactor, add changelog, test
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/httpcore.nim | 10 | ||||
-rw-r--r-- | lib/std/sysrand.nim | 4 | ||||
-rw-r--r-- | lib/system/setops.nim | 4 |
3 files changed, 9 insertions, 9 deletions
diff --git a/lib/pure/httpcore.nim b/lib/pure/httpcore.nim index d639bef05..3b5cbc3cf 100644 --- a/lib/pure/httpcore.nim +++ b/lib/pure/httpcore.nim @@ -348,20 +348,20 @@ func is1xx*(code: HttpCode): bool {.inline, since: (1, 5).} = runnableExamples: doAssert is1xx(HttpCode(103)) - code.int in {100 .. 199} + code.int in 100 .. 199 func is2xx*(code: HttpCode): bool {.inline.} = ## Determines whether `code` is a 2xx HTTP status code. - code.int in {200 .. 299} + code.int in 200 .. 299 func is3xx*(code: HttpCode): bool {.inline.} = ## Determines whether `code` is a 3xx HTTP status code. - code.int in {300 .. 399} + code.int in 300 .. 399 func is4xx*(code: HttpCode): bool {.inline.} = ## Determines whether `code` is a 4xx HTTP status code. - code.int in {400 .. 499} + code.int in 400 .. 499 func is5xx*(code: HttpCode): bool {.inline.} = ## Determines whether `code` is a 5xx HTTP status code. - code.int in {500 .. 599} + code.int in 500 .. 599 diff --git a/lib/std/sysrand.nim b/lib/std/sysrand.nim index eeaa23d72..b5f61372a 100644 --- a/lib/std/sysrand.nim +++ b/lib/std/sysrand.nim @@ -194,8 +194,8 @@ elif defined(linux) and not defined(nimNoGetRandom) and not defined(emscripten): elif readBytes > 0: inc(result, readBytes) else: - if osLastError().int in {EINTR, EAGAIN}: - discard + case osLastError().int + of EINTR, EAGAIN: discard else: result = -1 break diff --git a/lib/system/setops.nim b/lib/system/setops.nim index b42c8b4a8..67aa3097a 100644 --- a/lib/system/setops.nim +++ b/lib/system/setops.nim @@ -26,9 +26,9 @@ func excl*[T](x: var set[T], y: T) {.magic: "Excl".} = ## ## This is the same as `x = x - {y}`, but it might be more efficient. runnableExamples: - var b = {2, 3, 5, 6, 12, 545} + var b = {2, 3, 5, 6, 12, 54} b.excl(5) - assert b == {2, 3, 6, 12, 545} + assert b == {2, 3, 6, 12, 54} template excl*[T](x: var set[T], y: set[T]) {.callsite.} = ## Excludes the set `y` from the set `x`. |