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 {
284
284
/** Is this type produced as a repair for an error? */
285
285
final def isError (implicit ctx : Context ): Boolean = stripTypeVar.isInstanceOf [ErrorType ]
286
286
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
+ }
289
293
290
294
/** Does the type carry an annotation that is an instance of `cls`? */
291
295
@ 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
2897
2897
}
2898
2898
2899
2899
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) &&
2901
2901
! tree.tpe.isRef(defn.UnitClass ) && ! isSelfOrSuperConstrCall(tree))
2902
2902
ctx.warning(PureExpressionInStatementPosition (original, exprOwner), original.sourcePos)
2903
2903
}
You can’t perform that action at this time.
0 commit comments