From 50b2cf801f478d21ff384fdbcf0972ddeff91613 Mon Sep 17 00:00:00 2001 From: Aleksander Boruch-Gruszecki Date: Mon, 23 Mar 2020 13:51:26 +0100 Subject: [PATCH] Improve docs of code interpolator --- library/src/scala/compiletime/package.scala | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/library/src/scala/compiletime/package.scala b/library/src/scala/compiletime/package.scala index 023183972c88..c611a99af62e 100644 --- a/library/src/scala/compiletime/package.scala +++ b/library/src/scala/compiletime/package.scala @@ -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 = ???