Skip to content

Expand case class default values example #32

@evbo

Description

@evbo

Hi,

I think this defaultParamsInference is a great example I'd like to extend further to include the type of each case class field.

What amazes me is I didn't realize you can cast a Tree as you do here:
https://github.com/lampepfl/dotty-macro-examples/blob/main/defaultParamsInference/src/macro.scala#L18

I thought I would need to use the Symbol's signature to get the type but I don't see a lot of documentation for signature or how to access type information (such as individually selecting types from higher orders, such as List[Int], as enabled in scala 2 by typeSignature or scala.reflect.macros.Context.typeCheck).

So can someone please clarify how tree or signature can be used to get detailed type information for each case class field?

Thanks!

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