We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3.2.1-RC1-bin-20220705-9bb3108-NIGHTLY-git-9bb3108
package test class Foo(val name: String) object Bar extends Foo("bar") object Macros { import scala.quoted.{Expr, Quotes, Type} inline def show[A]: String = ${ showImpl[A] } def showImpl[A](using tpe: Type[A], q: Quotes): Expr[String] = { import q.reflect.* val repr = TypeRepr.of[A](using tpe) val tpeSym = repr.typeSymbol Expr(tpeSym.tree.show) } }
> _root_.test.Macros.show[_root_.test.Bar.type] val res0: String = @scala.annotation.internal.SourceFile("macros/src/main/scala-3/enumeratum/Foo.scala") object Bar extends test.Foo { this: test.Bar.type => }
Following Tree should be resolved from the super call.
Tree
Literal(Constant("bar"))
Having the macro from the reproducer in a separate file doesn't help (same result).
Using repr.typeSymbol.companionModule instead of repr.typeSymbol resolves as bellow:
repr.typeSymbol.companionModule
repr.typeSymbol
"lazy val Bar: test.Bar.type"
Try repr.typeSymbol.primaryConstructor doesn't help much:
repr.typeSymbol.primaryConstructor
"def this()"
Even trying to patter-match on it:
tpeSym.tree match { case DefDef(_, _, _, rhs) => println(s"Constructor rhs = $rhs") case _ => } // => "Constructor rhs = None"
The text was updated successfully, but these errors were encountered:
Maybe related to #15799
Sorry, something went wrong.
Cause may be same as for #14195 but none of the workaround is sufficient
That's quite a blocker. I'm trying to debug it, but there is no test that can be easily executed while developing quotes impl in this code base.
Confirmed to be related to -Yretain-trees
-Yretain-trees
No branches or pull requests
Compiler version
3.2.1-RC1-bin-20220705-9bb3108-NIGHTLY-git-9bb3108
Minimized code
Output
Expectation
Following
Tree
should be resolved from the super call.Alternatives
Having the macro from the reproducer in a separate file doesn't help (same result).
Using
repr.typeSymbol.companionModule
instead ofrepr.typeSymbol
resolves as bellow:"lazy val Bar: test.Bar.type"
Try
repr.typeSymbol.primaryConstructor
doesn't help much:"def this()"
Even trying to patter-match on it:
The text was updated successfully, but these errors were encountered: