Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion compiler/typeallowed.nim
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ proc typeAllowedAux(marker: var IntSet, typ: PType, kind: TSymKind,
result = typeAllowedAux(marker, t.elementType, kind, c, flags+{taIsOpenArray})
of tySink:
# you cannot nest openArrays/sinks/etc.
if kind != skParam or taIsOpenArray in flags or t.elementType.kind in {tySink, tyLent, tyVar}:
# `sink openarray` is not allowed
if kind != skParam or taIsOpenArray in flags or t.elementType.kind in {tySink, tyLent, tyVar, tyOpenArray, tyVarargs}:
result = t
else:
result = typeAllowedAux(marker, t.elementType, kind, c, flags)
Expand Down
4 changes: 2 additions & 2 deletions lib/pure/collections/critbits.nim
Original file line number Diff line number Diff line change
Expand Up @@ -523,15 +523,15 @@ func commonPrefixLen*[T](c: CritBitTree[T]): int {.inline, since((1, 3)).} =
else: c.root.byte
else: 0

proc toCritBitTree*[T](pairs: sink openArray[(string, T)]): CritBitTree[T] {.since: (1, 3).} =
proc toCritBitTree*[T](pairs: openArray[(string, T)]): CritBitTree[T] {.since: (1, 3).} =
## Creates a new `CritBitTree` that contains the given `pairs`.
runnableExamples:
doAssert {"a": "0", "b": "1", "c": "2"}.toCritBitTree is CritBitTree[string]
doAssert {"a": 0, "b": 1, "c": 2}.toCritBitTree is CritBitTree[int]

for item in pairs: result.incl item[0], item[1]

proc toCritBitTree*(items: sink openArray[string]): CritBitTree[void] {.since: (1, 3).} =
proc toCritBitTree*(items: openArray[string]): CritBitTree[void] {.since: (1, 3).} =
## Creates a new `CritBitTree` that contains the given `items`.
runnableExamples:
doAssert ["a", "b", "c"].toCritBitTree is CritBitTree[void]
Expand Down
2 changes: 1 addition & 1 deletion tests/destructor/tmove_objconstr.nim
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ type
TableNonCopyable = object
x: seq[(string, MySeqNonCopyable)]

proc toTable(pairs: sink openArray[(string, MySeqNonCopyable)]): TableNonCopyable =
proc toTable(pairs: openArray[(string, MySeqNonCopyable)]): TableNonCopyable =
discard


Expand Down
1 change: 1 addition & 0 deletions tests/destructor/tnewruntime_misc.nim
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
discard """
cmd: '''nim cpp -d:nimAllocStats --newruntime --threads:on $file'''
disabled: true
output: '''(field: "value")
Indeed
axc
Expand Down
Loading