diff options
| author | gingerBill <bill@gingerbill.org> | 2022-01-31 19:33:02 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2022-01-31 19:33:02 +0000 |
| commit | 67ba05cb7cfee60daaf257230ddbc4f1e0a9f8ac (patch) | |
| tree | b8c046e3e0a171c7be62887d0839b60b0d27e9e4 /src/checker.cpp | |
| parent | 2f1aeaf757bce1ebc37bd5e63dfcdfe22685deaf (diff) | |
Correct false positive check in `check_unique_package_names`
Diffstat (limited to 'src/checker.cpp')
| -rw-r--r-- | src/checker.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/checker.cpp b/src/checker.cpp index 038709056..d9a1af0d1 100644 --- a/src/checker.cpp +++ b/src/checker.cpp @@ -5307,12 +5307,18 @@ void check_unique_package_names(Checker *c) { string_map_set(&pkgs, key, pkg); continue; } + auto *this = pkg->files[0]->pkg_decl; + auto *other = (*found)->files[0]->pkg_decl; + if (this == other) { + // NOTE(bill): A false positive was found, ignore it + continue; + } - error(pkg->files[0]->pkg_decl, "Duplicate declaration of 'package %.*s'", LIT(name)); + error(this, "Duplicate declaration of 'package %.*s'", LIT(name)); error_line("\tA package name must be unique\n" "\tThere is no relation between a package name and the directory that contains it, so they can be completely different\n" "\tA package name is required for link name prefixing to have a consistent ABI\n"); - error((*found)->files[0]->pkg_decl, "found at previous location"); + error(other, "found at previous location"); } } |