Skip to content

Commit 8db6b3e

Browse files
committed
Harden allOverriddenSymbols
Now also works for symbols that are not class members (and returns Iterator.empty for them).
1 parent c1b884b commit 8db6b3e

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/dotty/tools/dotc/core/Denotations.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ object Denotations {
378378
case info: SignedType =>
379379
try info.signature
380380
catch { // !!! DEBUG
381-
case ex: MatchError =>
381+
case ex: Throwable =>
382382
println(s"cannot take signature of ${info.show}")
383383
throw ex
384384
}

src/dotty/tools/dotc/core/SymDenotations.scala

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,14 @@ object SymDenotations {
321321
final def isAnonymousClass(implicit ctx: Context): Boolean =
322322
initial.asSymDenotation.name startsWith tpnme.ANON_CLASS
323323

324+
/** Is this symbol a class representing a refinement? These classes
325+
* are used only temporarily in Typer and Unpickler as an intermediate
326+
* step for creating Refinement types.
327+
*/
324328
final def isRefinementClass(implicit ctx: Context): Boolean =
325329
name.decode == tpnme.REFINE_CLASS
326330

331+
/** is this symbol a trait representing a type lambda? */
327332
final def isLambdaTrait(implicit ctx: Context): Boolean =
328333
isClass && name.startsWith(tpnme.LambdaPrefix)
329334

@@ -702,7 +707,7 @@ object SymDenotations {
702707

703708
/** All symbols overriden by this denotation. */
704709
final def allOverriddenSymbols(implicit ctx: Context): Iterator[Symbol] =
705-
if (exists)
710+
if (exists && owner.isClass)
706711
owner.info.baseClasses.tail.iterator map overriddenSymbol filter (_.exists)
707712
else
708713
Iterator.empty

0 commit comments

Comments
 (0)