Skip to content

Commit b1d0445

Browse files
committed
Merge branch 'topic/comments-default-no-cook' into topic/tasty-doc
2 parents 13476fd + b57e824 commit b1d0445

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

compiler/src/dotty/tools/dotc/config/ScalaSettings.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ class ScalaSettings extends Settings.SettingGroup {
117117
val YtestPickler = BooleanSetting("-Ytest-pickler", "self-test for pickling functionality; should be used with -Ystop-after:pickler")
118118
val YcheckReentrant = BooleanSetting("-Ycheck-reentrant", "check that compiled program does not contain vars that can be accessed from a global root.")
119119
val YkeepComments = BooleanSetting("-Ykeep-comments", "Keep comments when scanning source files.")
120+
val YcookComments = BooleanSetting("-Ycook-comments", "Cook the comments (type check `@usecase`, etc.)")
120121
val YforceSbtPhases = BooleanSetting("-Yforce-sbt-phases", "Run the phases used by sbt for incremental compilation (ExtractDependencies and ExtractAPI) even if the compiler is ran outside of sbt, for debugging.")
121122
val YdumpSbtInc = BooleanSetting("-Ydump-sbt-inc", "For every compiled foo.scala, output the API representation and dependencies used for sbt incremental compilation in foo.inc, implies -Yforce-sbt-phases.")
122123
val YcheckAllPatmat = BooleanSetting("-Ycheck-all-patmat", "Check exhaustivity and redundancy of all pattern matching (used for testing the algorithm)")

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1527,8 +1527,10 @@ class Typer extends Namer
15271527
if (!ctx.isAfterTyper)
15281528
cls.setNoInitsFlags((NoInitsInterface /: body1) ((fs, stat) => fs & defKind(stat)))
15291529

1530-
// Expand comments and type usecases
1531-
cookComments(body1.map(_.symbol), self1.symbol)(ctx.localContext(cdef, cls).setNewScope)
1530+
// Expand comments and type usecases if `-Ycook-comments` is set.
1531+
if (ctx.settings.YcookComments.value) {
1532+
cookComments(body1.map(_.symbol), self1.symbol)(ctx.localContext(cdef, cls).setNewScope)
1533+
}
15321534

15331535
checkNoDoubleDeclaration(cls)
15341536
val impl1 = cpy.Template(impl)(constr1, parents1, self1, body1)

doc-tool/src/dotty/tools/dottydoc/DocDriver.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class DocDriver extends Driver {
2323

2424
ctx.setSettings(summary.sstate)
2525
ctx.setSetting(ctx.settings.YkeepComments, true)
26+
ctx.setSetting(ctx.settings.YcookComments, true)
2627
ctx.setSetting(ctx.settings.YnoInline, true)
2728
ctx.setProperty(ContextDoc, new ContextDottydoc)
2829

doc-tool/test/DottyDocTest.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ trait DottyDocTest extends MessageRendering {
2424
val ctx = base.initialCtx.fresh
2525
ctx.setSetting(ctx.settings.language, List("Scala2"))
2626
ctx.setSetting(ctx.settings.YkeepComments, true)
27+
ctx.setSetting(ctx.settings.YcookComments, true)
2728
ctx.setSetting(ctx.settings.YnoInline, true)
2829
ctx.setSetting(ctx.settings.wikiSyntax, true)
2930
ctx.setProperty(ContextDoc, new ContextDottydoc)

0 commit comments

Comments
 (0)