enso
enso copied to clipboard
Conflicting extension methods result in compilation failure
Fixes #1243
Pull Request Description
OverloadResolution
compiler pass used to check overload errors only in one module at a time. In this PR, I have extended the functionality to check for overload errors from imported modules as well. So that, e.g., if there is an extension method foo
in imported module, and we try to redefine it in current module, it results in an ambiguity error.
Important Notes
Note that the ambiguity error can only be reported for extension methods, and not for static methods. static methods are defined inside body of a type, and extension methods are defined outside body of a type. Types can be shadowed. I have added more explanations to the Scala docs in OverloadResolution
class.
Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
- [x] The documentation has been updated, if necessary.
- [x] Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
- [x] All code follows the Scala, Java, TypeScript, and Rust style guides. In case you are using a language not listed above, follow the Rust style guide.
- [x] Unit tests have been written where possible.