Bug 10089 – Strange function call error message with specified module
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-05-15T09:51:00Z
Last change time
2013-05-17T15:42:15Z
Keywords
diagnostic, pull
Assigned to
nobody
Creator
bearophile_hugs
Comments
Comment #0 by bearophile_hugs — 2013-05-15T09:51:52Z
import std.stdio, std.range;
void main() {
std.string.chunks("abcdef", 2);
}
Gives the error messages:
test.d(3): Error: std.stdio.chunks at ...\dmd2\windows\bin\..\..\src\phobos\std\stdio.d(2270) conflicts with std.range.chunks(Source)(Source source, size_t chunkSize) at ...\dmd2\windows\bin\..\..\src\phobos\std\range.d(6520)
test.d(3): Error: constructor std.stdio.chunks.this (File f, uint size) is not callable using argument types (void)
Expected error messages should say that there is no std.string.chunks.
Comment #1 by k.hara.pg — 2013-05-15T21:33:27Z
This is a regression in 2.063a, caused by the fix for UFCS name lookup.
With 2.062:
test.d(3): Error: undefined identifier 'chunks', did you mean 'template chunks(Source)(Source source, size_t chunkSize)'?
Comment #5 by bearophile_hugs — 2013-05-17T15:42:15Z
(In reply to comment #2)
> https://github.com/D-Programming-Language/dmd/pull/2040
Thank you for the fix.
Now the original program:
import std.stdio, std.range;
void main() {
std.string.chunks("abcdef", 2);
}
Gives the error message:
temp.d(3): Error: undefined identifier 'chunks', did you mean 'template chunks(Source)(Source source, size_t chunkSize)'?
It's essentially saying: "undefined identifier 'chunks', did you mean 'chunks'?"
Why is the error message not showing the name "std.string"? Maybe both 'chunks' should be module-qualified.