File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -284,8 +284,12 @@ 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 this type (or of an underlying type of this type) produced as a repair for an error? */
288+ def isErroneous (implicit ctx : Context ): Boolean =
289+ existsPart(_.isError, forceLazy = false ) || {
290+ val tpw = this .widen
291+ (tpw `ne` this ) && tpw.isErroneous
292+ }
289293
290294 /** Does the type carry an annotation that is an instance of `cls`? */
291295 @ tailrec final def hasAnnotation (cls : ClassSymbol )(implicit ctx : Context ): Boolean = stripTypeVar match {
Original file line number Diff line number Diff line change @@ -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