Skip to content

Commit e49e94f

Browse files
committed
Fix conditions when to add an AndType in CrossCastAnd
1 parent 64fe532 commit e49e94f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

compiler/src/dotty/tools/dotc/transform/CrossCastAnd.scala

+5-3
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ import dotty.tools.dotc.core.Flags
66
import dotty.tools.dotc.core.Types.AndType
77
import dotty.tools.dotc.transform.MegaPhase._
88
import tpd._
9-
10-
9+
import dotty.tools.dotc.core.Decorators._
1110

1211
/**
1312
* This transform makes sure that all private member selections from
@@ -22,7 +21,10 @@ class CrossCastAnd extends MiniPhase {
2221

2322
lazy val qtype = tree.qualifier.tpe.widen
2423
val sym = tree.symbol
25-
if (sym.is(Flags.Private) && !sym.isConstructor && qtype.typeSymbol != sym.owner)
24+
if sym.is(Flags.Private)
25+
&& !sym.isConstructor
26+
&& qtype.classSymbol != sym.owner
27+
then
2628
cpy.Select(tree)(tree.qualifier.cast(AndType(qtype.baseType(sym.owner), tree.qualifier.tpe)), tree.name)
2729
else tree
2830
}

0 commit comments

Comments
 (0)