Spell checking errors can be hilarious

Simen Kjærås simen.kjaras at gmail.com
Fri Oct 16 07:27:23 UTC 2020


On Friday, 16 October 2020 at 07:09:39 UTC, Walter Bright wrote:
> On 10/15/2020 5:56 AM, Steven Schveighoffer wrote:
>> Walter, there's a bug in the compiler code that suggests an 
>> import for a symbol such that in certain cases when you use 
>> the symbol and that symbol isn't defined, it doesn't suggest 
>> the import. It doesn't suggest anything. It doesn't shift to 
>> another spot. If you fix the bug, it should always suggest the 
>> import.
>
> I don't agree that suggesting a global function for a .property 
> is the most useful hint.
>
> It's clearly a subjective opinion. But eventually there will be 
> another "bug" report about why the hint is obviously wrong. 
> That's par for the course whenever the compiler makes a 
> suggestion about a fix.

It seems you missed one crucial point here: the suggestion to 
import std.conv
*does* happen when invoked as 1.to!string, but *not* when invoked 
as to!string(1). It's already doing what you say is not the most 
useful hint, and failing to give a hint when to!string is invoked 
as a function call.

unittest {
     // template instance to!string template to is not defined
     auto x = to!string(1);

     // no property to for type int, perhaps import std.conv; is 
needed?
     auto y = 1.to!string;
}

--
   Simen


More information about the Digitalmars-d mailing list