Skip to content

Commit

Permalink
Merge pull request #2787 from yebblies/issue9644
Browse files Browse the repository at this point in the history
Issue 9644 - Spell checker gives silly suggestions for 1-2 character symbols
  • Loading branch information
yebblies committed Nov 17, 2013
2 parents e560549 + 2e4416b commit f5e0e09
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/root/speller.c
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
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
@@ -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
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
@@ -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
}

0 comments on commit f5e0e09

Please sign in to comment.