diff options
author | flywind <xzsflywind@gmail.com> | 2022-04-25 17:07:55 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-25 11:07:55 +0200 |
commit | efaa6777a464b94d88cb948390397b490ccee5b8 (patch) | |
tree | ed01948ef739cec99d95ade844b138eb5ecf51a1 /tests | |
parent | 8e6136dd59c737dab7c244e69f52864bd3fa65c9 (diff) | |
download | Nim-efaa6777a464b94d88cb948390397b490ccee5b8.tar.gz |
fix #19435; don't create TypeBoundOps for tyOpenArray, tyVarargs [backport: 1.6] (#19723)
* fix #19435; openArray wronyly registers typebounds * add testcase * don't create TypeBoundOps for tyOpenArray, tyVarargs
Diffstat (limited to 'tests')
-rw-r--r-- | tests/arc/t19435.nim | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/arc/t19435.nim b/tests/arc/t19435.nim new file mode 100644 index 000000000..519216bad --- /dev/null +++ b/tests/arc/t19435.nim @@ -0,0 +1,29 @@ +discard """ + matrix: "--gc:arc" +""" + +# bug #19435 +{.experimental: "views".} + +type + Bar = object + placeholder: int + Foo = object + placeholder: int + c: seq[Bar] # remove this line to make things right + +func children*(s: var seq[Foo]): openArray[Foo] = + s.toOpenArray(0, s.len-1) + +proc test = + var foos = @[Foo(), Foo()] + + assert foos.children.len == 2 + var flag = true + for a in foos.children: + flag = false + + if flag: + doAssert false + +test() \ No newline at end of file |