Skip to content

Commit df53e4d

Browse files
committed
Reset constraint when one of several implicit arguments is not found.
1 parent 38c8c53 commit df53e4d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1415,7 +1415,13 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
14151415
implicitArgError(d"no implicit argument of type $formal found for $where" + failure.postscript)
14161416
}
14171417
}
1418-
if (args.exists(_.isEmpty)) { assert(constr eq ctx.typerState.constraint); tree }
1418+
if (args.exists(_.isEmpty)) {
1419+
// If there are several arguments, some arguments might already
1420+
// have influenced the context, binfing variables, but later ones
1421+
// might fail. In that case the constraint needs to be reset.
1422+
ctx.typerState.constraint = constr
1423+
tree
1424+
}
14191425
else adapt(tpd.Apply(tree, args), pt)
14201426
}
14211427
if ((pt eq WildcardType) || original.isEmpty) addImplicitArgs

0 commit comments

Comments
 (0)