Skip to content

Allow top-level splices not directly in the RHS #4826

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

Closed
wants to merge 4 commits into from

Conversation

nicolasstucki
Copy link
Contributor

@nicolasstucki nicolasstucki commented Jul 23, 2018

Based on #4823, followed by #4855

* top-level ~ must contain a call to a static method
  * arguments must be quoted
  * inline arguments can be passed directly
* removed dependency on the original inlined code (removed in PostTyper)
* ReifyQuotes is no longer an InfoTransformer
* Splicer implements both checking and evaluation of splices in a
  single abstraction
* Fix scala#4773
* Fix scala#4735
Now all levels are relative to the definition site.
0 is the level of all non-staged definitions, -1 is the level of
the contents of a top level splice (in an inline method) and positive
levels are (as before) staging levels.
Allow top-level ~ in and non static transparent method:
* Class methods (including inner and anonymous classes)
* Methods in def/val/var
@nicolasstucki nicolasstucki force-pushed the fix-#4801 branch 2 times, most recently from dbe1b4c to a87cf6d Compare July 27, 2018 09:14
@nicolasstucki nicolasstucki force-pushed the fix-#4801 branch 4 times, most recently from f4532e3 to 002e3b4 Compare July 27, 2018 12:18
@nicolasstucki nicolasstucki changed the title Fix #4801: WIP Allow top-level splices not directly in the RHS Jul 27, 2018
For example a transparent method can be defined as
```
transparent def foo(b: Boolean): Int =
  if (b) ~bar(true)
  else ~bar(false)
```

Removing this restriction also allows us to have a simpler implementation
of splicing and transparent def checking.

Removes last use of `Macro` flag in `ReifyQuotes`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant