We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
$_
$_id
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
Dotty cannot parse $_ and $_id, while Scalac only supports $_.
object Test { implicit class Foo(sc: StringContext) { object q { def unapply(arg: Any): Option[(Any, Any)] = Some((sc.parts(0), sc.parts(1))) } } def main(args: Array[String]): Unit = { val q"class $_ extends $_parent" = new Object println(_parent) } }
The text was updated successfully, but these errors were encountered:
fix scala#1779: support $_ and $_id in interpolated string
4d91bd1
d14de3d
Forward a comment by @xeno-by :
In scalac, this only works for interpolation strings in patterns:
06:29 ~/Projects/2121/sandbox (HEAD)$ parse 'q"foo${_}"' /var/folders/81/zf4z2j9s4kl7qy76tgnhk2mh0000gn/T/tmp1M2lFu:2: error: unbound placeholder parameter q"foo${_}" ^ 06:29 ~/Projects/2121/sandbox (HEAD)$ parse 'val q"foo${_}" = ???' [[syntax trees at end of parser]]// Scala source: tmpbmFgw5 package <empty> { class wrapper extends scala.AnyRef { def <init>() = { super.<init>(); () }; <synthetic> <artifact> private[this] val x$1 = $qmark$qmark$qmark: @scala.unchecked match { case StringContext("foo", "").q(_) => () } } }
Sorry, something went wrong.
Merge pull request #1780 from dotty-staging/fix-i1779
1773b37
fix #1779: support $_ and $_id in interpolated string
liufengyun
No branches or pull requests
Dotty cannot parse
$_
and$_id
, while Scalac only supports$_
.The text was updated successfully, but these errors were encountered: