File tree Expand file tree Collapse file tree 7 files changed +66
-9
lines changed
scaladoc-testcases/src/tests
test/dotty/tools/scaladoc/no-link-warnings Expand file tree Collapse file tree 7 files changed +66
-9
lines changed Original file line number Diff line number Diff line change 1+ package tests
2+ package noLinkWarnings
3+
4+ /**
5+ * [[doesnt.exist ]]
6+ *
7+ */
8+ class NoLinkWarnings
9+
10+
11+ /**
12+ * [[NoLinkWarnings ]]
13+ */
14+ class Exists
Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ object Scaladoc:
5252 documentSyntheticTypes : Boolean = false ,
5353 snippetCompiler : List [String ] = Nil ,
5454 snippetCompilerDebug : Boolean = false ,
55+ noLinkWarnings : Boolean = false ,
5556 versionsDictionaryUrl : Option [String ] = None
5657 )
5758
@@ -196,6 +197,7 @@ object Scaladoc:
196197 docCanonicalBaseUrl.get,
197198 YdocumentSyntheticTypes .get,
198199 snippetCompiler.get,
200+ noLinkWarnings.get,
199201 snippetCompilerDebug.get,
200202 versionsDictionaryUrl.nonDefault
201203 )
Original file line number Diff line number Diff line change @@ -93,6 +93,12 @@ class ScaladocSettings extends SettingGroup with AllScalaSettings:
9393 " ./docs"
9494 )
9595
96+ val noLinkWarnings : Setting [Boolean ] = BooleanSetting (
97+ " -no-link-warnings" ,
98+ " Avoid warnings for ambiguous and incorrect links in members look up. Doesn't affect warnings for incorrect links of assets etc." ,
99+ false
100+ )
101+
96102 val versionsDictionaryUrl : Setting [String ] = StringSetting (
97103 " -versions-dictionary-url" ,
98104 " versions dictionary url" ,
Original file line number Diff line number Diff line change @@ -109,12 +109,10 @@ abstract class MarkupConversion[T](val repr: Repr)(using dctx: DocContext) {
109109 case None =>
110110 val txt = s " No DRI found for query "
111111 val msg = s " $txt: $queryStr"
112- // TODO change to the commented-out version when we'll get rid of the warnings in stdlib
113- // report.warning(
114- // msg,
115- // owner.pos.get.asInstanceOf[dotty.tools.dotc.util.SrcPos],
116- // )
117- report.inform(msg)
112+
113+ if (! summon[DocContext ].args.noLinkWarnings) then
114+ report.warning(msg, owner.pos.get.asInstanceOf [dotty.tools.dotc.util.SrcPos ])
115+
118116 DocLink .UnresolvedDRI (queryStr, txt)
119117
120118 private val SchemeUri = """ [a-z]+:.*""" .r
Original file line number Diff line number Diff line change @@ -86,9 +86,9 @@ trait MemberLookup {
8686 res
8787 catch
8888 case e : Exception =>
89- // TODO (https://github.com/lampepfl/scala3doc/issues/238): proper reporting
90- val msg = s " Unable to find a link for ${query} ${ownerOpt.fold(" " )(o => " in " + o.name)}"
91- report.warn(msg, e)
89+ if ( ! summon[ DocContext ].args.noLinkWarnings) then
90+ val msg = s " Unable to find a link for ${query} ${ownerOpt.fold(" " )(o => " in " + o.name)}"
91+ report.warn(msg, e)
9292 None
9393
9494 private def hackMembersOf (using Quotes )(rsym : reflect.Symbol ) = {
Original file line number Diff line number Diff line change 1+ package dotty .tools .scaladoc
2+ package noLinkWarnings
3+
4+ import org .junit .Assert .assertEquals
5+
6+ class LinkWarningsTest extends ScaladocTest (" noLinkWarnings" ):
7+
8+ override def args = Scaladoc .Args (
9+ name = " test" ,
10+ tastyFiles = tastyFiles(name),
11+ output = getTempDir().getRoot,
12+ projectVersion = Some (" 1.0" )
13+ )
14+
15+ override def runTest = afterRendering {
16+ val diagnostics = summon[DocContext ].compilerContext.reportedDiagnostics
17+ assertEquals(" There should be exactly one warning" , 1 , diagnostics.warningMsgs.size)
18+ assertNoErrors(diagnostics)
19+ }
Original file line number Diff line number Diff line change 1+ package dotty .tools .scaladoc
2+ package noLinkWarnings
3+
4+ class NoLinkWarningsTest extends ScaladocTest (" noLinkWarnings" ):
5+
6+ override def args = Scaladoc .Args (
7+ name = " test" ,
8+ tastyFiles = tastyFiles(name),
9+ output = getTempDir().getRoot,
10+ projectVersion = Some (" 1.0" ),
11+ noLinkWarnings = true
12+ )
13+
14+ override def runTest = afterRendering {
15+ val diagnostics = summon[DocContext ].compilerContext.reportedDiagnostics
16+ assertNoWarning(diagnostics)
17+ assertNoErrors(diagnostics)
18+ }
You can’t perform that action at this time.
0 commit comments