diff options
-rw-r--r-- | compiler/varpartitions.nim | 2 | ||||
-rw-r--r-- | tests/effects/tstrict_funcs.nim | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/compiler/varpartitions.nim b/compiler/varpartitions.nim index 49221654d..34a64c759 100644 --- a/compiler/varpartitions.nim +++ b/compiler/varpartitions.nim @@ -126,7 +126,7 @@ proc hasSideEffect*(c: var Partitions; info: var MutationInfo): bool = return true return false -template isConstParam(a): bool = a.kind == skParam and a.typ.kind != tyVar +template isConstParam(a): bool = a.kind == skParam and a.typ.kind notin {tyVar, tySink} proc variableId(c: Partitions; x: PSym): int = for i in 0 ..< c.s.len: diff --git a/tests/effects/tstrict_funcs.nim b/tests/effects/tstrict_funcs.nim index 166ab77c1..75ed9c8d9 100644 --- a/tests/effects/tstrict_funcs.nim +++ b/tests/effects/tstrict_funcs.nim @@ -15,3 +15,15 @@ proc get_Contig2Reads(sin: Stream, fn: string, contig2len: TableRef[string, int] if contig2len.haskey(parser.row[1]): mgetOrPut(result, parser.row[1], @[]).add(parser.row[0]) + + +block: + # issue #15756 + func `&&&`[T](x: var seq[T], y: sink T): seq[T] = + newSeq(result, x.len + 1) + for i in 0..x.len-1: + result[i] = move(x[i]) + result[x.len] = move(y) + + var x = @[0, 1] + let z = x &&& 2 \ No newline at end of file |