summaryrefslogtreecommitdiff
path: root/types.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2019-10-30 23:36:43 -0400
committerLeo Tenenbaum <pommicket@gmail.com>2019-10-30 23:36:43 -0400
commitfc6c746a726b3a56f2489c3db884c8ac2cd491d7 (patch)
tree7a65165db3ef9ab90c1cb80c01de33763d11822c /types.c
parent184e247a680c7889863f1b6676883d3cfa87eaba (diff)
minor improvements to error reporting
Diffstat (limited to 'types.c')
-rw-r--r--types.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/types.c b/types.c
index 0932496..1f7169f 100644
--- a/types.c
+++ b/types.c
@@ -363,7 +363,13 @@ static bool type_resolve(Typer *tr, Type *t, Location where) {
/* just check if it's actually defined */
if (!ident_typeval(t->user.name)) {
char *s = ident_to_str(t->user.name);
- err_print(where, "Use of undeclared type %s.", s);
+ IdentDecl *idecl = ident_decl(t->user.name);
+ if (idecl) {
+ err_print(where, "Use of non-type identifier %s as type.", s);
+ info_print(idecl->decl->where, "%s is declared here.", s);
+ } else {
+ err_print(where, "Use of undeclared type %s.", s);
+ }
free(s);
return false;
}