Skip to content

Commit 618e5de

Browse files
authored
Merge pull request #3890 from allanrenucci/cleanup
Cleanup commit
2 parents d691163 + 09d182e commit 618e5de

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

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

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -341,18 +341,12 @@ trait Inferencing { this: Typer =>
341341
case _ => false
342342
}
343343

344-
var isConstrained = false
345-
def ensureConstrained() =
346-
if (!isConstrained) {
347-
isConstrained = true
348-
tree match {
349-
case tree: Apply => // already constrained
350-
case _ => tree.tpe match {
351-
case _: MethodOrPoly => // already constrained
352-
case tp => constrainResult(tp, pt)
353-
}
354-
}
355-
}
344+
var isConstrained = tree.isInstanceOf[Apply] || tree.tpe.isInstanceOf[MethodOrPoly]
345+
346+
def ensureConstrained() = if (!isConstrained) {
347+
isConstrained = true
348+
constrainResult(tree.tpe, pt)
349+
}
356350

357351
// Avoid interpolating variables if typerstate has unreported errors.
358352
// Reason: The errors might reflect unsatisfiable constraints. In that

0 commit comments

Comments
 (0)