Bug 9644 – Spell checker gives silly suggestions for 1-2 character symbols

Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-03-04T09:19:00Z
Last change time
2013-11-17T06:10:00Z
Keywords
diagnostic, pull
Assigned to
nobody
Creator
clugdbug

Comments

Comment #0 by clugdbug — 2013-03-04T09:19:26Z
int q7; int main() { return ii; } bug.d(4): Error: undefined identifier ii, did you mean variable q7? No, of course I didn't. Compiler suggests any symbol that varies by at most two changes from the target, but that's too much for a symbol which is only two changes away from the empty string. The limit should be one character for symbols which are one or two characters long.
Comment #1 by andrej.mitrovich — 2013-03-11T17:40:46Z
Actually it's pretty bad for 3 characters too. For example: int tup; void main() { map = 1; } > Error: undefined identifier map, did you mean variable tup? Also, the spellchecker likes to suggest variables even if we tried to make a function call. I think it should take that into account (at least for types which are fundamental or which don't define opCall).
Comment #2 by yebblies — 2013-11-16T19:55:43Z
I've implemented the difference limit as min(strlen(id) - 1, 2). https://github.com/D-Programming-Language/dmd/pull/2787
Comment #3 by bearophile_hugs — 2013-11-17T05:40:41Z
*** Issue 10241 has been marked as a duplicate of this issue. ***
Comment #4 by bearophile_hugs — 2013-11-17T05:41:06Z
Another possible test case to verify, from issue 9644: import std.stdio; void main() { pre = 0; } Gives, DMD 2.065alpha: test.d(3): Error: undefined identifier pre, did you mean import core?
Comment #5 by bearophile_hugs — 2013-11-17T05:42:30Z
Chenged priority from trivial to minor.
Comment #6 by github-bugzilla — 2013-11-17T05:54:44Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/2e4416b4f77994bc3b54d34dea189bf669bcafdb Fix Issue 9644 - Spell checker gives silly suggestions for 1-2 character symbols https://github.com/D-Programming-Language/dmd/commit/f5e0e09a7514c2ede5b0be1954a74fcb245de61c Merge pull request #2787 from yebblies/issue9644 Issue 9644 - Spell checker gives silly suggestions for 1-2 character symbols