-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Difference in handling of context bounds and anonymous using arguments #21212
Labels
Milestone
Comments
WojciechMazur
added
itype:bug
itype:question
area:typer
stat:needs spec
area:implicits
related to implicits
labels
Jul 17, 2024
Minimization: trait A
trait B extends A
def test1(using a1: A)(using b1: B) = summon[A] // ok: picks (most general) a1
def test2(using a2: A)(implicit b2: B) = summon[A] // error: ambiguous
def test3(implicit a3: A, b3: B) = summon[A] // ok: picks (most specific) b3 |
Note that, as we can see in trait A[X]
trait B[X] extends A[X]
def test[X : A/* as a*/ : B/* as b*/] = summon[A[X]] // still picks b does not pick the most general. |
EugeneFlesselle
added a commit
to dotty-staging/dotty
that referenced
this issue
Jul 18, 2024
EugeneFlesselle
added a commit
to dotty-staging/dotty
that referenced
this issue
Jul 19, 2024
to apply the logic prioritizing givens over implicits as intended in scala#19300 Fix scala#21212
WojciechMazur
pushed a commit
to WojciechMazur/dotty
that referenced
this issue
Jul 24, 2024
to apply the logic prioritizing givens over implicits as intended in scala#19300 Fix scala#21212
WojciechMazur
pushed a commit
to WojciechMazur/dotty
that referenced
this issue
Jul 24, 2024
to apply the logic prioritizing givens over implicits as intended in scala#19300 Fix scala#21212
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
During the minimization of the crash found in OpenCB for https://github.com/takapi327/ldbc I've observed that context bounds and anonymous using arguments are treated differently by the compiler in cases where they're mixed with named using arguments.
When using context bounds we now get an ambiguous implicit resolution, but it's not the case in when the anonymous using arguments. This behaviour seems strange since both ways of declaring implicit ends up as being synthetic implicit parameters introduced by the compiler.
Compiler version
3.6.0-RC1-bin-20240716-bbb45ca-NIGHTLY
Minimized code
Output
-source:3.5
-source:3.6
Expectation
There might be a hole in implicit resolution logic that should be fixed.
The text was updated successfully, but these errors were encountered: