[Issue 23422] New: uniq loses position when chained to joiner
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Oct 17 10:37:48 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=23422
Issue ID: 23422
Summary: uniq loses position when chained to joiner
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: normal
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: default_357-line at yahoo.de
Consider the following code:
import std;
void main() {
auto range = [1, 2].uniq!"true";
auto left = range.map!"[a]".joiner.array;
auto right = range.map!"[a]".array.joiner.array;
writefln!"left = %s, right = %s"(left, right);
assert(left == right);
}
left = [2], right = [1]
core.exception.AssertError at onlineapp.d(8): Assertion failure
Something about the order in which joiner queries uniq makes uniq return a
different "unique" element. While this is *technically* valid behavior as
specified, it is very unexpected.
--
More information about the Digitalmars-d-bugs
mailing list