-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Improve presentation compiler with Shapeless macros #5929
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
Conversation
`-Ymacro-expand` discard was introduced to leave prefixes and arguments of implicit applications in the typechecked tree in the presentation compiler to facilite completion, type-at-cursor, etc within those trees. It seems that this mode interferes with implicit searches that involve Shapeless's `mkLazy` macro. This commit simply turns off the macro expansion discarding if the currnt macro application is part of an application of implicit arguments. There is no trees corresponding to source code in that position, so we the concerns about IDE functionality are moot. I couldn't disentangle the bug report from circe and shapeless, so I've manually tested that the compiler from this commit makes the following test project compile. https://github.com/retronym/t9716
@mpollmeier @milessabin Perhaps you could give the combination of this and #5927 a spin in Ensime (instructions) to see if it makes life better? Be sure to disable the any manual setting of /cc @fommil |
we use BTW, somewhat related me and @dragos started writing https://github.com/ensime/ensime-plugin-implicits but ran out of time. This will have huge benefits for presentation compiler users in implicit-heavy codebases. |
Prior to this change, both discard and normal mode would lead to problems
in different circumstances. Users of Scala IDE found that by explicitly
selecting normal, which stops the pres compiler defaulting to discard,
shapeless worked better. But they would sacrifice code completion in the
arguments of non-implicit macros
After this change, discard should work for both use cases. I want to make
sure anyone testing this patch tests it under that configuration.
|
awesome, looking forward to this! @mpollmeier if you'd like to help out with presentation compiler testing / performance there are a few things I have in mind, none of them particularly onerous 😄 |
-Ymacro-expand
discard was introduced to leave prefixes andarguments of implicit applications in the typechecked tree in the
presentation compiler to facilite completion, type-at-cursor, etc
within those trees.
It seems that this mode interferes with implicit searches that involve
Shapeless's
mkLazy
macro.This commit simply turns off the macro expansion discarding if
the current macro application is part of an application of implicit
arguments. There is no trees corresponding to source code in that
position, so we the concerns about IDE functionality are moot.
I couldn't disentangle the bug report from circe and shapeless,
so I've manually tested that the compiler from this commit
makes the following test project compile.
https://github.com/retronym/t9716
Fixes scala/bug#9716