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

Intrinsify scala.compiletime.testing.typeChecks #7129

Conversation

nicolasstucki
Copy link
Contributor

As know from the start, this funtionallity should not have been added to the reflection API.
Nevertheless it is still possible to use its result in a macro.

@nicolasstucki
Copy link
Contributor Author

nicolasstucki commented Aug 29, 2019

@liufengyun could you help me to update the scalatest macros to use this new version? Have a look at how I handled it in tests/run-macros/reflect-typeChecks/assert_1.scala

@milessabin
Copy link
Contributor

Is this going to break shapeless as well?

I'm happy to update as soon as there's a nightly build published with the change.

@nicolasstucki
Copy link
Contributor Author

Shapeless should not be affected. CI tests passed for it.

@nicolasstucki
Copy link
Contributor Author

I will update minitest. With this change we will not need the macro anymore as it fixed #7040 and we can use that as implementation.

@liufengyun
Copy link
Contributor

@nicolasstucki I'll have a look at ScalaTest.

@liufengyun
Copy link
Contributor

@nicolasstucki This change makes it awkward to implement macros like assertDoesNotDompile in ScalaTest, as now it's impossible to call typeChecks from macro implementation --- the method has to be called inside the inline method.

On reflection, it seems compiletime + inline is not a good combination for the API, as one program's compile-time could be another program's run-time. The change makes it impossible to use the API from staging and macro implementation.

BTW, what makes it not fit in reflection API?

As know from the start, this funtionallity should not have been added to the reflection API.

As know from the start, this funtionallity should not have been added to the reflection API.
Nevertheless it is still possible to use its result in a macro.
@nicolasstucki nicolasstucki force-pushed the intrisify-compiletime-testing-typechecks branch from 048accd to 48d88bc Compare September 2, 2019 07:20
@nicolasstucki
Copy link
Contributor Author

It does not fit the TASTy reflection API because it has nothing to do with typed trees. We just added it there because it was a simple but dirty way to support it and unblock the scalatest/minitest macros.

@nicolasstucki nicolasstucki marked this pull request as ready for review September 4, 2019 07:03
Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR decides that typeChecks should only be used in inline methods instead of macros.

Approve based on the following reasons:

  • the impact is limited AFAWK (some ScalaTest DSL has to be redesigned),
  • it's always possible to restore the API when there is strong need.

@liufengyun liufengyun merged commit b151414 into scala:master Sep 4, 2019
@liufengyun liufengyun deleted the intrisify-compiletime-testing-typechecks branch September 4, 2019 09:04
@anatoliykmetyuk anatoliykmetyuk added this to the 0.19 Tech Preview milestone Sep 19, 2019
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.

5 participants