Skip to content

Commit 04d1588

Browse files
committed
Reduce # calls to simplify
Call simplify and interpolateTypeVars in the same situations.
1 parent 417f0c8 commit 04d1588

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1807,11 +1807,12 @@ class Typer extends Namer
18071807

18081808
/** Interpolate and simplify the type of the given tree. */
18091809
protected def simplify(tree: Tree, pt: Type, locked: TypeVars)(implicit ctx: Context): tree.type = {
1810-
if (!tree.denot.isOverloaded) {
1811-
// for overloaded trees: resolve overloading before simplifying
1812-
if (tree.isDef || !tree.tpe.widen.isInstanceOf[MethodOrPoly])
1813-
interpolateTypeVars(tree, pt, locked)
1814-
tree.overwriteType(tree.tpe.simplified) // ??? can we move in?
1810+
if (tree.isDef || // always simplify types of definitions
1811+
!tree.denot.isOverloaded || // for overloaded trees: resolve overloading before simplifying
1812+
!tree.tpe.widen.isInstanceOf[MethodOrPoly]) // wait with simplifying until method is fully applied
1813+
{
1814+
interpolateTypeVars(tree, pt, locked)
1815+
tree.overwriteType(tree.tpe.simplified)
18151816
}
18161817
tree
18171818
}

0 commit comments

Comments
 (0)