summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authormetagn <metagngn@gmail.com>2023-06-25 17:52:16 +0300
committerGitHub <noreply@github.com>2023-06-25 16:52:16 +0200
commit20037a47499ea183afb0e8d2a3f68c2b2952aa5d (patch)
tree8746781536c41c4874c5a4892cdbd7c8d7fbb990 /tests
parentf718f295df3f6ee5d7fd6fc19e39ac663821b00a (diff)
downloadNim-20037a47499ea183afb0e8d2a3f68c2b2952aa5d.tar.gz
make `var object` match better than `object` (#22152)
* fix `var object` not matching better than `object`

fixes #13302

* remove comment for brevity

* try note

* try minimize breaks
Diffstat (limited to 'tests')
-rw-r--r--tests/overload/tvartypeclass.nim11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/overload/tvartypeclass.nim b/tests/overload/tvartypeclass.nim
new file mode 100644
index 000000000..04f3f5a91
--- /dev/null
+++ b/tests/overload/tvartypeclass.nim
@@ -0,0 +1,11 @@
+# issue #13302
+
+proc foo(x: object): int = x.i*2
+proc foo(x: var object) = x.i*=2
+type Foo = object
+  i: int
+let x = Foo(i: 3)
+var y = Foo(i: 4)
+doAssert foo(x) == 6
+foo(y)
+doAssert y.i == 8