Skip to content

Cannot Refer to Path Dependent Type inside of type-quote  #8887

Closed
@deusaquilus

Description

@deusaquilus

Minimized code

Let's say we want to create a class with a PDT for example:

trait Context {
  type RowType
}

Then inside of a macro, I want to be able to use this PDT (i.e. RowType) inside of a type-quote

val tpe = '[$context.RowType]

I would want to do this for many reasons... for example to summon an object with it:

val decodeOpt = Expr.summon(using '[Decoder[$context.RowType, T]])

Only it doesn't work...

Output

The compiler fails with the following error:

[error] 34 |    val tpe = '[$context.RowType]
[error]    |                        ^
[error]    |                        ']' expected, but '.' found

Expectation

The code should compile and run properly. Statements like '[$foo.Bar] should be possible.

Code

A full code sample of this issue and a minimized version of my use-case is available here:
https://github.com/deusaquilus/pdt_typesummon

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions