[Issue 14925] replaceInPlace fail compilation
https://issues.dlang.org/show_bug.cgi?id=14925 Basile-z changed: What|Removed |Added CC|b2.t...@gmx.com | --
[Issue 14925] replaceInPlace fail compilation
https://issues.dlang.org/show_bug.cgi?id=14925 Florent GABRIEL changed: What|Removed |Added Severity|enhancement |normal --
[Issue 14925] replaceInPlace fail compilation
https://issues.dlang.org/show_bug.cgi?id=14925 bb.t...@gmx.com changed: What|Removed |Added CC||bb.t...@gmx.com Component|dmd |phobos --
[Issue 14925] replaceInPlace fail compilation
https://issues.dlang.org/show_bug.cgi?id=14925 Steven Schveighoffer changed: What|Removed |Added CC||schvei...@yahoo.com --- Comment #1 from Steven Schveighoffer --- Once again, the "specialized" nature of strings comes back to bite us. The call matches the second overload (which just calls replace, and overwrites the original slice), because char[] is an input range, and char[] "isSomeString" and char[] has element type of dchar. I think probably we need to verify in that branch of the if statement that T is immutable or const, or the element encoding type of the array is not T. --
[Issue 14925] replaceInPlace fail compilation
https://issues.dlang.org/show_bug.cgi?id=14925 --- Comment #2 from Steven Schveighoffer --- Hm... I was wrong I guess (sort of). The *second* overload is the one that should be chosen. This means that even though the replace could be done directly, it will reallocate. This is because other pieces of the first overload cannot compile with narrow strings (namely, remove). So I just added a constraint to the first to prevent it from being called on narrow strings, and updated the second to work for all cases that don't match the first. I also found a bug where the first constraint would match 2 arrays where the second array wasn't identical, but the elements could be implicitly cast to the elements of the first. For example: auto a = [1L, 2, 3]; a.replaceInPlace(1, 2, [4,5,6]); Which fails to compile on 2.068 --
[Issue 14925] replaceInPlace fail compilation
https://issues.dlang.org/show_bug.cgi?id=14925 Steven Schveighoffer changed: What|Removed |Added Hardware|x86 |All OS|Linux |All --- Comment #3 from Steven Schveighoffer --- PR: https://github.com/D-Programming-Language/phobos/pull/3561 --
[Issue 14925] replaceInPlace fail compilation
https://issues.dlang.org/show_bug.cgi?id=14925 --- Comment #4 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/3f8b910e2c2834d2f87a543dc39692fe03a69c92 Fix issue 14925 -- merge overloads of replaceInPlace to avoid ambiguity with template instantiation. Also, preclude narrow strings and other invalid combinations (e.g. long[] and int[]) from being selected for optimized path. https://github.com/D-Programming-Language/phobos/commit/4d36627f363d9e23aae218578478a0c68da27278 Merge pull request #3561 from schveiguy/fix14925 Fix issue 14925 -- narrow strings should not match the first overload of replaceInPlace. --
[Issue 14925] replaceInPlace fail compilation
https://issues.dlang.org/show_bug.cgi?id=14925 --- Comment #5 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/ea811edab97021c9328dd2e81c49bba23c414b4d Supplemental fix for issue 14925 - remove redundant conditions https://github.com/D-Programming-Language/phobos/commit/de2df2bb04dfc4667ab0bac30425b9c14d6cb699 Merge pull request #3565 from 9rnsr/fix14925 Supplemental fix for issue 14925 --
[Issue 14925] replaceInPlace fail compilation
https://issues.dlang.org/show_bug.cgi?id=14925 --- Comment #6 from github-bugzi...@puremagic.com --- Commits pushed to stable at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/3f8b910e2c2834d2f87a543dc39692fe03a69c92 Fix issue 14925 -- merge overloads of replaceInPlace to avoid ambiguity https://github.com/D-Programming-Language/phobos/commit/4d36627f363d9e23aae218578478a0c68da27278 Merge pull request #3561 from schveiguy/fix14925 https://github.com/D-Programming-Language/phobos/commit/ea811edab97021c9328dd2e81c49bba23c414b4d Supplemental fix for issue 14925 - remove redundant conditions https://github.com/D-Programming-Language/phobos/commit/de2df2bb04dfc4667ab0bac30425b9c14d6cb699 Merge pull request #3565 from 9rnsr/fix14925 --