-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Dependency Scanning] Miscellaneous fixes to import statement info serialization #80723
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
Conversation
@swift-ci smoke test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you have a better commit message to explain the fixes? I still have trouble to understand what exact issue is being fixed here.
// | ||
// RUN: grep "IMPORT_STATEMENT_NODE" %t/cache.moddepcache.initial.dump.txt | wc -l > %t/initial_scan_import_count.txt | ||
// RUN: grep "IMPORT_STATEMENT_NODE" %t/cache.moddepcache.dump.txt | wc -l > %t/secondary_scan_import_count.txt | ||
// RUN: diff %t/initial_scan_import_count.txt %t/secondary_scan_import_count.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does output change order somehow? Should we just diff all the import line, rather than the count?
If we only care about count, I assume it is a known number that doesn't change? Maybe use CHECK-COUNT-{NUM}
instead of diffing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does output change order somehow? Should we just diff all the import line, rather than the count?
While I don't think the order should change, we haven't actually intentionally ensured that all the various string identifiers will have identical order and values. If we intend to have that, then that's something to pursue. But in the meantime I want to have the test be a bit simpler and at least ensure that we have preserved the same count of imports.
I assume it is a known number that doesn't change?
There is a lot of precedent of Swift adding implicit imports throughout the years and I really didn't want to hard-code this into the test so that it would have to be updated in the future.
…rialization - Deserialization of binary module dependencies was still relying on stale code (e.g. 'currentModuleImports', 'currentOptionalModuleImports') from serialized import strings, instead of the now in-use import infos. - Imports without a source location (e.g. implicit imports of stdlib) were not getting serialized at all - Optional import arrays were not being written out at all
dbaf99c
to
e2f50b5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM for the problem fixed. I do prefer the cache to be deterministic though.
@swift-ci smoke test |
currentModuleImports
,currentOptionalModuleImports
) from serialized import strings, instead of the now in-use import infos.