Skip to content

Empty list of annotations attached to case class field #9737

Closed
@YuriyMazepin

Description

@YuriyMazepin

Method Symbol_annots form TASTy Reflect returns an empty list for the field symbol of the case class. Before 0.25 release it worked as expected

Minimized code

final case class N(n: Int) extends annotation.StaticAnnotation

@N(100) final case class Basic1(@N(21) int: Int)

val t = summon[typeOf[Basic1]]
val symbol = t.unseal.tpe.typeSymbol

println( s"typeAnnots:  ${symbol.annots}")
println( s"caseFieldsAnnots:  ${symbol.caseFields.map(_.annots)}")

Output

typeAnnots: List(Apply(Select(New(Ident(N)),<init>),List(Literal(Constant(100)))))
caseFieldsAnnots: List(List())

Expectation

typeAnnots: List(Apply(Select(New(Ident(N)),<init>),List(Literal(Constant(100)))))
caseFieldsAnnots: List(List(Apply(Select(New(Ident(N)),<init>),List(Literal(Constant(21))))))

Full example here

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions