Skip to content

Commit 237569b

Browse files
committed
Fix #12351: add test
Fix renaming as well
1 parent c7dfdf1 commit 237569b

File tree

6 files changed

+17
-1
lines changed

6 files changed

+17
-1
lines changed

compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -885,7 +885,7 @@ class TreeUnpickler(reader: TastyReader,
885885
sym.info = ta.avoidPrivateLeaks(sym)
886886

887887
if (ctx.settings.YreadComments.value) {
888-
assert(ctx.docCtx.isDefined, "`-Yread-comments` enabled, but no `docCtx` is set.")
888+
assert(ctx.docCtx.isDefined, "`-Yread-docs` enabled, but no `docCtx` is set.")
889889
commentUnpicklerOpt.foreach { commentUnpickler =>
890890
val comment = commentUnpickler.commentAt(start)
891891
ctx.docCtx.get.addDocstring(tree.symbol, comment)

compiler/test/dotty/tools/dotc/BootstrappedOnlyCompilationTests.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ class BootstrappedOnlyCompilationTests {
118118
aggregateTests(
119119
compileFilesInDir("tests/run-macros", defaultOptions.and("-Xcheck-macros")),
120120
compileFilesInDir("tests/run-custom-args/Yretain-trees", defaultOptions and "-Yretain-trees"),
121+
compileFilesInDir("tests/run-custom-args/Yread-comments", defaultOptions and "-Yread-docs"),
121122
compileFilesInDir("tests/run-custom-args/run-macros-erased", defaultOptions.and("-language:experimental.erasedDefinitions").and("-Xcheck-macros")),
122123
)
123124
}.checkRuns()
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import scala.quoted.*
2+
3+
/** HELLO */
4+
case class Data(test: Boolean)
5+
6+
inline def getDocString[T]: Option[String] = ${ getDocStringImpl[T] }
7+
8+
private def getDocStringImpl[T : Type](using Quotes): Expr[Option[String]] = {
9+
import quotes.reflect.*
10+
Expr(TypeRepr.of[T].typeSymbol.docstring)
11+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@main def Test(): Unit = {
2+
println(getDocString[Data])
3+
assert(getDocString[Data].nonEmpty)
4+
}

0 commit comments

Comments
 (0)