Skip to content

Expose Symbol.sealedStrictDescendants in Quoted API #17696

@cchantep

Description

@cchantep

Similar to previous Scala2 knownDirectSubclasses and based on dotc sealedStrictDescendants.

diff --git a/compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala b/compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala
index 3de7f0bfc6..0f69c849b0 100644
--- a/compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala
+++ b/compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala
@@ -2622,6 +2622,9 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
         def companionModule: Symbol = self.denot.companionModule
         def children: List[Symbol] = self.denot.children
 
+        def sealedStrictDescendants: List[Symbol] = 
+          self.denot.sealedStrictDescendants
+
         def show(using printer: Printer[Symbol]): String = printer.show(self)
 
       end extension
diff --git a/library/src/scala/quoted/Quotes.scala b/library/src/scala/quoted/Quotes.scala
index a375709844..4c2856e3b3 100644
--- a/library/src/scala/quoted/Quotes.scala
+++ b/library/src/scala/quoted/Quotes.scala
@@ -3783,6 +3783,10 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
 
         /** Case class or case object children of a sealed trait or cases of an `enum`. */
         def children: List[Symbol]
+
+        /** Recursively assemble all children of this symbol */
+        def sealedStrictDescendants: List[Symbol]
+
       end extension
     }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions