Open
Description
Compiler version
main, 3.3.5, probably any
Minimized code
(minimisation partially stolen from #22472)
@main def Test: Unit = {
class FooSmall[A, B] { type C; type D }
class FooLarge[A, B, C] { type D; type E }
type FooUnion[A, B] = FooSmall[A, B] | FooLarge[A, B, B]
println(Macro.typeMembers[FooUnion])
}
import scala.quoted.*
object Macro {
transparent inline def typeMembers[T <: AnyKind]: String = ${ typeMembersImpl[T] }
def typeMembersImpl[T <: AnyKind: Type](using quotes: Quotes): Expr[String] = {
import quotes.reflect.*
Expr(TypeRepr.of[T].typeSymbol.typeMembers.toString)
}
}
Output
List(val <none>, val <none>, val <none>, val <none>)
Expectation
Return either an empty list, or actually existing Symbols, not sure (probably the second one).