Skip to content

Enable -Ycheck:all in Dotty Doc tests #4575

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/core/Comments.scala
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ object Comments {

tree match {
case tree: untpd.DefDef =>
val newName = (tree.name.show + "$" + codePos + "$doc").toTermName
val newName = ctx.freshNames.newName(tree.name, NameKinds.DocArtifactName)
untpd.DefDef(newName, tree.tparams, tree.vparamss, tree.tpt, tree.rhs)
case _ =>
ctx.error(ProperDefinitionNotFound(), codePos)
Expand Down
1 change: 1 addition & 0 deletions compiler/src/dotty/tools/dotc/core/NameKinds.scala
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ object NameKinds {
val SkolemName = new UniqueNameKind("?")
val LiftedTreeName = new UniqueNameKind("liftedTree")
val SuperArgName = new UniqueNameKind("$superArg$")
val DocArtifactName = new UniqueNameKind("$doc")

/** A kind of unique extension methods; Unlike other unique names, these can be
* unmangled.
Expand Down
5 changes: 3 additions & 2 deletions compiler/src/dotty/tools/dotc/transform/TreeChecker.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import core.Flags._
import core.Constants._
import core.StdNames._
import core.NameOps._
import core.NameKinds.OuterSelectName
import core.NameKinds.{DocArtifactName, OuterSelectName}
import core.Decorators._
import core.TypeErasure.isErasedType
import core.Phases.Phase
Expand Down Expand Up @@ -379,7 +379,8 @@ class TreeChecker extends Phase with SymTransformer {
x.is(Method) &&
!x.isCompanionMethod &&
!x.isValueClassConvertMethod &&
!(x.is(Macro) && ctx.phase.refChecked)
!(x.is(Macro) && ctx.phase.refChecked) &&
!x.name.is(DocArtifactName)

val symbolsNotDefined = cls.classInfo.decls.toList.toSet.filter(isNonMagicalMethod) -- impl.body.map(_.symbol) - constr.symbol

Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/typer/Docstrings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ trait Docstrings { self: Typer =>
*/
def cookComments(syms: List[Symbol], owner: Symbol)(implicit ctx: Context): Unit =
ctx.docCtx.foreach { docbase =>
val relevantSyms = syms.filter(docbase.docstring(_).isDefined)
val relevantSyms = syms.filter(docbase.docstring(_).exists(!_.isExpanded))
relevantSyms.foreach { sym =>
expandParentDocs(sym)
val usecases = docbase.docstring(sym).map(_.usecases).getOrElse(Nil)
Expand Down
1 change: 1 addition & 0 deletions doc-tool/test/DottyDocTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ trait DottyDocTest extends MessageRendering {
ctx.setSetting(ctx.settings.language, List("Scala2"))
ctx.setSetting(ctx.settings.YkeepComments, true)
ctx.setSetting(ctx.settings.YcookComments, true)
ctx.setSetting(ctx.settings.Ycheck, "all" :: Nil)
ctx.setSetting(ctx.settings.YnoInline, true)
ctx.setSetting(ctx.settings.wikiSyntax, true)
ctx.setProperty(ContextDoc, new ContextDottydoc)
Expand Down
1 change: 1 addition & 0 deletions doc-tool/test/MarkdownTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class MarkdownTests extends DottyDocTest {
ctx.setSetting(ctx.settings.language, List("Scala2"))
ctx.setSetting(ctx.settings.YkeepComments, true)
ctx.setSetting(ctx.settings.YnoInline, true)
ctx.setSetting(ctx.settings.Ycheck, "all" :: Nil)
// No wiki syntax!
ctx.setSetting(ctx.settings.wikiSyntax, false)
ctx.setProperty(ContextDoc, new ContextDottydoc)
Expand Down