File tree 4 files changed +29
-1
lines changed
4 files changed +29
-1
lines changed Original file line number Diff line number Diff line change 1
1
package scala .quoted
2
2
3
3
import scala .annotation .experimental
4
+ import scala .annotation .implicitNotFound
4
5
import scala .reflect .TypeTest
5
6
6
7
/** Current Quotes in scope
@@ -21,7 +22,23 @@ transparent inline def quotes(using q: Quotes): q.type = q
21
22
*
22
23
* It contains the low-level Typed AST API metaprogramming API.
23
24
* This API does not have the static type guarantees that `Expr` and `Type` provide.
25
+ *
26
+ * `Quotes` are generated from an enclosing `${ ... }` or `scala.staging.run`. For example:
27
+ * ```scala
28
+ * import scala.quoted._
29
+ * inline def myMacro: Expr[T] =
30
+ * ${ /* (quotes: Quotes) ?=> */ myExpr }
31
+ * def myExpr(using Quotes): Expr[T] =
32
+ * '{ f(${ /* (quotes: Quotes) ?=> */ myOtherExpr }) }
33
+ * }
34
+ * def myOtherExpr(using Quotes): Expr[U] = '{ ... }
35
+ * ```
24
36
*/
37
+ @ implicitNotFound(""" No given instance of type scala.quoted.Quotes was found.
38
+
39
+ Quotes are generated from an enclosing splice `$ { ... }` or `scala.staging.run` call.
40
+ Maybe that splice `$ { ... }` or `scala.staging.run` is missing?
41
+ """ )
25
42
trait Quotes { self : runtime.QuoteUnpickler & runtime.QuoteMatching =>
26
43
27
44
// Extension methods for `Expr[T]`
Original file line number Diff line number Diff line change
1
+ -- [E172] Type Error: tests/neg-macros/i16888.scala:1:38 ---------------------------------------------------------------
2
+ 1 |def test = summon[scala.quoted.Quotes] // error
3
+ | ^
4
+ | No given instance of type scala.quoted.Quotes was found.
5
+ |
6
+ | Quotes are generated from an enclosing splice `$ { ... }` or `scala.staging.run` call.
7
+ | Maybe that splice `$ { ... }` or `scala.staging.run` is missing?
Original file line number Diff line number Diff line change
1
+ def test = summon[scala.quoted.Quotes ] // error
Original file line number Diff line number Diff line change 1
1
-- [E172] Type Error: tests/neg-macros/i6436.scala:5:9 -----------------------------------------------------------------
2
2
5 | case '{ StringContext(${Varargs(parts)}*) } => // error
3
3
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4
- | No given instance of type scala.quoted.Quotes was found
4
+ | No given instance of type scala.quoted.Quotes was found.
5
+ |
6
+ | Quotes are generated from an enclosing splice `$ { ... }` or `scala.staging.run` call.
7
+ | Maybe that splice `$ { ... }` or `scala.staging.run` is missing?
5
8
-- [E006] Not Found Error: tests/neg-macros/i6436.scala:6:34 -----------------------------------------------------------
6
9
6 | val ps: Seq[Expr[String]] = parts // error
7
10
| ^^^^^
You can’t perform that action at this time.
0 commit comments