mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 22:10:33 +00:00
fix iterator equality + add test for proc equality + fix sameType (#21707)
* fix iterator equality + add test also for procs fixes #21706 * all targets * and isNil and repr * separate overloads, fix sameType * more restricted sameType? * merge overloads again?? * remove sametype change for now * fix sameType anyway (CI failure was not related) --------- Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
This commit is contained in:
@@ -1405,7 +1405,7 @@ proc isNil*[T](x: ref T): bool {.noSideEffect, magic: "IsNil".}
|
||||
proc isNil*[T](x: ptr T): bool {.noSideEffect, magic: "IsNil".}
|
||||
proc isNil*(x: pointer): bool {.noSideEffect, magic: "IsNil".}
|
||||
proc isNil*(x: cstring): bool {.noSideEffect, magic: "IsNil".}
|
||||
proc isNil*[T: proc](x: T): bool {.noSideEffect, magic: "IsNil".}
|
||||
proc isNil*[T: proc | iterator {.closure.}](x: T): bool {.noSideEffect, magic: "IsNil".}
|
||||
## Fast check whether `x` is nil. This is sometimes more efficient than
|
||||
## `== nil`.
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ proc `==`*[T](x, y: ref T): bool {.magic: "EqRef", noSideEffect.}
|
||||
## Checks that two `ref` variables refer to the same item.
|
||||
proc `==`*[T](x, y: ptr T): bool {.magic: "EqRef", noSideEffect.}
|
||||
## Checks that two `ptr` variables refer to the same item.
|
||||
proc `==`*[T: proc](x, y: T): bool {.magic: "EqProc", noSideEffect.}
|
||||
proc `==`*[T: proc | iterator](x, y: T): bool {.magic: "EqProc", noSideEffect.}
|
||||
## Checks that two `proc` variables refer to the same procedure.
|
||||
|
||||
proc `<=`*[Enum: enum](x, y: Enum): bool {.magic: "LeEnum", noSideEffect.}
|
||||
|
||||
@@ -94,7 +94,7 @@ proc repr*(p: pointer): string =
|
||||
result[j] = HexChars[n and 0xF]
|
||||
n = n shr 4
|
||||
|
||||
proc repr*(p: proc): string =
|
||||
proc repr*(p: proc | iterator {.closure.}): string =
|
||||
## repr of a proc as its address
|
||||
repr(cast[ptr pointer](unsafeAddr p)[])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user