@@ -34,7 +34,7 @@ abstract class Recheck extends Phase, IdentityDenotTransformer:
34
34
def run (using Context ): Unit =
35
35
val unit = ctx.compilationUnit
36
36
// println(i"recheck types of $unit")
37
- newRechecker().check( )
37
+ newRechecker().checkUnit(unit )
38
38
39
39
def newRechecker ()(using Context ): Rechecker
40
40
@@ -248,7 +248,7 @@ abstract class Recheck extends Phase, IdentityDenotTransformer:
248
248
* @param locked the set of type variables of the current typer state that cannot be interpolated
249
249
* at the present time
250
250
*/
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 ) {
252
252
253
253
def recheckNamed (tree : NameTree , pt : Type )(using Context ): Type =
254
254
val sym = tree.symbol
@@ -305,17 +305,16 @@ abstract class Recheck extends Phase, IdentityDenotTransformer:
305
305
def checkConforms (tpe : Type , pt : Type , tree : Tree )(using Context ): Unit = tree match
306
306
case _ : DefTree | EmptyTree | _ : TypeTree =>
307
307
case _ =>
308
- val actual = tree. tpe.widenExpr
308
+ val actual = tpe.widenExpr
309
309
val expected = pt.widenExpr
310
310
val isCompatible =
311
311
actual <:< expected
312
312
|| expected.isRepeatedParam
313
313
&& actual <:< expected.translateFromRepeated(toArray = tree.tpe.isRef(defn.ArrayClass ))
314
314
if ! isCompatible then
315
- err.typeMismatch(tree, pt)
315
+ err.typeMismatch(tree.withType(tpe) , pt)
316
316
317
- def check ()(using Context ): Unit =
318
- val unit = ictx.compilationUnit
317
+ def checkUnit (unit : CompilationUnit )(using Context ): Unit =
319
318
recheck(unit.tpdTree)
320
319
321
320
end Rechecker
0 commit comments