carbon-language / carbon-lang

Carbon Language's main repository: documents, design, implementation, and related tools. (NOTE: Carbon Language is experimental; see README)
https://github.com/carbon-language/carbon-lang/blob/trunk/README.md
Other
32.31k stars 1.48k forks source link

Change implicit import handling to be namespace-oriented. #4089

Closed jonmeow closed 2 days ago

jonmeow commented 2 days ago

This refactors how the implicit import is handled in order to retain more name scope information. As a consequence, private access control works better between api files and implementation files. Note though that this will also be essential for name poisoning between the API and implementation, as discussed in #3763.

In implementing this, I ran into a couple issues with namespaces that I think point to flaws in their handling. I've fixed some and added a TODO for the biggest issue (in check.cpp line 281-288), which relates to the handling of namespaces of direct imports which are first evaluated indirectly.