Skip to content

Use transparent inline in the library #8756

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

Conversation

nicolasstucki
Copy link
Contributor

@nicolasstucki nicolasstucki commented Apr 20, 2020

The first commit contains the interesting changes. The second only updates the syntax in the tests to make sure that the new version works properly.

@nicolasstucki nicolasstucki force-pushed the use-transparent-inline-in-the-library branch from 8447ab2 to a8a1a4a Compare April 20, 2020 18:51
And add deprecation warnings for old syntax
@nicolasstucki nicolasstucki force-pushed the use-transparent-inline-in-the-library branch from a8a1a4a to 2548798 Compare April 20, 2020 18:51
@nicolasstucki nicolasstucki marked this pull request as ready for review April 20, 2020 18:55
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.

LGTM

@@ -8,7 +8,7 @@ object DottyPredef {
assertFail(message)
}

inline final def assert(inline assertion: Boolean) <: Unit = {
transparent inline final def assert(inline assertion: Boolean): Unit = {
if (!assertion)
assertFail()
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe I miss something here, what is the purpose of making this white box, as the result type is Unit?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you write assert(false) the inclined expression becomes of type Nothing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is like a ??? With a message

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if this should be supported thought

@nicolasstucki nicolasstucki merged commit 1516b06 into scala:master Apr 21, 2020
@nicolasstucki nicolasstucki deleted the use-transparent-inline-in-the-library branch April 21, 2020 09:31
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