Module and partially qualified namespace type shadowing interaction #13535
Labels
Area-Compiler-Service
Various compiler service issues which do not belong to other labels/areas.
Feature Request
Needs-design
Milestone
We shadow quite some things in FSharp.Core, either to poison them (compiler message to point to an alternative) or replace them with our own implementations. This is not really uncommon and a good open source example is the Prelude in Dark https://github.com/darklang/dark/blob/main/fsharp-backend/src/Prelude/Prelude.fs
In our case, probably less common, we're also aliasing Option to ValueOption, and precisely around shadowed types and aliases is where things break down a bit.
Reading the following example I would expect only the inner module 'Core' to be opened. Instead F# also opens the namespace Core (from Microsoft.FSharp.Core) and loads its types and aliases again :/
https://sharplab.io/#v2:DYLgZgzgNAJiDUAfAdgQwLYFMIAdUGNMACAJUxwCcB7AWACh70qYBXYYgYSvSeSIF4i9IiKIAXAJ45iAeRxiAllWQAeAOQAVAHwCiANVTAWmOYuXrt9RszbEAyt0wBZG+11W6oolWl8uPZQ8vJlY3LgpiQWEvUXYxInRUCQAjTA1seIAKAA8QIlMlVQgxCgVkAHMtAEpdTKqg0R9MPyoI6JEAeg6iAAlUADdiMSoiCIBaJpaAvgB3AAsFfDmiTBgFYYoIIhhlNXjMQb4ITGJULdQiFmOYIgV0HFaxADp2oi7Jon9eBs7ujQWtphspRsBBCkQZmcVsDMPgxKtxCM5gMhlJiGoyJQqE8vsongVzMVShUtGoiMkWPE5pgIkRkVtJNIiGonItqBAqGBngAxOzIig4HGtTD4+SFFREsqVNSvOIJJKpBxYMQLCpEHJ5AlFEpS6q6RIpNIZIjZIA===
Interestingly, this behavior only seems to be triggered without error if there is a shadowing module in scope:
Given that partially qualified opening of namespaces:
Could we remove the behavior of re-opening namespaces via a partially qualified path entirely @dsyme?
The text was updated successfully, but these errors were encountered: