File tree 3 files changed +19
-1
lines changed
src/dotty/tools/dotc/typer
3 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -1447,7 +1447,13 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
1447
1447
case ambi : AmbiguousImplicits =>
1448
1448
implicitArgError(s " ambiguous implicits: ${ambi.explanation} of $where" )
1449
1449
case failure : SearchFailure =>
1450
- implicitArgError(d " no implicit argument of type $formal found for $where" + failure.postscript)
1450
+ def noImplicitFound =
1451
+ implicitArgError(d " no implicit argument of type $formal found for $where" + failure.postscript)
1452
+ if (tree.symbol.hasDefaultParams) // try to append () to application
1453
+ tryEither
1454
+ { implicit ctx => typed(untpd.Apply (untpd.TypedSplice (tree), Nil ), pt) }
1455
+ { (_, _) => noImplicitFound }
1456
+ else noImplicitFound
1451
1457
}
1452
1458
}
1453
1459
if (args.exists(_.isEmpty)) {
Original file line number Diff line number Diff line change
1
+ class C (val f : Any * )
2
+
3
+ class D (override val f : Nothing ) extends C (f)
Original file line number Diff line number Diff line change
1
+ class A
2
+
3
+ object Impl {
4
+ def foo ()(implicit x : A = null ): Int = 2
5
+ def test : Int = {
6
+ foo()() // ok
7
+ foo() // did not work before, does now
8
+ }
9
+ }
You can’t perform that action at this time.
0 commit comments