File tree Expand file tree Collapse file tree 3 files changed +6
-5
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 3 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -284,8 +284,9 @@ object Types {
284284 /** Is this type produced as a repair for an error? */
285285 final def isError (implicit ctx : Context ): Boolean = stripTypeVar.isInstanceOf [ErrorType ]
286286
287- /** Is some part of this type produced as a repair for an error? */
288- def isErroneous (implicit ctx : Context ): Boolean = existsPart(_.isError, forceLazy = false )
287+ /** Is some part of the widened version of this type produced as a repair for an error? */
288+ def isErroneous (implicit ctx : Context ): Boolean =
289+ widen.existsPart(_.isError, forceLazy = false )
289290
290291 /** Does the type carry an annotation that is an instance of `cls`? */
291292 @ tailrec final def hasAnnotation (cls : ClassSymbol )(implicit ctx : Context ): Boolean = stripTypeVar match {
Original file line number Diff line number Diff line change @@ -367,7 +367,7 @@ object ProtoTypes {
367367 def isDropped : Boolean = state.toDrop
368368
369369 override def isErroneous (implicit ctx : Context ): Boolean =
370- state.typedArgs.tpes.exists(_.widen. isErroneous)
370+ state.typedArgs.tpes.exists(_.isErroneous)
371371
372372 override def toString : String = s " FunProto( ${args mkString " ," } => $resultType) "
373373
Original file line number Diff line number Diff line change @@ -735,7 +735,7 @@ class Typer extends Namer
735735 val ptDefined = isFullyDefined(pt, ForceDegree .none)
736736 if (ptDefined && ! (avoidingType <:< pt)) avoidingType = pt
737737 val tree1 = ascribeType(tree, avoidingType)
738- assert(ptDefined || noLeaks(tree1) || tree1.tpe.widen. isErroneous,
738+ assert(ptDefined || noLeaks(tree1) || tree1.tpe.isErroneous,
739739 // `ptDefined` needed because of special case of anonymous classes
740740 i " leak: ${escapingRefs(tree1, localSyms).toList}%, % in $tree1" )
741741 tree1
@@ -2897,7 +2897,7 @@ class Typer extends Namer
28972897 }
28982898
28992899 private def checkStatementPurity (tree : tpd.Tree )(original : untpd.Tree , exprOwner : Symbol )(implicit ctx : Context ): Unit = {
2900- if (! tree.tpe.widen. isErroneous && ! ctx.isAfterTyper && isPureExpr(tree) &&
2900+ if (! tree.tpe.isErroneous && ! ctx.isAfterTyper && isPureExpr(tree) &&
29012901 ! tree.tpe.isRef(defn.UnitClass ) && ! isSelfOrSuperConstrCall(tree))
29022902 ctx.warning(PureExpressionInStatementPosition (original, exprOwner), original.sourcePos)
29032903 }
You can’t perform that action at this time.
0 commit comments