aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2020-06-10 16:36:59 +0100
committergingerBill <bill@gingerbill.org>2020-06-10 16:36:59 +0100
commit61db6c1234d6a38723fbd38da45e52ea773ca2a7 (patch)
treeb9aa4843cd45554aa77b97bfebd14936f954162d /src
parente641d714a01c7949e5d41c2fb0be80f7f05b38bc (diff)
Add force usage when importing `intrinsics` or `builtin`
Diffstat (limited to 'src')
-rw-r--r--src/checker.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/checker.cpp b/src/checker.cpp
index 41453dc99..2ca4d794f 100644
--- a/src/checker.cpp
+++ b/src/checker.cpp
@@ -3524,12 +3524,16 @@ void check_add_import_decl(CheckerContext *ctx, Ast *decl) {
Scope *scope = nullptr;
+ bool force_use = false;
+
if (id->fullpath == "builtin") {
scope = builtin_pkg->scope;
builtin_pkg->used = true;
+ force_use = true;
} else if (id->fullpath == "intrinsics") {
scope = intrinsics_pkg->scope;
intrinsics_pkg->used = true;
+ force_use = true;
} else {
AstPackage **found = string_map_get(pkgs, id->fullpath);
if (found == nullptr) {
@@ -3575,7 +3579,7 @@ void check_add_import_decl(CheckerContext *ctx, Ast *decl) {
scope);
add_entity(ctx->checker, parent_scope, nullptr, e);
- if (id->is_using) {
+ if (force_use || id->is_using) {
add_entity_use(ctx, nullptr, e);
}
}