Skip to content

Commit 1824ad8

Browse files
committed
add support for precise implicit summoning
1 parent 00a4998 commit 1824ad8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3520,7 +3520,10 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
35203520
def methodStr = err.refStr(methPart(tree).tpe)
35213521

35223522
def readapt(tree: Tree)(using Context) = adapt(tree, pt, locked)
3523-
def readaptSimplified(tree: Tree)(using Context) = readapt(simplify(tree, pt, locked))
3523+
def readaptSimplified(tree: Tree)(using Context) = readapt(
3524+
// also locking precise type variables to prevent their widening to bounds in implicits
3525+
simplify(tree, pt, locked ++ ctx.typerState.ownedVars.filter(_.isPrecise))
3526+
)
35243527

35253528
def missingArgs(mt: MethodType) =
35263529
ErrorReporting.missingArgs(tree, mt)

0 commit comments

Comments
 (0)