changes how the now illegal 'string == nil' comparison is detected

This commit is contained in:
Andreas Rumpf 2018-08-15 16:31:56 +02:00
commit 0da91aa744
5 changed files with 12 additions and 7 deletions

View file

@ -4048,6 +4048,10 @@ proc `==`*(x, y: cstring): bool {.magic: "EqCString", noSideEffect,
elif x.isNil or y.isNil: result = false
else: result = strcmp(x, y) == 0
when defined(nimNoNilSeqs2):
proc `==`*(x: string; y: type(nil)): bool {.error.} = discard
proc `==`*(x: 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
## their current iteration values. Example: