Skip to content

Commit f6231ec

Browse files
committed
Add test
1 parent b1380ed commit f6231ec

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import scala.quoted.*
2+
3+
inline def getDocString[T]: Option[String] = ${ getDocStringImpl[T] }
4+
5+
private def getDocStringImpl[T : Type](using Quotes): Expr[Option[String]] = {
6+
import quotes.reflect.*
7+
Expr(TypeRepr.of[T].typeSymbol.docstring)
8+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@main def Test(): Unit = {
2+
val res = getDocString[scala.quoted.Quotes]
3+
println(res)
4+
assert(res.nonEmpty)
5+
}

0 commit comments

Comments
 (0)