mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-15 23:54:19 +00:00
== in tables should not raise KeyError
* With previous code, the compiler deduced that equalsImpl may raise a KeyError. While this could only actually happen in a nasty multi-threaded environment, I fixed the code so that it will never happen.
This commit is contained in:
@@ -304,8 +304,9 @@ template equalsImpl() =
|
||||
# to use the slow route here:
|
||||
for key, val in s:
|
||||
# prefix notation leads to automatic dereference in case of PTable
|
||||
if not t.hasKey(key): return false
|
||||
if t[key] != val: return false
|
||||
try:
|
||||
if t[key] != val: return false
|
||||
except KeyError: return false
|
||||
return true
|
||||
|
||||
proc `==`*[A, B](s, t: Table[A, B]): bool =
|
||||
|
||||
Reference in New Issue
Block a user