Skip to content
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

from/all import must not include module in name resolution #3931

Merged
merged 7 commits into from
Nov 30, 2022

Conversation

hubertp
Copy link
Contributor

@hubertp hubertp commented Nov 29, 2022

Pull Request Description

It appears that when were doing
from XYZ import all
the module XYZ was also being taken into account during name resolution.
This was unfortunate and became problematic when one had a type with the same name defined in it.
During pattern matching one could not simply do

from XYZ import all
...
    case ... of
        _ : XYZ -> ...

since the compiler would complain that we try to pattern match on a type but give it a module.

The module is now excluded from the name resolution, when importing everything from the module.
It appears that this "feature" was used in a number of our tests, so they had to be adapted.
This fixes task 4 in https://www.pivotaltracker.com/story/show/183833055

Checklist

Please include the following checklist in your PR:

  • The documentation has been updated if necessary.
  • All code conforms to the
    Scala,
    Java,
    and
    Rust
    style guides.
  • All code has been tested:
    • Unit tests have been written where possible.
    • If GUI codebase was changed: Enso GUI was tested when built using BOTH
      ./run ide build and ./run ide watch.

@hubertp hubertp changed the title Ignore imported module in from/all name resolution from/all import must not include module in name resolution Nov 29, 2022
It appears that when were doing
`from XYZ import all`
the module `XYZ` was also being taken into account during name
resolution.
This was unfortunate and became problematic when one had a type with the
same name defined in it.
During pattern matching one could not simply do
```
from XYZ import all
...
    case ... of
        _ : XYZ -> ...
```
since the compiler would complain that we try to pattern match on a type
but give it a module.

The module is now excluded from the name resolution, when importing
everything from the module.
It appears that this "feature" was used in a number of our tests,
so they had to be adapted.
This fixes task 4 in https://www.pivotaltracker.com/story/show/183833055
@hubertp hubertp force-pushed the wip/hubert/name-resolution-all-import-183833055 branch from 08f5afc to 87c377d Compare November 29, 2022 17:05
@hubertp hubertp added the CI: Ready to merge This PR is eligible for automatic merge label Nov 30, 2022
@mergify mergify bot merged commit 20c22f2 into develop Nov 30, 2022
@mergify mergify bot deleted the wip/hubert/name-resolution-all-import-183833055 branch November 30, 2022 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: Ready to merge This PR is eligible for automatic merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants