Bug 22785 – joiner does not support range over immutable

Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2022-02-17T10:19:47Z
Last change time
2023-04-19T22:59:26Z
Keywords
industry, pull
Assigned to
No Owner
Creator
FeepingCreature

Comments

Comment #0 by default_357-line — 2022-02-17T10:19:47Z
import std; void main() { struct S { immutable int value; } assert(chain([S(5)], [S(6)]).joiner.same([S(5), S(6)])); }
Comment #1 by default_357-line — 2023-03-08T10:23:32Z
Ran into it again just now. Bleh. This is also one of the issues that need https://github.com/dlang/phobos/pull/8674
Comment #2 by default_357-line — 2023-04-18T13:44:16Z
The example was rubbish. How about this: ``` void main() { import std.algorithm : joiner, map; import std.array : array; static immutable struct S { int[] arr; } auto range = [S([3]), S([4, 5])]; assert(range.map!"a.arr".joiner.array == [3, 4, 5]); } ```
Comment #3 by dlang-bot — 2023-04-18T14:44:17Z
@FeepingCreature created dlang/phobos pull request #8737 "Fix issue 22785: `joiner` should `Unqual` child ranges." fixing this issue: - Fix issue 22785: `joiner` should `Unqual` child ranges. This allows use with `immutable T[][]` and similar. https://github.com/dlang/phobos/pull/8737
Comment #4 by dlang-bot — 2023-04-19T22:59:26Z
dlang/phobos pull request #8737 "Fix issue 22785: `joiner` should `Unqual` child ranges." was merged into master: - 04ac328ad03744f36870d81ef06a08863dafd7db by Mathis Beer: Fix issue 22785: `joiner` should `Unqual` child ranges. This allows use with `immutable T[][]` and similar. https://github.com/dlang/phobos/pull/8737