-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[NameLookup] Ensure extensions are updated after module load #32375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NameLookup] Ensure extensions are updated after module load #32375
Conversation
@swift-ci please test |
@swift-ci please test source compatibility |
Isn't this exploiting this problem?
Can we fix this bug by moving the marking under the condition above? |
@CodaFi Unfortunately that doesn't fix it (though I can include it in this patch if you want) – in this case we initially do a member lookup, which loads in and looks through extensions, and marks the table lazily complete for that name. We then load a module, but because the table is already marked lazily complete, any further lookups bail with the previous set of results. That being said, I totally forgot we had the
How does that sound? |
Should we just invalidate the lookup caches when performing a module load, then? (I would have expected binding new extensions to already handle this...) |
@CodaFi You mean the lookup caches for all the nominal types? Or eagerly deserializing all the module's extension decls (thereby invalidating the lookup caches for the nominals being extended)? In either case IMO that seems unnecessarily expensive if we never need to do any lookups.
Right, it does, but that only happens when we load in the extensions. This patch ensures that we load in all the relevant extensions prior to consulting the lazily complete cache (thereby ensuring it's up-to-date). |
Right. Let's take the
version then. |
Call prepareExtensions to make sure we load in any new extensions brought in by modules loaded after-the-fact. This isn't an issue for normal compilations as we load all the modules up-front in import resolution, but clients such as the LLDB REPL may load in modules later. Resolves rdar://64040436.
cdd7963
to
4b1ffa5
Compare
@swift-ci please test |
Call
prepareExtensions
inprepareLookupTable
to make sure we load in any new extensions brought in by modules loaded after-the-fact. This isn't an issue for normal compilations as we load all the modules up-front in import resolution, but clients such as the LLDB REPL may load in modules later.As the LLDB REPL appears to be the only client affected by this, the test case is in swiftlang/llvm-project#1338.
Resolves rdar://64040436.