Skip to content

Commit 16b74d8

Browse files
Merge pull request #8595 from dotty-staging/fix/i7216
Improve docs of code interpolator
2 parents 8a1810c + 50b2cf8 commit 16b74d8

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

library/src/scala/compiletime/package.scala

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,21 @@ package object compiletime {
1717
*/
1818
inline def error(inline msg: String): Nothing = ???
1919

20-
/** Returns the string representations for code passed in the interpolated values
20+
/** Returns the string representation of interpolated values:
21+
*
2122
* ```scala
2223
* inline def logged(p1: => Any) = {
2324
* val c = code"code: $p1"
2425
* val res = p1
2526
* (c, p1)
2627
* }
27-
* logged(indentity("foo"))
28-
* ```
29-
* is equivalent to:
30-
* ```scala
31-
* ("code: indentity("foo")", indentity("foo"))
28+
* logged(identity("foo"))
29+
* // above is equivalent to:
30+
* // ("code: identity("foo")", identity("foo"))
3231
* ```
32+
*
33+
* @note only by-name arguments will be displayed as "code".
34+
* Other values may display unintutively.
3335
*/
3436
inline def (self: => StringContext) code (args: => Any*): String = ???
3537

0 commit comments

Comments
 (0)