Skip to content

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

Merged
merged 1 commit into from
May 8, 2020

Conversation

nicolasstucki
Copy link
Contributor

@nicolasstucki nicolasstucki commented Apr 27, 2020

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).

@nicolasstucki nicolasstucki self-assigned this Apr 27, 2020
@nicolasstucki nicolasstucki force-pushed the scala2-macro-compat-core branch 5 times, most recently from 216b840 to 4cd0547 Compare April 28, 2020 09:10
@nicolasstucki nicolasstucki removed the request for review from bishabosha April 28, 2020 09:52
@nicolasstucki nicolasstucki force-pushed the scala2-macro-compat-core branch 2 times, most recently from 7d5b4d9 to 7f5987a Compare April 28, 2020 12:38
// 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.

@nicolasstucki nicolasstucki marked this pull request as ready for review April 28, 2020 14:10
@nicolasstucki nicolasstucki requested a review from odersky April 28, 2020 14:10
Copy link
Contributor

@odersky odersky left a 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.

@odersky odersky assigned nicolasstucki and unassigned odersky Apr 28, 2020
@bishabosha
Copy link
Member

Ill try this out after scala 2 can read the latest tasty version, should be today or tomorrow

@nicolasstucki
Copy link
Contributor Author

#8811 (comment)

I modified the code of the stdlib to not need the hacky condition in the compiler. Now those macros have their inline counterparts.

@nicolasstucki nicolasstucki force-pushed the scala2-macro-compat-core branch 4 times, most recently from c02d798 to e3fbfc4 Compare April 29, 2020 12:20
@nicolasstucki nicolasstucki force-pushed the scala2-macro-compat-core branch from c19abee to d7adf22 Compare April 29, 2020 14:15
@nicolasstucki nicolasstucki force-pushed the scala2-macro-compat-core branch from 2650e19 to 56a38a0 Compare April 29, 2020 16:39
@nicolasstucki
Copy link
Contributor Author

Ready for a second review

Copy link
Member

@bishabosha bishabosha left a 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

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

Successfully merging this pull request may close these issues.

3 participants