You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if is_main_module: # or block:typeUser=refobject
id: intproc`==`(a, b: User): bool= a[] == b[]
var a =User(id: 1)
var b =User(id: 1)
echo a == b # ==> trueecho@[a] ==@[b] # ==> false - Error!
Nim Compiler Version 1.4.6 [MacOSX: amd64]
Compiled at 2021-05-06
Copyright (c) 2006-2020 by Andreas Rumpf
active boot switches: -d:release```
The text was updated successfully, but these errors were encountered:
al6x
changed the title
Equality is not working for ref object if it's defined inside of a block scope
Equality is not working if Ref Object defined in a block scope
May 7, 2021
The equality operator
==
works incorrectly if theref object
is defined inside of ablock:
scope.In the example the result of
@[a] == @[b]
would befalse
, but if the block scope removed, it will betrue
.Example
playground
The text was updated successfully, but these errors were encountered: