-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Intrinsify StringContext.f #9929
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 StringContext.f #9929
Conversation
This will unblock #9925 |
compiler/src/dotty/tools/dotc/transform/localopt/StringContextChecker.scala
Outdated
Show resolved
Hide resolved
import dotty.tools.dotc.core.Types._ | ||
|
||
// Ported from old dotty.internal.StringContextMacro | ||
// TODO: port Scala 2 logic? (see https://github.com/scala/scala/blob/2.13.x/src/compiler/scala/tools/reflect/FormatInterpolator.scala#L74) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does the Scala 2 logic do that is different?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a completely different implementation. Not sure which one is better. Someone will have to check that at some point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scala 2 f
goes overboard to verify the format, but is it worthwhile maintaining code for a slow string mechanism.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I remember this implementation covered all the Scala 2 f
interpolator test cases. They diverged slightly on the second error after some kinds of error in the format part of the string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought I saw checks that weren't implemented (way in the past); if I have a chance, I'll compare again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might have missed something. It would be ok for me to use the Scala 2 implementation but it would take a more effort to port. I could have a look in the future or let someone else try it. The current priority is to unblock #9925.
Ported the current macro implementation
14ae862
to
ef19bcd
Compare
Ported the current macro implementation