[Issue 21338] Confusing error

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Apr 6 13:07:59 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=21338

Paul Backus <snarwin+bugzilla at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |snarwin+bugzilla at gmail.com
            Summary|Move functional style       |Confusing error
                   |code's unit tests outside   |
                   |scope, to actually test     |
                   |them.                       |

--- Comment #2 from Paul Backus <snarwin+bugzilla at gmail.com> ---
Reduced example:

---
import std.array, std.regex, std.uni, std.ascii;
void main()
{
    auto example = "Learning D is fun".split!isWhite;
}
---

Fails to compile and produces the error message:

---
onlineapp.d(4): Error: no overload matches for split
---

The compilation failure is caused by ambiguity between `std.uni.isWhite` and
`std.ascii.isWhite`. Removing either `std.uni` or `std.ascii` from the import
causes the code to compile.

The confusing error message is caused by ambiguity between `std.array.split`
and `std.regex.split`. Removing either `std.array` or `std.regex` causes it to
fail with a more informative error message.

--


More information about the Digitalmars-d-bugs mailing list