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 fb83893 commit 3d79d40Copy full SHA for 3d79d40
compiler/src/dotty/tools/dotc/core/TypeOps.scala
@@ -930,7 +930,11 @@ object TypeOps:
930
for tp <- mixins.reverseIterator do
931
protoTp1 <:< tp
932
maximizeType(protoTp1, NoSpan)
933
- wildApprox(protoTp1)
+ val inst = wildApprox(protoTp1)
934
+ if !inst.classSymbol.exists then
935
+ // E.g. i21790, can't instantiate S#CA as a subtype of O.A, because O.CA isn't accessible
936
+ NoType
937
+ else inst
938
}
939
940
if (protoTp1 <:< tp2) instantiate()
tests/pos/i21790.scala
@@ -0,0 +1,14 @@
1
+package p
2
+
3
+trait S:
4
+ sealed trait A
5
+ private class CA() extends A
6
7
+object O extends S
8
9
+trait T
10
11
+class Test:
12
+ def f(e: T) = e match
13
+ case _: O.A =>
14
+ case _ =>
0 commit comments