-
Notifications
You must be signed in to change notification settings - Fork 327
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
Conflicting Extension Methods Make Resolution Nondeterministic #1243
Comments
Check for ambiguity in |
This issue still persist to this day. Updated repro: create a project with following 4 files:
(or download project456.zip) and run it. It sometimes prints |
Related problem - it is possible to define an extension method on a type that already has a method with that name. In such case, the extension method simply seems to be ignored during resolution. I think we should indicate an error when trying to define an extension method on a type which already has such a method - as this extension method will never be able to be called. Repro:
Running it seems to always yield I think this could be solved as part of this issue as both problems are essentially about ambiguity of extension methods (there's just 2 cases: ambiguity between 2 extension methods from different modules AND ambiguity between an extension method and a 'normal' one). |
Interestingly, if 2 extension methods are defined in a single module, we do get an error:
|
Pavel Marek reports a new STANDUP for today (2024-05-02): Progress: - Ambiguous resolution seems very weak - we can even redefine an imported type without an error.
|
Pavel Marek reports a new STANDUP for today (2024-05-03): Progress: - Small bug fix - "from conversion propagates dataflow error" in #9856.
|
Pavel Marek reports a new STANDUP for today (2024-05-06): Progress: - Helping with module path on ydoc server
|
Pavel Marek reports a new STANDUP for today (2024-05-07): Progress: - More debugging of module-path issues in ydoc server
|
Pavel Marek reports a new 🔴 DELAY for the provided date (2024-05-17): Summary: There is 15 days delay in implementation of the Conflicting Extension Methods Make Resolution Nondeterministic (#1243) task. Delay Cause: Getting back to the issue after a long vacation. |
Pavel Marek reports a new STANDUP for the provided date (2024-05-17): Progress: - Giving up on the static compilation way - let's fix that in |
Pavel Marek reports a new STANDUP for today (2024-05-20): Progress: - Bumped into a problem with module ordering from import/export resolution.
|
Pavel Marek reports a new STANDUP for today (2024-05-21): Progress: - The runtime check in
|
General Summary
When multiple modules define extension methods with the same name and for the same type and both modules are imported, resolution of that method is not deterministic.
Steps to Reproduce
Multitest
) with the following files:File1.enso
:File2.enso
:Main.enso
:Or download the project from here: multitest.zip
Expected Result
The above code should result in an ambiguity error.
Ideally, the error should be detected when importing the module that brings the ambiguous resolution. If that's not possible, executing that method in runtime should yield a runtime error indicating the ambiguity.
Actual Result
The program sometimes prints
answer
and sometimes42
, behaving nondeterministically.Enso Version
The text was updated successfully, but these errors were encountered: