File tree Expand file tree Collapse file tree 4 files changed +9
-6
lines changed
reflect/scala/reflect/internal Expand file tree Collapse file tree 4 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -138,7 +138,7 @@ trait TreeAndTypeAnalysis extends Debugging {
138
138
139
139
if (grouped) {
140
140
def enumerateChildren (sym : Symbol ) = {
141
- sym.children .toList
141
+ sym.sealedChildren .toList
142
142
.sortBy(_.sealedSortName)
143
143
.filterNot(x => x.isSealed && x.isAbstractClass && ! isPrimitiveValueClass(x))
144
144
}
Original file line number Diff line number Diff line change @@ -212,8 +212,8 @@ trait Checkable {
212
212
)
213
213
/** Are all children of these symbols pairwise irreconcilable? */
214
214
def allChildrenAreIrreconcilable (sym1 : Symbol , sym2 : Symbol ) = (
215
- sym1.children .toList forall (c1 =>
216
- sym2.children .toList forall (c2 =>
215
+ sym1.sealedChildren .toList forall (c1 =>
216
+ sym2.sealedChildren .toList forall (c2 =>
217
217
areIrreconcilableAsParents(c1, c2)
218
218
)
219
219
)
Original file line number Diff line number Diff line change @@ -1694,6 +1694,8 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
1694
1694
psym addChild context.owner
1695
1695
else
1696
1696
pending += ParentSealedInheritanceError (parent, psym)
1697
+ if (psym.isLocalToBlock && ! phase.erasedTypes)
1698
+ psym addChild context.owner
1697
1699
val parentTypeOfThis = parent.tpe.dealias.typeOfThis
1698
1700
1699
1701
if (! (selfType <:< parentTypeOfThis) &&
Original file line number Diff line number Diff line change @@ -980,7 +980,7 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
980
980
private def isNotOverridden = (
981
981
owner.isClass && (
982
982
owner.isEffectivelyFinal
983
- || owner.isSealed && owner.children .forall(c => c.isEffectivelyFinal && (overridingSymbol(c) == NoSymbol ))
983
+ || ( owner.isSealed && owner.sealedChildren .forall(c => c.isEffectivelyFinal && (overridingSymbol(c) == NoSymbol ) ))
984
984
)
985
985
)
986
986
@@ -2495,14 +2495,15 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
2495
2495
def associatedFile : AbstractFile = enclosingTopLevelClass.associatedFile
2496
2496
def associatedFile_= (f : AbstractFile ) { abort(" associatedFile_= inapplicable for " + this ) }
2497
2497
2498
- /** If this is a sealed class, its known direct subclasses.
2498
+ /** If this is a sealed or local class, its known direct subclasses.
2499
2499
* Otherwise, the empty set.
2500
2500
*/
2501
2501
def children : Set [Symbol ] = Set ()
2502
+ final def sealedChildren : Set [Symbol ] = if (! isSealed) Set .empty else children
2502
2503
2503
2504
/** Recursively assemble all children of this symbol.
2504
2505
*/
2505
- def sealedDescendants : Set [Symbol ] = children.flatMap(_.sealedDescendants) + this
2506
+ final def sealedDescendants : Set [Symbol ] = if ( ! isSealed) Set ( this ) else children.flatMap(_.sealedDescendants) + this
2506
2507
2507
2508
@ inline final def orElse (alt : => Symbol ): Symbol = if (this ne NoSymbol ) this else alt
2508
2509
@ inline final def andAlso (f : Symbol => Unit ): Symbol = { if (this ne NoSymbol ) f(this ) ; this }
You can’t perform that action at this time.
0 commit comments