Prepare to make StringContext.{f,raw} into macros#7678
Conversation
That will break any use of these methods from projects compiled with Dotty. We might be able to shadow them to avoid that but we'll need to coordinate on that. |
f2654a8 to
0888246
Compare
0888246 to
0cc8d38
Compare
|
We'd like to perform the bootstrap before RC1. Do you think that's workable? |
|
Not sure, we still have some work to do to catch up with the recent changes to the standard library (unapply for string interpolators, ...). |
3db6193 to
97fca5c
Compare
after bootstrap, we can turn the def s / def raw's RHS into macro ??? until then, pretend they are Minimal backstop for bug 10870
97fca5c to
70ddce4
Compare
| final class RunDefinitions { | ||
| // until we bootstrap and they are implemented as `macro ???` to trigger fasttrack directly | ||
| def treatLikeMacro(sym: Symbol) = | ||
| sym.isMethod && ((sym.name == nme.s || sym.name == nme.raw_) && sym.owner == StringContextClass) && (sym == StringContext_s || sym == StringContext_raw) |
There was a problem hiding this comment.
Why not just:
def treatLikeMacro(sym: Symbol) = (sym eq StringContext_s) || (sym eq StringContext_raw)
There was a problem hiding this comment.
This method seemed to be hit a lot.
There was a problem hiding this comment.
(Early on in type checking, so didn’t want to force symbols when not needed.)
|
This is a novel approach to fast-tracking the way to FastTrack. I think I understand it, seems okay :) Have you locally tried the followup change? Could you share that branch so we can see the end result? |
| try | ||
| parts.mapConserve { case lit@Literal(Constant(stringVal: String)) => | ||
| val k = Constant(StringContext.processEscapes(stringVal)) | ||
| // To avoid the backlash of backslash, taken literally by Literal, escapes are processed strictly (scala/bug#11196) |
There was a problem hiding this comment.
That's quite some comment archaeology.
|
Yep, I’ve confirmed that STARRing this PR, the method bodies of the two interpolators can be |
|
we have now re-STARRed |
Fallback to the old style when the more than 64 varargs are provided. Backport of a limit introduced in 2.13.x in scala#7678
hijack string interpolators during typer
after bootstrap, we can turn the def s / def raw's RHS into macro ???
until then, pretend they are
Fix scala/bug#11366
Backstop for scala/bug#10870, but could be improved