Skip to content

Commit f0d74b7

Browse files
Backport "Attempt implicit search for old style implicit parameters in Application matchArgs" to LTS (#20936)
Backports #19737 to the LTS branch. PR submitted by the release tooling. [skip ci]
2 parents 2fbc51d + 4a1ea5f commit f0d74b7

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

Diff for: compiler/src/dotty/tools/dotc/typer/Applications.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ trait Applications extends Compatibility {
620620
defaultArg.tpe.widen match
621621
case _: MethodOrPoly if testOnly => matchArgs(args1, formals1, n + 1)
622622
case _ => matchArgs(args1, addTyped(treeToArg(defaultArg)), n + 1)
623-
else if methodType.isContextualMethod && ctx.mode.is(Mode.ImplicitsEnabled) then
623+
else if methodType.isImplicitMethod && ctx.mode.is(Mode.ImplicitsEnabled) then
624624
matchArgs(args1, addTyped(treeToArg(implicitArg)), n + 1)
625625
else
626626
missingArg(n)

Diff for: tests/neg/i19594.check

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
-- [E172] Type Error: tests/neg/i19594.scala:12:14 ---------------------------------------------------------------------
2+
12 | assertEquals(true, 1, "values are not the same") // error
3+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4+
| Can you see me?!
5+
-- [E172] Type Error: tests/neg/i19594.scala:13:14 ---------------------------------------------------------------------
6+
13 | assertEquals(true, 1) // error
7+
| ^^^^^^^^^^^^^^^^^^^^^
8+
| Can you see me?!

Diff for: tests/neg/i19594.scala

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import scala.annotation.implicitNotFound
2+
3+
@implicitNotFound("Can you see me?!")
4+
trait Compare[A, B]
5+
6+
object example extends App:
7+
8+
// The presence of the below default argument prevents the `implicitNotFound` message from appearing
9+
def assertEquals[A, B](a: A, b: B, clue: => Any = "values are not the same")
10+
(implicit comp: Compare[A, B]): Unit = ()
11+
12+
assertEquals(true, 1, "values are not the same") // error
13+
assertEquals(true, 1) // error

0 commit comments

Comments
 (0)