Skip to content

Commit bfee834

Browse files
oderskysmarter
authored andcommitted
Try default implicits only if method has default parameters
1 parent 1b4e4f5 commit bfee834

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1458,9 +1458,15 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
14581458
// have influenced the context, binding variables, but later ones
14591459
// might fail. In that case the constraint needs to be reset.
14601460
ctx.typerState.constraint = constr
1461-
tryEither
1462-
{ implicit ctx => typed(untpd.Apply(untpd.TypedSplice(tree), Nil), pt) }
1463-
{ (_, _) => ctx.error(failure(), tree.pos.endPos); tree }
1461+
def issueError = {
1462+
ctx.error(failure(), tree.pos.endPos)
1463+
tree
1464+
}
1465+
if (tree.symbol.hasDefaultParams)
1466+
tryEither
1467+
{ implicit ctx => typed(untpd.Apply(untpd.TypedSplice(tree), Nil), pt) }
1468+
{ (_, _) => issueError }
1469+
else issueError
14641470
}
14651471
}
14661472
if ((pt eq WildcardType) || original.isEmpty) addImplicitArgs

0 commit comments

Comments
 (0)