aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGuillaume Martres <smarter@ubuntu.com>2016-08-09 22:54:59 -0700
committerGuillaume Martres <smarter@ubuntu.com>2016-08-09 23:35:53 -0700
commit4b3dce64270144cc4227452ca71d4ceff2a05555 (patch)
tree07ba909dbb0ae247775f9fc1f4d135afd017a235 /src
parent62348dea92476f1bbb9d7f163f168be9c7e189b5 (diff)
downloaddotty-4b3dce64270144cc4227452ca71d4ceff2a05555.tar.gz
dotty-4b3dce64270144cc4227452ca71d4ceff2a05555.tar.bz2
dotty-4b3dce64270144cc4227452ca71d4ceff2a05555.zip
Fix #1447: Make X$ <:< X.type when X is an object
This allows objects to be easily aliased
Diffstat (limited to 'src')
-rw-r--r--src/dotty/tools/dotc/core/TypeComparer.scala8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/core/TypeComparer.scala b/src/dotty/tools/dotc/core/TypeComparer.scala
index 18eb424bc..d6ada7244 100644
--- a/src/dotty/tools/dotc/core/TypeComparer.scala
+++ b/src/dotty/tools/dotc/core/TypeComparer.scala
@@ -165,7 +165,13 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
// However the original judgment should be true.
case _ =>
}
- val sym1 = tp1.symbol
+ val sym1 =
+ if (tp1.symbol.is(ModuleClass) && tp2.symbol.is(ModuleVal))
+ // For convenience we want X$ <:< X.type
+ // This is safe because X$ self-type is X.type
+ tp1.symbol.companionModule
+ else
+ tp1.symbol
if ((sym1 ne NoSymbol) && (sym1 eq tp2.symbol))
ctx.erasedTypes ||
sym1.isStaticOwner ||