Skip to content

Commit

Permalink
fix Issue 14320 - Improve diagnostic message for "undefined identifie…
Browse files Browse the repository at this point in the history
…r" error
  • Loading branch information
9rnsr committed Mar 23, 2015
1 parent 9ff8826 commit 6d4c849
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/expression.c
Expand Up @@ -7396,10 +7396,11 @@ Expression *DotIdExp::semanticY(Scope *sc, int flag)
return NULL;
s = ie->sds->search_correct(ident);
if (s)
error("undefined identifier '%s', did you mean '%s %s'?",
ident->toChars(), s->kind(), s->toChars());
error("undefined identifier '%s' in %s '%s', did you mean %s '%s'?",
ident->toChars(), ie->sds->kind(), ie->sds->toPrettyChars(), s->kind(), s->toChars());
else
error("undefined identifier '%s'", ident->toChars());
error("undefined identifier '%s' in %s '%s'",
ident->toChars(), ie->sds->kind(), ie->sds->toPrettyChars());
return new ErrorExp();
}
else if (t1b->ty == Tpointer && e1->type->ty != Tenum &&
Expand Down
2 changes: 1 addition & 1 deletion test/fail_compilation/diag10089.d
@@ -1,7 +1,7 @@
/*
TEST_OUTPUT:
---
fail_compilation/diag10089.d(15): Error: undefined identifier 'chunks'
fail_compilation/diag10089.d(15): Error: undefined identifier 'chunks' in package 'imports'
fail_compilation/diag10089.d(17): Error: no property 'chunks' for type 'void'
---
*/
Expand Down
2 changes: 1 addition & 1 deletion test/fail_compilation/fail237.d
@@ -1,7 +1,7 @@
/*
TEST_OUTPUT:
---
fail_compilation/fail237.d(10): Error: undefined identifier 'a'
fail_compilation/fail237.d(10): Error: undefined identifier 'a' in module 'fail237'
---
*/

Expand Down
2 changes: 1 addition & 1 deletion test/fail_compilation/ice13563.d
@@ -1,7 +1,7 @@
/*
TEST_OUTPUT:
---
fail_compilation/ice13563.d(23): Error: undefined identifier 'z'
fail_compilation/ice13563.d(23): Error: undefined identifier 'z' in module 'ice13563'
---
*/

Expand Down

0 comments on commit 6d4c849

Please sign in to comment.