Closed spockz closed 5 years ago
Hey @spockz, thanks for filing this issue.
So the thing here is, it's unclear whether this option has to be false
for Scaladoc. Does anyone in the Scala team know why this is the case?
If no one thinks this is a bad idea, I think the best way to move this forward is trying to flip the boolean at hand for scaladocs and see what it breaks. If nothing breaks, the option can be configured via a compiler scaladoc setting or whichever method is used to configure scaladoc. When this is done, we can make this option configurable from sbt so that this error doesn't happen again.
Maybe Scaladoc wants to retain the original trees for printing default arguments.
trait T {
def x(i: Int = Bar.constant): Unit
}
object Bar {
final val constant = Integer.MAX_VALUE + 42
}
gives
If it's just about that, we could achieve the same effect by adding an OriginalTree
attachment added to the Literal
https://github.com/scala/scala/blob/v2.12.2/src/compiler/scala/tools/nsc/typechecker/Typers.scala#L998
(I haven't checked / debugged any of this, just speculating)
How can we proceed on this? If this would be fixed would it require a release of 2.11 in order to be able to generate docs in 2.11 or can we use the same scaladoc when cross compiling?
2.11.x is EOL'ed, so that can't happen @spockz. This could happen in the next 2.12.x release if I'm not mistaken.
If it's just about that, we could achieve the same effect by adding an OriginalTree attachment added to the Literal https://github.com/scala/scala/blob/v2.12.2/src/compiler/scala/tools/nsc/typechecker/Typers.scala#L998
BTW, this fix would help me get Zinc working for final constants (which would be enormous). If you confirm me this attachment is ok @lrytz, I'm more than happy to submit a PR with that fix. I proposed a more ambitious approach to this problem, but that didn't seem to work out: https://github.com/scala/scala-dev/issues/340.
There's now an OriginalTreeAttachment
which should allow threading of the needle here.
I thought typelevel constant folding was going to be the solution.
Duplicates https://github.com/scala/bug/issues/9532
Hi, may I know if this is fixed?
I am bumping into this issue on scala 2.12.18
Looks like the linked ticket was 2.13.
When generating scaladoc for the trait below scaladoc will choke on the constant.
sbt compile
works just fine. Stackoverflow suggests settingcanAdaptConstantTypeToLiteral
totrue
.Regardless, the scaladoc compiler should probably use the same settings as the normal compiler.