-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Ambiguous Extension Method when Exported #18768
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
Comments
Minimizationobject Module:
object Exportee:
opaque type Id = Long
def apply(): Id = ???
extension (e: Id)
def updated: Id = ???
object Client:
export Module.*
val x = Exportee().updated |
In the minimized version we see that the extension method is not in the companion object of - extension (e: Id)
- def updated: Id = ???
+ object Id:
+ extension (e: Id)
+ def updated: Id = ??? But this does not seem to help with the original code. |
odersky
added a commit
to dotty-staging/dotty
that referenced
this issue
Oct 29, 2023
In implicit or extension method search we might get two alternatives that are different but that point to the same singleton type after widening ExprTypes. In that case we can arbitrarily pick one of them instead of declaring an ambiguity. Fixes scala#18768
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Compiler version
3.3.1
Minimized code
Scastie https://scastie.scala-lang.org/QaKMJYEPQnumCasK5Ew7Cg
Output
Expectation
There should be no ambiguity resolving the extension method
updated
. There is only one method and only one path to the method.We can see in
ClientWorkingWithManualExport
that when we "manually" create aliases to export Exportee, rather than via anexport
statement, it compiles OK. In contrast, inClient
the same call fails to compile.The text was updated successfully, but these errors were encountered: