-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add experimental Scala 2 macro compat #8811
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
216b840
to
4cd0547
Compare
7d5b4d9
to
7f5987a
Compare
// We do not enter Scala 2 macros defined in Scala 3. | ||
// Except if they are defined in StringContext to allow the compilation of the stdlib | ||
// dotty.communitybuild.CommunityBuildTest.stdLib213 | ||
if (sym.exists && (!sym.isScala2MacroInScala3 || sym.owner == defn.StringContextClass)) { |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise LGTM
// We do not enter Scala 2 macros defined in Scala 3. | ||
// Except if they are defined in StringContext to allow the compilation of the stdlib | ||
// dotty.communitybuild.CommunityBuildTest.stdLib213 | ||
if (sym.exists && (!sym.isScala2MacroInScala3 || sym.owner == defn.StringContextClass)) { |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
Ill try this out after scala 2 can read the latest tasty version, should be today or tomorrow |
I modified the code of the stdlib to not need the hacky condition in the compiler. Now those macros have their inline counterparts. |
c02d798
to
e3fbfc4
Compare
c19abee
to
d7adf22
Compare
2650e19
to
56a38a0
Compare
Ready for a second review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was able to use this to link a macro from Scala 2, so LGTM
Minimal version of #8199 aimed to unblock the experimentation of this feature on the Scala 2 TASTy unpickler. This version assumes that the macro is correctly implemented.
Important note: for this feature to work we need to have a version of Scala 2 that can rest TASTy signatures (this is work in progress).