scala / scala3

The Scala 3 compiler, also known as Dotty.
https://dotty.epfl.ch
Apache License 2.0
5.88k stars 1.06k forks source link

scaladoc generates warnings: No DRI found for query: ... #17578

Open reid-spencer opened 1 year ago

reid-spencer commented 1 year ago

Compiler version

3.3.0-RC6

Minimized code

The symptom occurs in https://github.com/reactific/riddl/testkit only. Other modules in that repository do not produce the symptomatic warnings. The warnings relate to code locations within the compiler, not within in the input source.

Output

[warn] -- Warning: dotty/core/src/main/scala/org/scalatest/Assertions.scala:1301:13 ---
[warn] No DRI found for query: TestPendingException
[warn] -- Warning: dotty/core/src/main/scala/org/scalatest/Assertions.scala:1091:13 ---
[warn] No DRI found for query: NullArgumentException
[warn] -- Warning: dotty/core/src/main/scala/org/scalatest/Assertions.scala:1072:13 ---
[warn] No DRI found for query: NullArgumentException
[warn] -- Warning: dotty/core/src/main/scala/org/scalatest/Assertions.scala:1053:13 ---
[warn] No DRI found for query: NullArgumentException
[warn] -- Warning: dotty/core/src/main/scala/org/scalatest/Assertions.scala:757:13 ----
[warn] No DRI found for query: TestFailedException
[warn] -- Warning: dotty/core/src/main/scala/org/scalatest/Assertions.scala:983:13 ----
[warn] No DRI found for query: TestFailedException
[warn] -- Warning: dotty/core/src/main/scala/org/scalatest/Assertions.scala:959:13 ----
[warn] No DRI found for query: TestFailedException
[warn] -- Warning: dotty/wordspec/target/scala-3/src_managed/main/org/scalatest/wordspec/AnyWordSpecLike.scala:1110:25 
[warn] No DRI found for query: NullArgumentException
[warn] -- Warning: dotty/core/src/main/scala/org/scalatest/Assertions.scala:1153:13 ---
[warn] No DRI found for query: NullArgumentException
[warn] -- Warning: dotty/core/src/main/scala/org/scalatest/Assertions.scala:1134:13 ---
[warn] No DRI found for query: NullArgumentException
[warn] -- Warning: dotty/core/src/main/scala/org/scalatest/Assertions.scala:1115:13 ---
[warn] No DRI found for query: NullArgumentException
[warn] -- Warning: dotty/core/src/main/scala/org/scalatest/Assertions.scala:531:13 ----
[warn] No DRI found for query: NullArgumentException
[warn] -- Warning: dotty/core/src/main/scala/org/scalatest/Assertions.scala:472:13 ----
[warn] No DRI found for query: TestFailedException
[warn] -- Warning: dotty/wordspec/target/scala-3/src_managed/main/org/scalatest/wordspec/AnyWordSpecLike.scala:1230:15 
[warn] No DRI found for query: NullArgumentException
[warn] -- Warning: dotty/core/src/main/scala/org/scalatest/Assertions.scala:632:13 ----
[warn] No DRI found for query: NullArgumentException
[warn] -- Warning: dotty/core/src/main/scala/org/scalatest/Assertions.scala:579:13 ----
[warn] No DRI found for query: TestCanceledException
[warn] -- Warning: dotty/wordspec/target/scala-3/src_managed/main/org/scalatest/wordspec/AnyWordSpecLike.scala:1186:25 
[warn] No DRI found for query: NullArgumentException
[warn] -- Warning: dotty/core/target/scala-3/src_managed/main/org/scalatest/Suite.scala:758:12 
[warn] No DRI found for query: NullArgumentException
[warn] -- Warning: dotty/core/src/main/scala/org/scalatest/Assertions.scala:818:13 ----
[warn] No DRI found for query: TestFailedException
[warn] -- Warning: dotty/core/src/main/scala/org/scalatest/Assertions.scala:1195:6 ----
[warn] No DRI found for query: NullArgumentException
[warn] 20 warnings found

Expectation

The warnings are not put out.

julienrf commented 1 year ago

@Dedelweiss Could you have a look at this issue?

Dedelweiss commented 1 year ago

So from what I've noticed in my tests. I don't think the problem comes directly from Dotty but from the Scalatest comments used by Scaladoc. In fact, I've isolated the problem in a smaller project with the scalatest dependency and the Assertion and AnyWordSpec imports and I end up with the same warnings.

Screenshot 2023-05-25 at 21 37 05 Screenshot 2023-05-25 at 21 37 11

I think it's the @throws that are incorrectly handled or something like that. I'll take a deeper look and see what I can do. In Scalatest.Assertions.scala:

Screenshot 2023-05-25 at 21 38 46
Dedelweiss commented 1 year ago

Hello @reid-spencer, thank you for waiting. The problem does indeed come from Scalatest (and perhaps Dotty too). I'll see later if it's an Issue but currently Scaladoc can't make the link to the classes in the throws parameter of the comments if there isn't a complete path. So I've made a PR on Scalatest to correct it, erase the warning and now I just have to wait for it to pass. I'll keep you informed of any progress. Thank you very much.

julienrf commented 1 year ago

It seems in Scala 2 it was possible to use a symbol in a Scaladoc directive without writing its fully qualified name if the symbol was previously imported. It would be good to support the same in Scala 3. Do you know what it would take?

reid-spencer commented 1 year ago

@ Dedelweiss & julienrf Thanks for the analysis. I have noted in Scala2, many times, that a fully qualified name is needed in references to code. Your help is appreciated but I don't think this is a major issue, unlike #17577 which is a blocker for me.