-
Notifications
You must be signed in to change notification settings - Fork 323
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
Add compiler pass that discovers ambiguous imports #6868
Add compiler pass that discovers ambiguous imports #6868
Conversation
…rts-not-reported # Conflicts: # engine/runtime/src/test/scala/org/enso/compiler/test/semantic/ImportExportTest.scala
This reverts commit d8693b5.
- Also make sure that all the warnings are collected.
6df70b9
to
c0611ac
Compare
Co-authored-by: James Dunkerley <[email protected]>
3e219c3
to
0cca1a6
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.
Some Scala code could be improved.
distribution/lib/Standard/Base/0.0.0-dev/src/Data/Text/Regex/Pattern.enso
Outdated
Show resolved
Hide resolved
engine/runtime/src/main/scala/org/enso/compiler/pass/analyse/AmbiguousImportsAnalysis.scala
Outdated
Show resolved
Hide resolved
engine/runtime/src/main/scala/org/enso/compiler/pass/analyse/AmbiguousImportsAnalysis.scala
Show resolved
Hide resolved
) match { | ||
case Left(error) => Left(List(error)) | ||
case Right(imp) => Right(imp) | ||
} |
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.
Similar comment as before
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.
I am confused. Do you mean the one with fold
suggestion? How should I refactor this to fold
?
engine/runtime/src/main/scala/org/enso/compiler/pass/analyse/AmbiguousImportsAnalysis.scala
Outdated
Show resolved
Hide resolved
engine/runtime/src/main/scala/org/enso/compiler/pass/analyse/AmbiguousImportsAnalysis.scala
Show resolved
Hide resolved
engine/runtime/src/main/scala/org/enso/compiler/pass/analyse/AmbiguousImportsAnalysis.scala
Outdated
Show resolved
Hide resolved
ca9bcc8
to
b36b4b8
Compare
Thanks for the changes looks much cleaner. |
This reverts commit 45ffd3a.
This reverts commit 2b49036.
Fixes #6431
Pull Request Description
Add a new compiler pass that analyses duplicated and ambiguous symbols from imports. A duplicated import is an import that imports a symbol that has already been imported by a previous import statement and that refers to the same object. An ambiguous import is an import statement that imports a symbol that has already been import by a previous import statement and refers to a different object.
For every ambiguous import, an error is provided - by replacing the IR with the
IR.Error
. For every duplicated import, a warning is attached to the IR.Example of the compiler error message:
Important Notes
Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.
./run ide build
.