mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-03 18:34:43 +00:00
fixes #9149 [backport]
This commit is contained in:
@@ -4307,15 +4307,17 @@ proc `==`*(x, y: cstring): bool {.magic: "EqCString", noSideEffect,
|
||||
when defined(nimNoNilSeqs2):
|
||||
when not compileOption("nilseqs"):
|
||||
when defined(nimHasUserErrors):
|
||||
proc `==`*(x: string; y: type(nil)): bool {.
|
||||
# bug #9149; ensure that 'type(nil)' does not match *too* well by using 'type(nil) | type(nil)'.
|
||||
# Eventually (in 0.20?) we will be able to remove this hack completely.
|
||||
proc `==`*(x: string; y: type(nil) | type(nil)): bool {.
|
||||
error: "'nil' is now invalid for 'string'; compile with --nilseqs:on for a migration period".} =
|
||||
discard
|
||||
proc `==`*(x: type(nil); y: string): bool {.
|
||||
proc `==`*(x: type(nil) | type(nil); y: string): bool {.
|
||||
error: "'nil' is now invalid for 'string'; compile with --nilseqs:on for a migration period".} =
|
||||
discard
|
||||
else:
|
||||
proc `==`*(x: string; y: type(nil)): bool {.error.} = discard
|
||||
proc `==`*(x: type(nil); y: string): bool {.error.} = discard
|
||||
proc `==`*(x: string; y: type(nil) | type(nil)): bool {.error.} = discard
|
||||
proc `==`*(x: type(nil) | type(nil); y: string): bool {.error.} = discard
|
||||
|
||||
template closureScope*(body: untyped): untyped =
|
||||
## Useful when creating a closure in a loop to capture local loop variables by
|
||||
|
||||
Reference in New Issue
Block a user