diff options
author | Martin Odersky <odersky@gmail.com> | 2016-08-18 09:12:04 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-08-18 10:10:01 +0200 |
commit | f006688d34e18553c8df800951cfa73c1aee4ea7 (patch) | |
tree | d70966523417a9075e57a3c7b7db6e949aeaba46 /src/dotty/tools/dotc/typer/TypeAssigner.scala | |
parent | f4ab855b03e9fc0fac31018bf9383220d2399697 (diff) | |
download | dotty-f006688d34e18553c8df800951cfa73c1aee4ea7.tar.gz dotty-f006688d34e18553c8df800951cfa73c1aee4ea7.tar.bz2 dotty-f006688d34e18553c8df800951cfa73c1aee4ea7.zip |
Fix to avoidance of singleton type arguments
Bring in line with comparisons. Fixes z1720 for good.
Diffstat (limited to 'src/dotty/tools/dotc/typer/TypeAssigner.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/TypeAssigner.scala | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/typer/TypeAssigner.scala b/src/dotty/tools/dotc/typer/TypeAssigner.scala index e0a9dbafc..a6e2deb23 100644 --- a/src/dotty/tools/dotc/typer/TypeAssigner.scala +++ b/src/dotty/tools/dotc/typer/TypeAssigner.scala @@ -59,7 +59,10 @@ trait TypeAssigner { case _ => false } def apply(tp: Type): Type = tp match { - case tp: TermRef if toAvoid(tp) && variance > 0 => + case tp: TermRef + if toAvoid(tp) && (variance > 0 || tp.info.widenExpr <:< tp) => + // Can happen if `x: y.type`, then `x.type =:= y.type`, hence we can widen `x.type` + // to y.type in all contexts, not just covariant ones. apply(tp.info.widenExpr) case tp: TypeRef if toAvoid(tp) => tp.info match { |