Skip to content

refactor(dmodule): Remove Module.clearCache - #24451

Open
Geod24 wants to merge 1 commit into
masterfrom
mlang/clearcache
Open

Geod24 wants to merge 1 commit into
masterfrom
mlang/clearcache

Conversation

@Geod24

@Geod24 Geod24 commented Nov 25, 2026

Copy link
Copy Markdown
Member

It was added along with the spell checker, which used to search for candidates with a stack-allocated Identifier. The module search cache compares identifiers by pointer, so a stale entry could match a different name sharing the same address:

void *symbol_search_fp(void *arg, const char *seed)
{
    Dsymbol *s = (Dsymbol *)arg;
    Identifier id(seed, 0);
    Module::clearCache();

Candidates are now interned via Identifier.lookup, so the cache is as valid for the spell checker as for any other search. Clearing it walked every module for every candidate, and was one of the few users of Module.amodules.

It was added along with the spell checker, which used to search for
candidates with a stack-allocated `Identifier`. The module search cache
compares identifiers by pointer, so a stale entry could match a different
name sharing the same address:

```
void *symbol_search_fp(void *arg, const char *seed)
{
    Dsymbol *s = (Dsymbol *)arg;
    Identifier id(seed, 0);
    Module::clearCache();
```

Candidates are now interned via `Identifier.lookup`, so the cache is as
valid for the spell checker as for any other search. Clearing it walked
every module for every candidate, and was one of the few users of
`Module.amodules`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants