Skip to content
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

scaladoc cannot parse 'extends' call #17234

Closed
hugo-vrijswijk opened this issue Apr 12, 2023 · 0 comments · Fixed by #17260
Closed

scaladoc cannot parse 'extends' call #17234

hugo-vrijswijk opened this issue Apr 12, 2023 · 0 comments · Fixed by #17260
Assignees
Milestone

Comments

@hugo-vrijswijk
Copy link
Contributor

Compiler version

3.2.2, 3.3.0-RC3 and 3.3.1-RC1-bin-20230411-d577300-NIGHTLY

Minimized code

scala-cli doc .

package example

class Impl() extends Base(Seq.empty, c = "-")

class Base(val a: Seq[String], val b: String = "", val c: String = "")

Docs for the class are not output to the docs folder. Interestingly, scaladoc can successfully parse if I remove the val b: String = "" from the super class, or if I replace the Seq.empty with Nil

Output

Problem parsing repro.scala:[0..8..134], documentation may not be generated.
scala.MatchError: Block(List(ValDef(a$1,TypeTree[AppliedType(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class collection)),object immutable),Seq),List(TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class java)),object lang),String)))],TypeApply(Select(Ident(Seq),empty),List(TypeTree[TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class java)),object lang),String)]))), ValDef(b$1,TypeTree[AnnotatedType(TypeRef(TermRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),object scala),Predef),String),ConcreteAnnotation(Apply(Select(New(TypeTree[TypeRef(TermRef(ThisType(TypeRef(NoPrefix,module class annotation)),object unchecked),uncheckedVariance)]),<init>),List())))],Select(Ident(Base),$lessinit$greater$default$2))),Apply(Select(New(Ident(Base)),<init>),List(Ident(a$1), Ident(b$1), NamedArg(c,Literal(Constant(-)))))) (of class dotty.tools.dotc.ast.Trees$Block)
	at dotty.tools.scaladoc.tasty.ClassLikeSupport.unpackTreeToClassDef$1(ClassLikeSupport.scala:71)
	at dotty.tools.scaladoc.tasty.ClassLikeSupport.getSupertypesGraph$1$$anonfun$1(ClassLikeSupport.scala:83)
	at scala.collection.immutable.List.flatMap(List.scala:293)
	at scala.collection.immutable.List.flatMap(List.scala:79)
	at dotty.tools.scaladoc.tasty.ClassLikeSupport.getSupertypesGraph$1(ClassLikeSupport.scala:86)
	at dotty.tools.scaladoc.tasty.ClassLikeSupport.mkClass(ClassLikeSupport.scala:104)
	at dotty.tools.scaladoc.tasty.ClassLikeSupport.mkClass$(ClassLikeSupport.scala:15)
	at dotty.tools.scaladoc.tasty.TastyParser.mkClass(TastyParser.scala:169)
	at dotty.tools.scaladoc.tasty.ClassLikeSupport.parseClasslike(ClassLikeSupport.scala:298)
	at dotty.tools.scaladoc.tasty.ClassLikeSupport.parseClasslike$(ClassLikeSupport.scala:15)
	at dotty.tools.scaladoc.tasty.TastyParser.parseClasslike(TastyParser.scala:169)
	at dotty.tools.scaladoc.tasty.TastyParser$Traverser$2$.traverseTree(TastyParser.scala:223)
	at scala.quoted.Quotes$reflectModule$TreeTraverser.foldTree(Quotes.scala:4666)
	at scala.quoted.Quotes$reflectModule$TreeTraverser.foldTree$(Quotes.scala:4662)
	at dotty.tools.scaladoc.tasty.TastyParser$Traverser$2$.foldTree(TastyParser.scala:211)
	at dotty.tools.scaladoc.tasty.TastyParser$Traverser$2$.foldTree(TastyParser.scala:211)
	at scala.quoted.Quotes$reflectModule$TreeAccumulator.foldTrees$$anonfun$1(Quotes.scala:4554)
	at scala.collection.LinearSeqOps.foldLeft(LinearSeq.scala:183)
	at scala.collection.LinearSeqOps.foldLeft$(LinearSeq.scala:179)
	at scala.collection.immutable.List.foldLeft(List.scala:79)
	at scala.quoted.Quotes$reflectModule$TreeAccumulator.foldTrees(Quotes.scala:4554)
	at scala.quoted.Quotes$reflectModule$TreeAccumulator.foldTrees$(Quotes.scala:4549)
	at dotty.tools.scaladoc.tasty.TastyParser$Traverser$2$.foldTrees(TastyParser.scala:211)
	at scala.quoted.Quotes$reflectModule$TreeAccumulator.foldOverTree(Quotes.scala:4617)
	at scala.quoted.Quotes$reflectModule$TreeAccumulator.foldOverTree$(Quotes.scala:4549)
	at dotty.tools.scaladoc.tasty.TastyParser$Traverser$2$.foldOverTree(TastyParser.scala:211)
	at scala.quoted.Quotes$reflectModule$TreeTraverser.traverseTreeChildren(Quotes.scala:4668)
	at scala.quoted.Quotes$reflectModule$TreeTraverser.traverseTreeChildren$(Quotes.scala:4662)
	at dotty.tools.scaladoc.tasty.TastyParser$Traverser$2$.traverseTreeChildren(TastyParser.scala:211)
	at scala.quoted.Quotes$reflectModule$TreeTraverser.traverseTree(Quotes.scala:4664)
	at scala.quoted.Quotes$reflectModule$TreeTraverser.traverseTree$(Quotes.scala:4662)
	at dotty.tools.scaladoc.tasty.TastyParser$Traverser$2$.traverseTree(TastyParser.scala:219)
	at dotty.tools.scaladoc.tasty.TastyParser.parseRootTree(TastyParser.scala:228)
	at dotty.tools.scaladoc.tasty.ScaladocTastyInspector.$anonfun$4(TastyParser.scala:123)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at dotty.tools.scaladoc.tasty.ScaladocTastyInspector.postProcess$$anonfun$2(TastyParser.scala:42)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.immutable.List.foreach(List.scala:333)
	at dotty.tools.scaladoc.tasty.ScaladocTastyInspector.postProcess(TastyParser.scala:42)
	at scala.tasty.inspector.OldTastyInspector$TastyInspectorFinishPhase$1.runOn(OldTastyInspector.scala:91)
	at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:238)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1321)
	at dotty.tools.dotc.Run.runPhases$1(Run.scala:249)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:257)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:266)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:68)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:266)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:196)
	at dotty.tools.dotc.fromtasty.TASTYRun.compile(TASTYRun.scala:14)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:35)
	at dotty.tools.dotc.Driver.process(Driver.scala:195)
	at scala.tasty.inspector.OldTastyInspector.inspectFilesInContext(OldTastyInspector.scala:72)
	at scala.tasty.inspector.OldTastyInspector.inspectFilesInContext$(OldTastyInspector.scala:22)
	at scala.tasty.inspector.DocTastyInspector.inspectFilesInContext(DocTastyInspector.scala:5)
	at dotty.tools.scaladoc.tasty.ScaladocTastyInspector.result(TastyParser.scala:147)
	at dotty.tools.scaladoc.ScalaModuleProvider$.mkModule(ScalaModuleProvider.scala:11)
	at dotty.tools.scaladoc.Scaladoc$.run(Scaladoc.scala:241)
	at dotty.tools.scaladoc.Scaladoc$.run$$anonfun$1(Scaladoc.scala:73)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.Option.map(Option.scala:242)
	at dotty.tools.scaladoc.Scaladoc$.run(Scaladoc.scala:77)
	at dotty.tools.scaladoc.Main.run(Main.scala:18)
	at dotty.tools.scaladoc.Main$.main(Main.scala:24)
	at dotty.tools.scaladoc.Main.main(Main.scala)
Wrote Scaladoc to ./scala-doc

Expectation

No stacktrace, doc generated to output folder.

@hugo-vrijswijk hugo-vrijswijk added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Apr 12, 2023
@KacperFKorban KacperFKorban added area:doctool and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Apr 13, 2023
@Florian3k Florian3k self-assigned this Apr 13, 2023
@Kordyjan Kordyjan added this to the 3.3.1 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants