Skip to content

Commit 6bb198a

Browse files
committed
Fix CI
1 parent 46ca9a1 commit 6bb198a

File tree

5 files changed

+6
-5
lines changed

5 files changed

+6
-5
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ class SymUtils(val self: Symbol) extends AnyVal {
138138
def register(child: Symbol, parent: Type) = {
139139
val cls = parent.classSymbol
140140
if (cls.is(Sealed)) {
141-
if ((child.isLocal || child.isAnonymousClass) && !self.hasAnonymousChild)
141+
if ((child.isInaccessibleChildOf(cls) || child.isAnonymousClass) && !self.hasAnonymousChild)
142142
cls.addAnnotation(Annotation.Child(cls))
143143
else cls.addAnnotation(Annotation.Child(child))
144144
}

compiler/src/dotty/tools/dotc/transform/patmat/Space.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -777,8 +777,6 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
777777
case tp: RefinedType => refine(tp.parent)
778778
case tp: AppliedType => refine(tp.typeConstructor)
779779
case tp: ThisType => refine(tp.tref)
780-
case TypeRef(NoPrefix, _) if tp.classSymbol.isAnonymousClass =>
781-
tp.parents.reduce(AndType.apply).show + "(anonymous)"
782780
case tp: NamedType =>
783781
val pre = refinePrefix(tp.prefix)
784782
if (tp.name == tpnme.higherKinds) pre
@@ -852,6 +850,8 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
852850
if (mergeList) "_: _*" else "_: List"
853851
else if (scalaConsType.isRef(sym))
854852
if (mergeList) "_, _: _*" else "List(_, _: _*)"
853+
else if (tp.classSymbol.is(Sealed) && tp.classSymbol.hasAnonymousChild)
854+
"_: " + showType(tp) + " (anonymous)"
855855
else if (tp.classSymbol.is(CaseClass) && !hasCustomUnapply(tp.classSymbol))
856856
// use constructor syntax for case class
857857
showType(tp) + params(tp).map(_ => "_").mkString("(", ", ", ")")

tests/patmat/anonym.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
10: Pattern Match Exhaustivity: _: Identifier(anonymous)
1+
10: Pattern Match Exhaustivity: _: Identifier (anonymous)

tests/patmat/t9677.check

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
18: Pattern Match Exhaustivity: _: Base (anonymous)

tests/patmat/t9677.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ object ExhaustiveMatchWarning {
1515

1616
def test: Unit = {
1717
val b: Base = A("blabla")
18-
b match {
18+
b match { // A.apply creates anonymous class <: Base
1919
case A.Root => println("Root")
2020
case path: A => println("Not root")
2121
}

0 commit comments

Comments
 (0)