make var string return var char w/ BackwardsIndex (#15461)
* make var string return var char w/ BackwardsIndex fixes #14497 * work around VM bug * properly workaround again
This commit is contained in:
parent
ef2677f5f3
commit
527e792827
3 changed files with 11 additions and 3 deletions
|
|
@ -91,3 +91,10 @@ proc tester[T](x: T) =
|
|||
|
||||
tester(1)
|
||||
|
||||
# #14497
|
||||
func reverse*(a: string): string =
|
||||
result = a
|
||||
for i in 0 ..< a.len div 2:
|
||||
swap(result[i], result[^(i + 1)])
|
||||
|
||||
doAssert reverse("hello") == "olleh"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue