mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-20 14:25:23 +00:00
style usages part one (openarray => openArray) (#19321)
* style usages (openArray)
* revert doc changes
(cherry picked from commit 9df195ef58)
This commit is contained in:
@@ -6,4 +6,4 @@ discard """
|
||||
# Tests a special bug
|
||||
|
||||
var
|
||||
x: ref openarray[string] #ERROR_MSG invalid type
|
||||
x: ref openArray[string] #ERROR_MSG invalid type
|
||||
|
||||
@@ -2,12 +2,12 @@ discard """
|
||||
output: "5 - [1]"
|
||||
"""
|
||||
type
|
||||
TProc = proc (n: int, m: openarray[int64]) {.nimcall.}
|
||||
TProc = proc (n: int, m: openArray[int64]) {.nimcall.}
|
||||
|
||||
proc Foo(x: int, P: TProc) =
|
||||
P(x, [ 1'i64 ])
|
||||
|
||||
proc Bar(n: int, m: openarray[int64]) =
|
||||
proc Bar(n: int, m: openArray[int64]) =
|
||||
echo($n & " - " & repr(m))
|
||||
|
||||
Foo(5, Bar) #OUT 5 - [1]
|
||||
|
||||
@@ -5,7 +5,7 @@ discard """
|
||||
|
||||
proc choose(b: openArray[string]): string = return b[0]
|
||||
|
||||
proc p(a, b: openarray[string]): int =
|
||||
proc p(a, b: openArray[string]): int =
|
||||
result = a.len + b.len - 1
|
||||
for j in 0 .. a.len: inc(result)
|
||||
discard choose(a)
|
||||
|
||||
@@ -15,14 +15,14 @@ var
|
||||
raa = [11,12,13]
|
||||
|
||||
#bug #3586
|
||||
proc mutate[T](arr:openarray[T], brr: openArray[T]) =
|
||||
proc mutate[T](arr:openArray[T], brr: openArray[T]) =
|
||||
for i in 0..arr.len-1:
|
||||
doAssert(arr[i] == brr[i])
|
||||
|
||||
mutate(arr, arr)
|
||||
|
||||
#bug #2240
|
||||
proc f(a: openarray[int], b: openArray[int]) =
|
||||
proc f(a: openArray[int], b: openArray[int]) =
|
||||
for i in 0..a.len-1:
|
||||
doAssert(a[i] == b[i])
|
||||
|
||||
@@ -37,7 +37,7 @@ ra[2] = 13
|
||||
f(ra[], raa)
|
||||
|
||||
#bug #2240b
|
||||
proc fillBuffer(buf: var openarray[char]) =
|
||||
proc fillBuffer(buf: var openArray[char]) =
|
||||
for i in 0..buf.len-1:
|
||||
buf[i] = chr(i)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user