Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 9644 - Spell checker gives silly suggestions for 1-2 character symbols #2787

Merged
merged 1 commit into from
Nov 17, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/root/speller.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ void *spellerX(const char *seed, size_t seedlen, fp_speller_t fp, void *fparg,
void *speller(const char *seed, fp_speller_t fp, void *fparg, const char *charset)
{
size_t seedlen = strlen(seed);
for (int distance = 0; distance < 2; distance++)
size_t maxdist = seedlen < 3 ? seedlen - 1 : 2;
for (int distance = 0; distance < maxdist; distance++)
{ void *p = spellerX(seed, seedlen, fp, fparg, charset, distance);
if (p)
return p;
Expand Down
2 changes: 1 addition & 1 deletion test/fail_compilation/diag9210a.d
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
TEST_OUTPUT:
---
fail_compilation/imports/diag9210stdcomplex.d(13): Error: template instance Complex!real does not match template declaration Complex(T) if (isFloatingPoint!T)
fail_compilation/imports/diag9210b.d(6): Error: undefined identifier A, did you mean interface B?
fail_compilation/imports/diag9210b.d(6): Error: undefined identifier A
---
*/

Expand Down
4 changes: 2 additions & 2 deletions test/fail_compilation/fail61.d
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*
TEST_OUTPUT:
---
fail_compilation/fail61.d(22): Error: no property 'B' for type 'fail61.A.B', did you mean 'C'?
fail_compilation/fail61.d(23): Error: no property 'B' for type 'fail61.A.B', did you mean 'C'?
fail_compilation/fail61.d(22): Error: no property 'B' for type 'fail61.A.B'
fail_compilation/fail61.d(23): Error: no property 'B' for type 'fail61.A.B'
fail_compilation/fail61.d(32): Error: no property 'A2' for type 'fail61.B2'
fail_compilation/fail61.d(41): Error: this for foo needs to be type B3 not type fail61.C3
---
Expand Down
2 changes: 1 addition & 1 deletion test/fail_compilation/gag4269b.d
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
TEST_OUTPUT:
---
fail_compilation/gag4269b.d(10): Error: undefined identifier Y, did you mean variable y?
fail_compilation/gag4269b.d(10): Error: undefined identifier Y
---
*/

Expand Down
26 changes: 26 additions & 0 deletions test/fail_compilation/spell9644.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// REQUIRED_ARGS: -o-
// PERMUTE_ARGS:

/*
TEST_OUTPUT:
---
fail_compilation/spell9644.d(21): Error: undefined identifier b
fail_compilation/spell9644.d(22): Error: undefined identifier xx
fail_compilation/spell9644.d(23): Error: undefined identifier cb, did you mean variable ab?
fail_compilation/spell9644.d(24): Error: undefined identifier bc, did you mean variable abc?
fail_compilation/spell9644.d(25): Error: undefined identifier ccc, did you mean variable abc?
---
*/

int a;
int ab;
int abc;

int main()
{
cast(void)b; // max distance 0, no match
cast(void)xx; // max distance 1, no match
cast(void)cb; // max distance 1, match
cast(void)bc; // max distance 1, match
cast(void)ccc; // max distance 2, match
}