Skip to content

Commit a6e1d19

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

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

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

+6-5
Original file line numberDiff line numberDiff line change
@@ -1807,12 +1807,13 @@ 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])
1810+
if (!tree.denot.isOverloaded) // for overloaded trees: resolve overloading before simplifying
1811+
if (!tree.tpe.widen.isInstanceOf[MethodOrPoly] // wait with simplifying until method is fully applied
1812+
|| tree.isDef) // ... unless tree is a definition
1813+
{
18131814
interpolateTypeVars(tree, pt, locked)
1814-
tree.overwriteType(tree.tpe.simplified) // ??? can we move in?
1815-
}
1815+
tree.overwriteType(tree.tpe.simplified)
1816+
}
18161817
tree
18171818
}
18181819

0 commit comments

Comments
 (0)