Open alexarchambault opened 1 year ago
Minimized (with scala-cli):
memoize.scala:
import scala.annotation.{experimental, MacroAnnotation}
import scala.quoted._
@experimental
class memoize extends MacroAnnotation {
def transform(using Quotes)(tree: quotes.reflect.Definition): List[quotes.reflect.Definition] =
???
}
Running scala-cli doc memoize.scala -S 3.nightly
outputs:
-- Error: memoize.scala:29:7 ---------------------------------------------------
29 | ???
| ^
| an identifier expected, but $XMLSTART$< found
-- Error: memoize.scala:31:26 --------------------------------------------------
31 |
| ^
| Not found: type MacroAnnotation
Fun part is, those 22 empty lines are there for a reason. Removing just one of them leaves us with just a single warning instead of errors:
-- Warning: memoize.scala:6:6 --------------------------------------------------
6 | def transform(using Quotes)(tree: quotes.reflect.Definition): List[quotes.reflect.Definition] =
| ^
|java.lang.ArrayIndexOutOfBoundsException: Index 31 out of bounds for length 31
| at dotty.tools.dotc.util.SourceFile.lineToOffset(SourceFile.scala:159)
| at dotty.tools.scaladoc.snippets.SnippetCompiler.$anonfun$3(SnippetCompiler.scala:66)
| at scala.collection.immutable.List.map(List.scala:250)
| at scala.collection.immutable.List.map(List.scala:79)
7 | ???
1 warning found
Removing more lines will change the index number in the warning message.
In the errors, both reported pointed positions appear to be moved around depending on the number of characters in the "empty" space, which is why the errors in this minimization are not exactly the same as in the original output.
Compiler version
3.3.0-RC2
Minimized code
See this repository, that basically re-uses the test case from here, and runs scaladoc on it.
Output
(see README of the reproduction repository above for the full command running scaladoc here)
Expectation
Scaladoc generation succeeds.