diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2023-09-01 14:55:19 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-01 08:55:19 +0200 |
commit | affd3f78587f1b18a8b4bc2fc51967cd55cb7531 (patch) | |
tree | 38c166f7734bb573fc08ae1eb5abfb827559f124 /tests | |
parent | 3b206ed988765419c5ff02c2b08645f24ed0cbad (diff) | |
download | Nim-affd3f78587f1b18a8b4bc2fc51967cd55cb7531.tar.gz |
fixes #22613; Default value does not work with object's discriminator (#22614)
* fixes #22613; Default value does not work with object's discriminator fixes #22613 * merge branches * add a test case * fixes status * remove outdated comments * move collectBranchFields into the global scope
Diffstat (limited to 'tests')
-rw-r--r-- | tests/objects/tobject_default_value.nim | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/objects/tobject_default_value.nim b/tests/objects/tobject_default_value.nim index 2d86dce11..3af790da6 100644 --- a/tests/objects/tobject_default_value.nim +++ b/tests/objects/tobject_default_value.nim @@ -377,7 +377,7 @@ template main {.dirty.} = Red, Blue, Yellow type - ObjectVarint3 = object # fixme it doesn't work with static + ObjectVarint3 = object case kind: Color = Blue of Red: data1: int = 10 @@ -703,5 +703,20 @@ template main {.dirty.} = var foo = new Container doAssert int(foo.thing[0].x) == 1 + block: # bug #22613 + type + K = enum + A = "a" + B = "b" + T = object + case kind: K = B + of A: + a: int + of B: + b: float + + doAssert T().kind == B + + static: main() main() |