@@ -418,35 +418,30 @@ object TreeChecker {
418
418
}
419
419
420
420
override def typedUnadapted (tree : untpd.Tree , pt : Type , locked : TypeVars )(using Context ): Tree = {
421
- try
422
- val res = tree match
423
- case _ : untpd.TypedSplice | _ : untpd.Thicket | _ : EmptyValDef [? ] =>
424
- super .typedUnadapted(tree, pt, locked)
425
- case _ if tree.isType =>
426
- promote(tree)
427
- case _ =>
428
- val tree1 = super .typedUnadapted(tree, pt, locked)
429
- def isSubType (tp1 : Type , tp2 : Type ) =
430
- (tp1 eq tp2) || // accept NoType / NoType
431
- (tp1 <:< tp2)
432
- def divergenceMsg (tp1 : Type , tp2 : Type ) =
433
- s """ Types differ
434
- |Original type : ${tree.typeOpt.show}
435
- |After checking: ${tree1.tpe.show}
436
- |Original tree : ${tree.show}
437
- |After checking: ${tree1.show}
438
- |Why different :
439
- """ .stripMargin + core.TypeComparer .explained(_.isSubType(tp1, tp2))
440
- if (tree.hasType) // it might not be typed because Typer sometimes constructs new untyped trees and resubmits them to typedUnadapted
441
- assert(isSubType(tree1.tpe, tree.typeOpt), divergenceMsg(tree1.tpe, tree.typeOpt))
442
- tree1
443
- checkNoOrphans(res.tpe)
444
- phasesToCheck.foreach(_.checkPostCondition(res))
445
- res
446
- catch case NonFatal (ex) if ! ctx.run.enrichedErrorMessage =>
447
- val treeStr = tree.show(using ctx.withPhase(ctx.phase.prev.megaPhase))
448
- println(ctx.run.enrichErrorMessage(s " exception while retyping $treeStr of class ${tree.className} # ${tree.uniqueId}" ))
449
- throw ex
421
+ val res = tree match
422
+ case _ : untpd.TypedSplice | _ : untpd.Thicket | _ : EmptyValDef [? ] =>
423
+ super .typedUnadapted(tree, pt, locked)
424
+ case _ if tree.isType =>
425
+ promote(tree)
426
+ case _ =>
427
+ val tree1 = super .typedUnadapted(tree, pt, locked)
428
+ def isSubType (tp1 : Type , tp2 : Type ) =
429
+ (tp1 eq tp2) || // accept NoType / NoType
430
+ (tp1 <:< tp2)
431
+ def divergenceMsg (tp1 : Type , tp2 : Type ) =
432
+ s """ Types differ
433
+ |Original type : ${tree.typeOpt.show}
434
+ |After checking: ${tree1.tpe.show}
435
+ |Original tree : ${tree.show}
436
+ |After checking: ${tree1.show}
437
+ |Why different :
438
+ """ .stripMargin + core.TypeComparer .explained(_.isSubType(tp1, tp2))
439
+ if (tree.hasType) // it might not be typed because Typer sometimes constructs new untyped trees and resubmits them to typedUnadapted
440
+ assert(isSubType(tree1.tpe, tree.typeOpt), divergenceMsg(tree1.tpe, tree.typeOpt))
441
+ tree1
442
+ checkNoOrphans(res.tpe)
443
+ phasesToCheck.foreach(_.checkPostCondition(res))
444
+ res
450
445
}
451
446
452
447
def checkNotRepeated (tree : Tree )(using Context ): tree.type = {
@@ -844,7 +839,7 @@ object TreeChecker {
844
839
// We want make sure that transparent inline macros are checked in the same way that
845
840
// non transparent macros are, so we try to prepare a context which would make
846
841
// the checks behave the same way for both types of macros.
847
- //
842
+ //
848
843
// E.g. Different instances of skolem types are by definition not able to be a subtype of
849
844
// one another, however in practice this is only upheld during typer phase, and we do not want
850
845
// it to be upheld during this check.
0 commit comments