Open
Description
Compiler version
3.6.3
note, was not an issue before I bumped from 3.3.0
edit
: I reverted to 3.3.0
, and apparently it was still an issue, actually
Minimized code
TypeRepr.of[A].typeSymbol.caseFields.map(_.tree)
TypeRepr.of[A].typeSymbol.declaredFields.map(_.tree)
Output
[error] |Exception occurred while executing macro expansion.
[error] |scala.MatchError: DefDef(int,List(List()),TypeTree[TypeRef(ThisType(TypeRef(NoPrefix,module class scala)),class Int)],EmptyTree) (of class dotty.tools.dotc.ast.Trees$DefDef)
Expectation
- Expect that compiler wont throw
MatchError
- In
3.3.0
, these were returning asValDef
Code I was using:
typeSymbol: Symbol = typeRepr.typeSymbol
caseFieldSymbols: List[Symbol] = typeSymbol.caseFields
caseFieldSymbols.traverse { sym =>
sym.tree match {
case valDef: ValDef => valDef.asRight
case _ => s"Somehow not a `ValDef`: ${sym.fullName}".asLeft
}