Skip to content

[DoNotMerge] Test TF-1232 fix. #30845

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

Closed
wants to merge 1 commit into from

Conversation

dan-zheng
Copy link
Contributor

Change SourceFile::addTopLevelDecl to update source lookup caches.
If tests pass: make the change robust, respecting access levels.

Change `SourceFile::addTopLevelDecl` to update source lookup caches.
If tests pass: make the change robust, respecting access levels.
@dan-zheng
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

swift-ci commented Apr 7, 2020

Build failed
Swift Test OS X Platform
Git Sha - 5565d24

@slavapestov
Copy link
Contributor

We don’t want the list of top level declarations in a source file to change after parsing. Can you instead investigate adding a new kind of FileUnit that stores synthesized declarations instead? Also ideally it should be possible to get all such declarations in “one shot”. We want to avoid mutating the AST where possible.

@dan-zheng
Copy link
Contributor Author

Can you instead investigate adding a new kind of FileUnit that stores synthesized declarations instead?

That sounds good, thank you! I can investigate re-adding a simplest possible DerivedFileUnit.


Also ideally it should be possible to get all such declarations in “one shot”. We want to avoid mutating the AST where possible.

I wonder what "getting all declarations in one shot" would look like, in terms of API calls?

Something like a DerivedFileUnit(SmallVectorImpl<ValueDecl *> topLevelDecls) constructor instead of incremental DerivedFileUnit::addTopLevelDecl(ValueDecl *decl) function calls?

@slavapestov
Copy link
Contributor

Yeah, basically instead of other parts of the compiler adding declarations in an ad-hoc way, you would have a "pull" model where the declarations are synthesized when needed. I'm not sure how to square this with the fact that the SIL optimizer is currently the one doing that though.

@dan-zheng
Copy link
Contributor Author

dan-zheng commented Apr 7, 2020

Closing in favor of #30863, which adds a SynthesizedFileUnit based on feedback here.

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.

3 participants