Sangria derive macros seem to interfere with incremental compilation
See original GitHub issueQuite often when compiling via sbt without a clean myself as well as colleagues run into this error:
[error] Unknown type: (marginChar: Char)String <and> ()String, (marginChar: Char)String <and> ()String [class scala.reflect.internal.Types$OverloadedType, class scala.reflect.internal.Types$OverloadedType] TypeRef? false
scala.reflect.internal.FatalError: Unknown type: (marginChar: Char)String <and> ()String, (marginChar: Char)String <and> ()String [class scala.reflect.internal.Types$OverloadedType, class scala.reflect.internal.Types$OverloadedType] TypeRef? false
This only happens after modifying files containing containing a large number of sangria.macros.derive.* macro usages. Even adding a single new line to the file causes the failure and rerunning the compile after a clean always succeeds. I’m not familiar enough with Scala macros’ implementation to be sure if this might be due to sbt/scalac bugs/limitations w.r.t. macros or if this might possibly be a bug in Sangria’s derive* macros that triggers this.
I haven’t been able to produce the same problem yet in a cut down test project, but I’ve attached most of the sbt output in hopes something might be evident from that.
Sangria_Macro_Inc_Compile_Stacktrace.txt
Versions: Scala: 2.11.8 SBT: 0.13.9 Java: 1.8.0_91
Sangria Imports in a problem file: import sangria.macros.derive._ import sangria.schema._ import sangria.marshalling.playJson._ import sangria.marshalling._
Thanks for any help!
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (4 by maintainers)
Top GitHub Comments
Awesome, THANK YOU! We love using Sangria so far and are starting to use it more and more so these little fixes add up to make a big difference 😃
After implementing a cross-compilation to scala 2.12, I noticed that macro compilation became more stable and predictable.
Since some of the issues, described here, are addressed, I will close close the issue for now, but if this strange compiler behavior will occur again, I would suggest to repoen it, or (even better) create a new issue and reference this one (so that we can keep track of them)