diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2020-07-08 14:47:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-08 14:47:14 +0200 |
commit | 06d776a5828d429f62c3189a99161604d50f9b96 (patch) | |
tree | ceacd12e5c00b8573ddd4d23e58a0f927c30a6ab /tests/arc | |
parent | cb1ecbf95620bffd559610b70f99c6f16963ac5c (diff) | |
download | Nim-06d776a5828d429f62c3189a99161604d50f9b96.tar.gz |
fixes #14900, this time for real, maybe (#14934)
Diffstat (limited to 'tests/arc')
-rw-r--r-- | tests/arc/tcontrolflow.nim | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/tests/arc/tcontrolflow.nim b/tests/arc/tcontrolflow.nim index 27ae45257..41f614cb2 100644 --- a/tests/arc/tcontrolflow.nim +++ b/tests/arc/tcontrolflow.nim @@ -105,20 +105,14 @@ proc escapeCheck = escapeCheck() # bug #14900 -template sortedByIt(seq1): untyped = - var result = seq1 - result - -proc seqsEqual(seq1, seq2: seq[string]): bool = - # works as a normal proc (if we would assign result inside) - # doesn't work as an expression - result = if false: # needed - false - else: - let a1 = seq1.sortedByIt() - let a2 = seq2.sortedByIt() - # echo a1 - works if you uncomment any of these - # echo a2 - a1 == a2 - -echo seqsEqual(@["a", "b", "c"], @["a", "b", "c"]) + +proc seqsEqual(a, b: string): bool = + if false: + false + else: + (var result1 = a; result1) == (var result2 = b; result2) + +# can be const or var too +let expected = "hello" + +echo seqsEqual(expected, expected) |