summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2023-05-08 19:52:28 +0800
committerGitHub <noreply@github.com>2023-05-08 13:52:28 +0200
commitebdff1c7d36683c13b7b692e7d2f16aa3b13027f (patch)
tree3f47d3235c594f3577c3106224a033b9c2ada032 /tests
parent71f2e1a502ad231e3356217398e2d7fcd6137967 (diff)
downloadNim-ebdff1c7d36683c13b7b692e7d2f16aa3b13027f.tar.gz
fixes #21801; object field initialization with overloaded functions (#21805)
* fixes #21801; object field initialization with overloaded functions

* use the correct type
Diffstat (limited to 'tests')
-rw-r--r--tests/objects/tobject_default_value.nim23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/objects/tobject_default_value.nim b/tests/objects/tobject_default_value.nim
index 59af943e0..97e3a207d 100644
--- a/tests/objects/tobject_default_value.nim
+++ b/tests/objects/tobject_default_value.nim
@@ -591,6 +591,29 @@ template main {.dirty.} =
 
     mainSync()
 
+  block: # bug #21801
+    func evaluate(i: int): float =
+      0.0
+
+    func evaluate(): float =
+      0.0
+
+    type SearchOptions = object
+        evaluation: proc(): float = evaluate
+
+  block:
+    func evaluate(): float =
+      0.0
+
+    type SearchOptions = object
+        evaluation: proc(): float = evaluate
+
+  block:
+    func evaluate(i: int): float =
+      0.0
+
+    type SearchOptions = object
+        evaluation = evaluate
 
 static: main()
 main()