Skip to content

Add specializing inline #5383

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 6 commits into from
Nov 8, 2018

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Nov 4, 2018

This PR just adds <: T return type syntax for inline methods and handles upcasting properly. The body of an inline method is upcasted to its return type, provided a return type is given with : T
(as opposed to <: T).

We previously did not do this which meant that all inline methods had some degree of whiteboxity even though it was claimed otherwise.

This PR is based on #5382.

Copy link
Member

@dottybot dottybot left a comment

Choose a reason for hiding this comment

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

Hello, and thank you for opening this PR! 🎉

All contributors have signed the CLA, thank you! ❤️

Commit Messages

We want to keep history, but for that to actually be useful we have
some rules on how to format our commit messages (relevant xkcd).

Please stick to these guidelines for commit messages:

  1. Separate subject from body with a blank line
  2. When fixing an issue, start your commit message with Fix #<ISSUE-NBR>:
  3. Limit the subject line to 72 characters
  4. Capitalize the subject line
  5. Do not end the subject line with a period
  6. Use the imperative mood in the subject line ("Add" instead of "Added")
  7. Wrap the body at 80 characters
  8. Use the body to explain what and why vs. how

adapted from https://chris.beams.io/posts/git-commit

Have an awesome day! ☀️

@odersky odersky force-pushed the add-specializing-inline branch 2 times, most recently from 5a360ec to c8398e8 Compare November 4, 2018 21:16
@odersky odersky force-pushed the add-specializing-inline branch 2 times, most recently from 01ae482 to fb919a5 Compare November 5, 2018 12:52
@odersky odersky force-pushed the add-specializing-inline branch from fb919a5 to 221d337 Compare November 8, 2018 13:24
Reverts the following commits:

Join containsQuotesOrSplices and containsInlineCalls (reverted from commit 8cf1385)
Make InlineCalls an object (reverted from commit ad26554)
Remove Inlined and InlineProxy from TASTy (reverted from commit 976e095)
Move inlining inside Reify quotes

Split some neg tests as now only the first error is emitted. (reverted from commit 21e65f1)
Erase rhs of erased non inlined val/def in PostTyper (reverted from commit c12e875)
Add isInlineCall to TreeInfo (reverted from commit 954c25b)
Update doc (reverted from commit 0832e02)
Only run InlineCalls if the tree contains an inline call (reverted from commit f28e2e1)
Check if unpickled tree has inline nodes (reverted from commit 927ae4e)
Add a bit of documentation (reverted from commit da0c249)
Fix constant folding during inlining (reverted from commit 32c8798)
Move inline β-reduction after Pickler (reverted from commit c68dc1f)
Normalize call at Inlined node creation (reverted from commit 746fdd7)
Move inline β-reduction after post typer (reverted from commit 432eb0a)
Move inline β-reduction out of typer (reverted from commit 6acaf31)
 - add new syntax
 - an inline method with an explicit `: T` result type section has its
   rhs upcasted to its return type. It was an oversight that this was not
   done before.
This affects both RefinedPrinter and ShowSougrceCode. Another example of the tax we pay
for maintaining both.

It required Chars to be moved to scala.tasty.
These tests all failed because we now put some inlined code in a Typed(...) node.
@nicolasstucki nicolasstucki merged commit 9a992f0 into scala:master Nov 8, 2018
@nicolasstucki nicolasstucki deleted the add-specializing-inline branch November 8, 2018 16:00
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