Skip to content

Improve docs of code interpolator #8595

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 1 commit into from
Mar 23, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions library/src/scala/compiletime/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,21 @@ package object compiletime {
*/
inline def error(inline msg: String): Nothing = ???

/** Returns the string representations for code passed in the interpolated values
/** Returns the string representation of interpolated values:
*
* ```scala
* inline def logged(p1: => Any) = {
* val c = code"code: $p1"
* val res = p1
* (c, p1)
* }
* logged(indentity("foo"))
* ```
* is equivalent to:
* ```scala
* ("code: indentity("foo")", indentity("foo"))
* logged(identity("foo"))
* // above is equivalent to:
* // ("code: identity("foo")", identity("foo"))
* ```
*
* @note only by-name arguments will be displayed as "code".
* Other values may display unintutively.
*/
inline def (self: => StringContext) code (args: => Any*): String = ???

Expand Down