We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 62348de commit 4b3dce6Copy full SHA for 4b3dce6
src/dotty/tools/dotc/core/TypeComparer.scala
@@ -165,7 +165,13 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
165
// However the original judgment should be true.
166
case _ =>
167
}
168
- val sym1 = tp1.symbol
+ val sym1 =
169
+ if (tp1.symbol.is(ModuleClass) && tp2.symbol.is(ModuleVal))
170
+ // For convenience we want X$ <:< X.type
171
+ // This is safe because X$ self-type is X.type
172
+ tp1.symbol.companionModule
173
+ else
174
+ tp1.symbol
175
if ((sym1 ne NoSymbol) && (sym1 eq tp2.symbol))
176
ctx.erasedTypes ||
177
sym1.isStaticOwner ||
tests/pos/i1447.scala
@@ -0,0 +1,10 @@
1
+case object X
2
+
3
+object Test {
4
+ val Alias = X
5
6
+ val x: X.type = Alias
7
8
+ type Alias = X.type
9
+ val a: Alias = Alias
10
+}
0 commit comments