Skip to content
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

Macro expansion error is breaking during pretty print #455

Closed
mateor opened this issue Aug 30, 2016 · 2 comments
Closed

Macro expansion error is breaking during pretty print #455

mateor opened this issue Aug 30, 2016 · 2 comments
Labels

Comments

@mateor
Copy link

mateor commented Aug 30, 2016

So, I don't have a good idea of the internals here yet. But I am experimenting with the Ammonite Repl 0.7.5 and really like it. But I hit a breakage.

My trace looks something like this:

@ val my_user = my.mongo.record("a_user").get
my_user: User <etc>
@ my_user.recordDetails.getCertainDetails
cmd12.sc:8: exception during macro expansion:
java.lang.AssertionError: assertion failed: mkAttributedQualifier(my.mongo.record, <none>)
    at scala.reflect.internal.TreeGen.mkAttributedQualifier(TreeGen.scala:86)
    at scala.reflect.internal.TreeGen.mkAttributedQualifier(TreeGen.scala:62)
    at scala.reflect.internal.TreeGen.mkAttributedRef(TreeGen.scala:122)
    at scala.reflect.internal.Internals$$anon$4.mkAttributedRef(Internals.scala:151)
    at scala.reflect.internal.Internals$$anon$4.mkAttributedRef(Internals.scala:148)
    at derive.Derive.deriveObject(Derive.scala:358)
    at derive.Derive$$anonfun$9.apply(Derive.scala:238)
    at derive.Derive$$anonfun$9.apply(Derive.scala:235)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
    at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
    at scala.collection.immutable.Map$Map1.foreach(Map.scala:116)
    at scala.collection.TraversableLike$class.map(TraversableLike.scala:234)
    at scala.collection.AbstractTraversable.map(Traversable.scala:104)
    at derive.Derive.deriveType(Derive.scala:235)
    at derive.Derive.derive(Derive.scala:60)
    at pprint.Internals$LowerPriPPrint$.liftedTree1$1(PPrint.scala:408)
    at pprint.Internals$LowerPriPPrint$.FinalRepr(PPrint.scala:408)
    at sun.reflect.GeneratedMethodAccessor11.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at scala.reflect.macros.runtime.JavaReflectionRuntimes$JavaReflectionResolvers$$anonfun$resolveJavaReflectionRuntime$2.apply(JavaReflectionRuntimes.scala:34)
    at scala.reflect.macros.runtime.JavaReflectionRuntimes$JavaReflectionResolvers$$anonfun$resolveJavaReflectionRuntime$2.apply(JavaReflectionRuntimes.scala:22)
    at scala.tools.nsc.typechecker.Macros$class.macroExpandWithRuntime(Macros.scala:763)

            .print(res12, res12, "res12", _root_.scala.None)
                  ^
Compilation Failed

This only happens in a chained invocation, for instance the following works

@ my_user.recordDetails
res2: recordDetails = <details>
@ res2.getCertainDetails
res3: res2.getCertainDetails.type = Map(<etc>)

I saw some potentially related issues, but they are all marked solved. So I checked if it was a regression and at least com-lihaoyi/upickle#92 appears to be live again, or at least a possibly related error occurs.

(gist used since the trace is so long: https://gist.github.com/mateor/09cacda6b6ae39965b2a2e1b3e78e266)

@lihaoyi
Copy link
Member

lihaoyi commented May 18, 2017

Should be fixed by 662859f

@lihaoyi lihaoyi closed this as completed May 18, 2017
@lihaoyi
Copy link
Member

lihaoyi commented May 21, 2017

http://www.lihaoyi.com/Ammonite/#0.9.0 is out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants