@@ -34,10 +34,11 @@ import Constants.{Constant, IntTag}
34
34
import Denotations .SingleDenotation
35
35
import annotation .threadUnsafe
36
36
37
- import scala .util .control .NonFatal
38
- import dotty .tools .dotc .inlines .Inlines
39
37
import scala .annotation .tailrec
38
+ import scala .util .control .NonFatal
40
39
import dotty .tools .dotc .cc .isRetains
40
+ import dotty .tools .dotc .inlines .Inlines
41
+ import dotty .tools .dotc .util .chaining .*
41
42
42
43
object Applications {
43
44
import tpd .*
@@ -607,7 +608,7 @@ trait Applications extends Compatibility {
607
608
fail(TypeMismatch (methType.resultType, resultType, None ))
608
609
609
610
// match all arguments with corresponding formal parameters
610
- if success then matchArgs(orderedArgs, methType.paramInfos, n= 0 )
611
+ if success then matchArgs(orderedArgs, methType.paramInfos, n = 0 )
611
612
case _ =>
612
613
if (methType.isError) ok = false
613
614
else fail(em " $methString does not take parameters " )
@@ -765,20 +766,18 @@ trait Applications extends Compatibility {
765
766
}
766
767
else defaultArgument(normalizedFun, n, testOnly)
767
768
768
- // a bug allowed empty parens to expand to implicit args, offer rewrite only on migration
769
+ // a bug allowed empty parens to expand to implicit args: fail empty args for rewrite on migration
769
770
def canSupplyImplicits = methodType.isImplicitMethod
770
- && (applyKind == ApplyKind .Using || {
771
- if args1 .isEmpty then
771
+ && (applyKind == ApplyKind .Using || false .tap : _ =>
772
+ if Application . this .args .isEmpty then
772
773
fail(MissingImplicitParameterInEmptyArguments (methodType.paramNames(n), methString))
773
- true
774
- })
775
- && ctx.mode.is(Mode .ImplicitsEnabled )
774
+ )
776
775
777
776
if ! defaultArg.isEmpty then
778
777
defaultArg.tpe.widen match
779
778
case _ : MethodOrPoly if testOnly => matchArgs(args1, formals1, n + 1 )
780
779
case _ => matchArgs(args1, addTyped(treeToArg(defaultArg)), n + 1 )
781
- else if methodType.isContextualMethod && ctx.mode.is(Mode .ImplicitsEnabled ) || canSupplyImplicits then
780
+ else if ( methodType.isContextualMethod || canSupplyImplicits) && ctx.mode.is(Mode .ImplicitsEnabled ) then
782
781
val implicitArg = implicitArgTree(formal, appPos.span)
783
782
matchArgs(args1, addTyped(treeToArg(implicitArg)), n + 1 )
784
783
else
@@ -1198,8 +1197,7 @@ trait Applications extends Compatibility {
1198
1197
retry = true
1199
1198
rewrites.Rewrites .patch(tree.span.withStart(tree.span.point), " " ) // f() -> f
1200
1199
Diagnostic .Warning (err.msg, err.pos)
1201
- else
1202
- err
1200
+ else err
1203
1201
case _ => err
1204
1202
case dia => dia
1205
1203
retry
0 commit comments