Skip to content

CyclicReference crash when expanding a macro that returns a refinement #7513

New issue

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

Closed
biboudis opened this issue Nov 7, 2019 · 1 comment
Closed

Comments

@biboudis
Copy link
Contributor

biboudis commented Nov 7, 2019

The code below crashes during macro expansion of quote with a dotty.tools.dotc.core.CyclicReference.

minimized code

  trait Quoted {
    def foo: Int
  }
  inline def quote: Quoted = ${ quoteImpl }

  def quoteImpl(given qctx: QuoteContext): Expr[Quoted] = '{
    new Quoted {
      def foo = ???
    }
  }

same happens with val.

Exception occurred while executing macro expansion.
  |  dotty.tools.dotc.core.CyclicReference: 
  |     at dotty.tools.dotc.core.CyclicReference$.apply(TypeErrors.scala:154)
  |     at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:255)
  |     at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:182)
  |     at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:184)
  |     at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:397)
  |     at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readNewDef(TreeUnpickler.scala:802)
  |     at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readIndexedDef(TreeUnpickler.scala:737)
  |     at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readIndexedStat(TreeUnpickler.scala:932)
  |     at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readIndexedStats$$anonfun$1(TreeUnpickler.scala:980)
  |     at dotty.tools.dotc.core.tasty.TastyReader.until(TastyReader.scala:127)
  |     at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readIndexedStats(TreeUnpickler.scala:980)
  |     at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readStats(TreeUnpickler.scala:984)
  |     at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readLengthTerm$1(TreeUnpickler.scala:1096)
  |     at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readTerm(TreeUnpickler.scala:1203)
  |     at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readLengthTerm$1(TreeUnpickler.scala:1108)
  |     at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readTerm(TreeUnpickler.scala:1203)
  |     at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readTerm(TreeUnpickler.scala:999)
  |     at dotty.tools.dotc.core.tasty.TreeUnpickler.unpickle(TreeUnpickler.scala:104)
  |     at dotty.tools.dotc.core.tasty.DottyUnpickler.computeRootTrees(DottyUnpickler.scala:57)
  |     at dotty.tools.dotc.ast.tpd$TreeProvider.rootTrees(tpd.scala:1091)
  |     at dotty.tools.dotc.core.tasty.DottyUnpickler.rootTrees(DottyUnpickler.scala:39)
  |     at dotty.tools.dotc.ast.tpd$TreeProvider.tree(tpd.scala:1095)
  |     at dotty.tools.dotc.core.tasty.DottyUnpickler.tree(DottyUnpickler.scala:39)
  |     at dotty.tools.dotc.core.quoted.PickledQuotes$.unpickle(PickledQuotes.scala:129)
  |     at dotty.tools.dotc.core.quoted.PickledQuotes$.unpickleExpr(PickledQuotes.scala:64)
  |     at dotty.tools.dotc.tastyreflect.ReflectionCompilerInterface.unpickleExpr(ReflectionCompilerInterface.scala:36)
  |     at scala.runtime.quoted.Unpickler$.unpickleExpr$direct(Unpickler.scala:16)
  |     at Test$.quoteImpl(Test_1.scala:55)

expectation

Should work

nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Nov 12, 2019
nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Nov 12, 2019
@biboudis
Copy link
Contributor Author

Fixed with #7531

nicolasstucki added a commit to dotty-staging/dotty that referenced this issue Nov 12, 2019
liufengyun added a commit that referenced this issue Nov 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant