mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-11 22:08:54 +00:00
fixes #25488
ref https://github.com/nim-lang/Nim/pull/20222
(cherry picked from commit 513c9aa69a)
This commit is contained in:
@@ -38,6 +38,21 @@ proc `==`*[T](x, y: ptr T): bool {.magic: "EqRef", noSideEffect.}
|
||||
proc `==`*[T: proc | iterator](x, y: T): bool {.magic: "EqProc", noSideEffect.}
|
||||
## Checks that two `proc` variables refer to the same procedure.
|
||||
|
||||
when true:
|
||||
# guard against string converted to cstring implicitly; see also #bug #25488
|
||||
proc isNil*(x: string): bool {.noSideEffect, error: "'isNil' is invalid for 'string'".}
|
||||
|
||||
|
||||
# bug #9149; ensure that 'typeof(nil)' does not match *too* well by using 'typeof(nil) | typeof(nil)',
|
||||
# especially for converters, see tests/overload/tconverter_to_string.nim
|
||||
# Eventually we will be able to remove this hack completely.
|
||||
|
||||
proc `==`*(x: string; y: typeof(nil) | typeof(nil)): bool {.error: "'nil' is invalid for 'string'".} =
|
||||
discard
|
||||
|
||||
proc `==`*(x: typeof(nil) | typeof(nil); y: string): bool {.error: "'nil' is invalid for 'string'".} =
|
||||
discard
|
||||
|
||||
proc `<=`*[Enum: enum](x, y: Enum): bool {.magic: "LeEnum", noSideEffect.}
|
||||
proc `<=`*(x, y: string): bool {.magic: "LeStr", noSideEffect.} =
|
||||
## Compares two strings and returns true if `x` is lexicographically
|
||||
|
||||
Reference in New Issue
Block a user