Skip to content
Closed
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
10 changes: 5 additions & 5 deletions compiler/src/dmd/typesem.d
Original file line number Diff line number Diff line change
Expand Up @@ -170,16 +170,16 @@ private void resolveHelper(TypeQualified mt, Loc loc, Scope* sc, Dsymbol s, Dsym
const p = mt.mutableOf().unSharedOf().toChars();
auto id = Identifier.idPool(p[0 .. strlen(p)]);
if (const n = importHint(id.toString()))
error(loc, "`%s` is not defined, perhaps `import %.*s;` ?", p, cast(int)n.length, n.ptr);
error(mt.loc, "`%s` is not defined, perhaps `import %.*s;` ?", p, cast(int)n.length, n.ptr);
else if (auto s2 = sc.search_correct(id))
error(loc, "undefined identifier `%s`, did you mean %s `%s`?", p, s2.kind(), s2.toChars());
error(mt.loc, "undefined identifier `%s`, did you mean %s `%s`?", p, s2.kind(), s2.toChars());
else if (const q = Scope.search_correct_C(id))
error(loc, "undefined identifier `%s`, did you mean `%s`?", p, q);
error(mt.loc, "undefined identifier `%s`, did you mean `%s`?", p, q);
else if ((id == Id.This && sc.getStructClassScope()) ||
(id == Id._super && sc.getClassScope()))
error(loc, "undefined identifier `%s`, did you mean `typeof(%s)`?", p, p);
error(mt.loc, "undefined identifier `%s`, did you mean `typeof(%s)`?", p, p);
else
error(loc, "undefined identifier `%s`", p);
error(mt.loc, "undefined identifier `%s`", p);

pt = Type.terror;
return;
Expand Down
9 changes: 9 additions & 0 deletions compiler/test/fail_compilation/fix21169.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
TEST_OUTPUT:
---
fail_compilation/fix21169.d(8): Error: undefined identifier `foo`
---
*/

foo
f() {}
Loading