@@ -34,7 +34,7 @@ abstract class Recheck extends Phase, IdentityDenotTransformer:
3434 def run (using Context ): Unit =
3535 val unit = ctx.compilationUnit
3636 // println(i"recheck types of $unit")
37- newRechecker().check( )
37+ newRechecker().checkUnit(unit )
3838
3939 def newRechecker ()(using Context ): Rechecker
4040
@@ -248,7 +248,7 @@ abstract class Recheck extends Phase, IdentityDenotTransformer:
248248 * @param locked the set of type variables of the current typer state that cannot be interpolated
249249 * at the present time
250250 */
251- def recheck (tree : Tree , pt : Type = WildcardType )(using Context ): Type = trace(i " rechecking $tree, ${tree.getClass} with $pt" , recheckr, show = true ) {
251+ def recheck (tree : Tree , pt : Type = WildcardType )(using Context ): Type = trace(i " rechecking $tree with pt = $pt" , recheckr, show = true ) {
252252
253253 def recheckNamed (tree : NameTree , pt : Type )(using Context ): Type =
254254 val sym = tree.symbol
@@ -305,17 +305,16 @@ abstract class Recheck extends Phase, IdentityDenotTransformer:
305305 def checkConforms (tpe : Type , pt : Type , tree : Tree )(using Context ): Unit = tree match
306306 case _ : DefTree | EmptyTree | _ : TypeTree =>
307307 case _ =>
308- val actual = tree. tpe.widenExpr
308+ val actual = tpe.widenExpr
309309 val expected = pt.widenExpr
310310 val isCompatible =
311311 actual <:< expected
312312 || expected.isRepeatedParam
313313 && actual <:< expected.translateFromRepeated(toArray = tree.tpe.isRef(defn.ArrayClass ))
314314 if ! isCompatible then
315- err.typeMismatch(tree, pt)
315+ err.typeMismatch(tree.withType(tpe) , pt)
316316
317- def check ()(using Context ): Unit =
318- val unit = ictx.compilationUnit
317+ def checkUnit (unit : CompilationUnit )(using Context ): Unit =
319318 recheck(unit.tpdTree)
320319
321320 end Rechecker
0 commit comments