Skip to content

Commit 9b1b87e

Browse files
committed
only constrain non-private type members
1 parent 5702af4 commit 9b1b87e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

compiler/src/dotty/tools/dotc/core/GadtConstraint.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import printing._
1212

1313
import scala.annotation.internal.sharable
1414
import Denotations.{Denotation, SingleDenotation}
15+
import SymDenotations.NoDenotation
1516

1617
/** Types that represent a path. Can either be a TermRef or a SkolemType. */
1718
type PathType = TermRef | SkolemType
@@ -283,9 +284,12 @@ final class ProperGadtConstraint private(
283284
case TypeAlias(_) => true
284285
case _ => false
285286

287+
def nonPrivate: Boolean = !denot1.isInstanceOf[NoDenotation.type]
288+
286289
(denot1.symbol.is(Flags.Deferred) || isTypeAlias)
287290
&& !denot1.symbol.is(Flags.Opaque)
288291
&& !denot1.symbol.isClass
292+
&& nonPrivate
289293
}
290294

291295
private def isConstrainableTypeMember(path: PathType, sym: Symbol)(using Context): Boolean =

0 commit comments

Comments
 (0)