diff --git a/src/lib.c b/src/lib.c index 4f6d27066..f4862bc78 100644 --- a/src/lib.c +++ b/src/lib.c @@ -493,6 +493,13 @@ static struct lib_unit *lib_get_aux(lib_t lib, ident_t ident) { assert(lib != NULL); + // Handle aliased library names + ident_t lname = ident_until(ident, '.'); + if (lname != lib->name) { + ident_t uname = ident_rfrom(ident, '.'); + ident = ident_prefix(lib->name, uname, '.'); + } + // Search in the list of already loaded units for (unsigned n = 0; n < lib->n_units; n++) { if (tree_ident(lib->units[n].top) == ident) diff --git a/src/sem.c b/src/sem.c index 0112b661c..30f3ba12e 100644 --- a/src/sem.c +++ b/src/sem.c @@ -1215,12 +1215,6 @@ static bool sem_check_use_clause(tree_t c) lib_t lib = lib_find(istr(lname), true, true); if (lib != NULL) { - if (lname != lib_name(lib)) { - ident_t unit = ident_rfrom(cname, '.'); - lname = lib_name(lib); - cname = ident_prefix(lname, unit, '.'); - } - if (lname == cname) { assert(all);