Skip to content

Commit

Permalink
Fix: Error Sidebar PR failed test (#17959)
Browse files Browse the repository at this point in the history
The purpose of this Pull request is to correct my PR
#17229
Sorry for this failure.
I have tested the following command locally and my tests pass.
`sbt ";dist/pack ;scala3-bootstrapped/compile
;scala3-bootstrapped/test"`

[test_windows_full]

Fixes: #17963
[Cherry-picked d83aa49]
  • Loading branch information
Dedelweiss authored and Kordyjan committed Nov 17, 2023
1 parent 70a9175 commit c11b859
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
7 changes: 0 additions & 7 deletions scaladoc/src/dotty/tools/scaladoc/site/SidebarParser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,6 @@ object Sidebar:

private def toSidebar(r: RawInput, content: String | java.io.File)(using CompilerContext): Sidebar = r match
case RawInput(title, page, index, subsection, dir, hidden) if page.nonEmpty && index.isEmpty && subsection.isEmpty() =>
val sidebarPath = content match
case s: String => Paths.get(s)
case f: java.io.File => f.toPath()
val basePath = sidebarPath.getParent().resolve("_docs")
val pagePath = basePath.resolve(page)
if !Files.exists(pagePath) then
report.error(s"Page $page does not exist.")
Sidebar.Page(Option.when(title.nonEmpty)(title), page, hidden)
case RawInput(title, page, index, subsection, dir, hidden) if page.isEmpty && (!subsection.isEmpty() || !index.isEmpty()) =>
Sidebar.Category(Option.when(title.nonEmpty)(title), Option.when(index.nonEmpty)(index), subsection.asScala.map(toSidebar(_, content)).toList, Option.when(dir.nonEmpty)(dir))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,4 @@ class SidebarParserTest:
}
val error = out.toString().trim()

assert(error.contains(msgNoTitle) && error.contains(schemaMessage))
assert(error.contains(msgNoTitle) && error.contains(schemaMessage))

0 comments on commit c11b859

Please sign in to comment.