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

Conflicting Extension Methods Make Resolution Nondeterministic #5360

Closed
wdanilo opened this issue Feb 5, 2023 · 1 comment
Closed

Conflicting Extension Methods Make Resolution Nondeterministic #5360

wdanilo opened this issue Feb 5, 2023 · 1 comment
Labels
--bug Type: bug -compiler p-low Low priority s-duplicate Status: a duplicate issue

Comments

@wdanilo
Copy link
Member

wdanilo commented Feb 5, 2023

This task is automatically imported from the old Task Issue Board and it was originally created by Radosław Waśko.
Original issue is here.


Migrated from #1243

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

  1. Create new project (here called Multitest) with the following files:

File1.enso:

from Base import all
Number.foo = 42

File2.enso:

from Base import all
Number.foo = "answer"

Main.enso:

from Base import all
import Multitest.File1 
import Multitest.File2

main =
  a = 23.foo
  IO.println a

Or download the project from here: multitest.zip

  1. Run it several times

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 sometimes 42, behaving nondeterministically.

@radeusgd
Copy link
Member

Duplicate of #1243

@radeusgd radeusgd marked this as a duplicate of #1243 Feb 22, 2024
@radeusgd radeusgd added the s-duplicate Status: a duplicate issue label Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
--bug Type: bug -compiler p-low Low priority s-duplicate Status: a duplicate issue
Projects
None yet
Development

No branches or pull requests

2 participants