January 17 [Issue 24342] New: T[][].until(T[]) breaks if sentinel is longer than 1. | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24342 Issue ID: 24342 Summary: T[][].until(T[]) breaks if sentinel is longer than 1. Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: major Priority: P1 Component: phobos Assignee: nobody@puremagic.com Reporter: default_357-line@yahoo.de import std; void main() { int[] marker = [2, 3]; int[][] first = [[1], [2, 3], [4]]; int[][] second = first.until(marker, No.openRight).array; assert(second == [[1], [2, 3]]); } Instead, `second` is [[1], [2, 3], [4]]. This happens because `until` does not differentiate "range is T[] and sentinel is T[]" from "range is _T[][]_ and sentinel is T[]". This leads it to advance two rather than one elements if the sentinel is two long. -- |
Copyright © 1999-2021 by the D Language Foundation