Skip to content

Commit b96e87d

Browse files
committed
Avoid recomputations of qualifiers of dynamic selects and calls
1 parent 5d4074f commit b96e87d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ object Inferencing {
3838
result
3939
}
4040

41+
/** Try to fully define `tp`. Return whether constraint has changed.
42+
* Any changed constraint is kept.
43+
*/
4144
def canDefineFurther(tp: Type)(using Context): Boolean =
4245
val prevConstraint = ctx.typerState.constraint
4346
isFullyDefined(tp, force = ForceDegree.all)

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -570,10 +570,11 @@ class Typer extends Namer
570570
else if qual.tpe.derivesFrom(defn.DynamicClass)
571571
&& selName.isTermName && !isDynamicExpansion(tree)
572572
then
573+
val tree2 = cpy.Select(tree0)(untpd.TypedSplice(qual), selName)
573574
if pt.isInstanceOf[FunOrPolyProto] || pt == AssignProto then
574-
assignType(tree, TryDynamicCallType)
575+
assignType(tree2, TryDynamicCallType)
575576
else
576-
typedDynamicSelect(tree0, Nil, pt)
577+
typedDynamicSelect(tree2, Nil, pt)
577578
else
578579
assignType(tree,
579580
rawType match

0 commit comments

Comments
 (0)