Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Analysis may be incorrect depending on timing/module load order #273

Closed
MikhailArkhipov opened this issue Oct 17, 2018 · 2 comments
Closed
Labels
bug Something isn't working feature: references

Comments

@MikhailArkhipov
Copy link

When analyzing mod1 that imports mod2 code in

            var reanalyzeEntries = aliases.SelectMany(a => Analyzer.GetEntriesThatImportModule(a, true)).ToArray();
            foreach (var entryRef in reanalyzeEntries) {
                await EnqueueItemAsync(entryRef as IDocument, AnalysisPriority.Low, parse: false);
            }

assumes that analysis of other modules is complete and GetEntriesThatImportModule will return the correct set. However, if analysis of dependencies hasn't been completed yet, the set may be incomplete. So in find reference tests code that loads dependency first like

                var uri2 = await TestData.CreateTestSpecificFileAsync("mod2.py", text2);
                using (server.AnalysisQueue.Pause()) {
                    await server.LoadFileAsync(uri2);
                    uri1 = await server.OpenDocumentAndGetUriAsync("mod1.py", text1);
                }

will succeed because mod2 will be placed in the queue first, but code that loads dependency last

                var uri2 = await TestData.CreateTestSpecificFileAsync("mod2.py", text2);
                using (server.AnalysisQueue.Pause()) {
                    uri1 = await server.OpenDocumentAndGetUriAsync("mod1.py", text1);
                    await server.LoadFileAsync(uri2);
                }

will lead to incomplete analysis with references missing

@MikhailArkhipov MikhailArkhipov self-assigned this Oct 17, 2018
@MikhailArkhipov MikhailArkhipov added bug Something isn't working feature: references labels Oct 17, 2018
@MikhailArkhipov MikhailArkhipov added this to the Oct 2018.2 milestone Oct 17, 2018
This was referenced Oct 17, 2018
@MikhailArkhipov
Copy link
Author

This requires fair amount of work to build dependency graph and re-analyze from there.

@MikhailArkhipov MikhailArkhipov removed this from the Oct 2018.2 milestone Oct 18, 2018
@MikhailArkhipov
Copy link
Author

#135

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working feature: references
Projects
None yet
Development

No branches or pull requests

2 participants