Skip to content

Commit 507a33e

Browse files
committed
fix #13332: change accessibility in whyNotGenericSum
1 parent 363a493 commit 507a33e

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ object SymUtils:
109109
def problem(child: Symbol) = {
110110

111111
def isAccessible(sym: Symbol): Boolean =
112-
(self.isContainedIn(sym) && (companionMirror || declScope.isContainedIn(sym)))
112+
(self.isContainedIn(sym) && (companionMirror || sym.isAccessibleFrom(declScope.thisType)))
113113
|| sym.is(Module) && isAccessible(sym.owner)
114114

115115
if (child == self) "it has anonymous or inaccessible subclasses"

tests/pos/i13332.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import scala.deriving.Mirror
2+
3+
class Scope extends IListDefn {
4+
5+
type Of = Mirror { type MirroredType[X] = IList[X]; type MirroredMonoType = IList[Any] ; type MirroredElemTypes[_] <: Tuple }
6+
7+
val M = summon[Of]
8+
}
9+
10+
11+
trait IListDefn {
12+
sealed trait IList[A]
13+
case class INil[A]() extends IList[A]
14+
case class ICons[A](h: A, t: IList[A]) extends IList[A]
15+
}

0 commit comments

Comments
 (0)