You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to write a more semantic port of the findOwner function of the dotty version in sourcecode. This causes a CyclicReference exception.
Minimized code
objectFoo {
inlinedefgenOwner:String=${ util.Macros.genOwnerImpl() }
}
// main@main defentry= {
println(Foo.genOwner)
}
//macrosimportscala.quoted._importscala.tasty.ReflectionobjectMacros {
//a specialization of the `findOwner` function from `sourcecode` for our purposesprivatedeffirstNonSyntheticOwner(c: Reflection, s : c.Symbol): c.Symbol= {
importc.{given_}
if (s.flags.is(c.Flags.Synthetic)) firstNonSyntheticOwner(c, s.owner)
else s
}
defgenOwnerImpl()(usingqctx: QuoteContext):Expr[String] = {
Expr(firstNonSyntheticOwner(qctx.tasty, qctx.tasty.rootContext.owner).name)
}
}
Output (click arrow to expand)
[error] 16 | println(Foo.genOwner)
[error] | ^^^^^^^^^^^^
[error] |Exception occurred while executing macro expansion.
[error] |dotty.tools.dotc.core.CyclicReference:
[error] | at dotty.tools.dotc.core.CyclicReference$.apply(TypeErrors.scala:156)
[error] | at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:257)
[error] | at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:186)
[error] | at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:188)
[error] | at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:446)
[error] | at dotty.tools.dotc.core.SymDenotations$SymDenotation.flags(SymDenotations.scala:158)
[error] | at dotty.tools.dotc.tastyreflect.ReflectionCompilerInterface.Symbol_flags(ReflectionCompilerInterface.scala:1669)
[error] | at dotty.tools.dotc.tastyreflect.ReflectionCompilerInterface.Symbol_flags(ReflectionCompilerInterface.scala:1669)
[error] | at scala.tasty.Reflection$SymbolOps$.flags(Reflection.scala:2129)
[error] | at Macros$.firstNonSyntheticOwner(SourceContextMacros.scala:11)
[error] | at Macros$.genOwnerImpl(SourceContextMacros.scala:16)
[error] |
[error] | This location contains code that was inlined from Main.scala:16
[error] one error found
The text was updated successfully, but these errors were encountered:
I am trying to write a more semantic port of the
findOwner
function of the dotty version in sourcecode. This causes aCyclicReference
exception.Minimized code
Output (click arrow to expand)
The text was updated successfully, but these errors were encountered: