8000
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.
1 parent 31bc496 commit 7e1c72eCopy full SHA for 7e1c72e
_overviews/scala3-macros/faq.md
@@ -54,3 +54,21 @@ Here are two examples that should give you the basic skeleton for your variant o
54
case _ => None
55
}
56
```
57
+
58
+## How do I summon an expression for statically unknown type
59
60
+If you have a `TypeRepr` use
61
+```scala
62
+val tpe: TypeRepr = ...
63
+Implicits.search(tpe) match
64
+ case result: ImplicitSearchSuccess => result.tree
65
+ case _ =>
66
+```
67
68
+If there you have a `Type[_]` use
69
70
+val tpe: Type[_] = ...
71
+tpe match
72
+ // Given the name `a` to the type in tpe and provide a given `Type[a]`
73
+ case '[a] => Expr.summon[a]
74
0 commit comments