Skip to content

Commit b09ecac

Browse files
committed
Fix build; remove fromNullable usage
1 parent 6ac84c3 commit b09ecac

File tree

5 files changed

+9
-13
lines changed

5 files changed

+9
-13
lines changed

compiler/src/dotty/tools/dotc/transform/localopt/FormatChecker.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,7 @@ class TypedFormatChecker(partsElems: List[Tree], parts: List[String], args: List
126126
def at(g: SpecGroup): Int = descriptor.start(g.ordinal)
127127
def end(g: SpecGroup): Int = descriptor.end(g.ordinal)
128128
def offset(g: SpecGroup, i: Int = 0): Int = at(g) + i
129-
def group(g: SpecGroup): Option[String] =
130-
// Unable to use @experimental fromNullable now
131-
Option(descriptor.group(g.ordinal)).asInstanceOf[Option[String]]
129+
def group(g: SpecGroup): Option[String] = Option(descriptor.group(g.ordinal))
132130
def stringOf(g: SpecGroup): String = group(g).getOrElse("")
133131
def intOf(g: SpecGroup): Option[Int] = group(g).map(_.toInt)
134132

project/Build.scala

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,9 @@ object Build {
680680
// Note: bench/profiles/projects.yml should be updated accordingly.
681681
Compile / scalacOptions ++= Seq("-Yexplicit-nulls", "-Wsafe-init"),
682682

683+
// TODO: Enable fatal warnings after 3.8 because old stdlib has different nullability.
684+
Compile / scalacOptions -= "-Werror",
685+
683686
// Use source 3.3 to avoid fatal migration warnings on scalajs-ir
684687
scalacOptions ++= Seq("-source", "3.3"),
685688

@@ -956,9 +959,6 @@ object Build {
956959
}
957960
}.value,
958961

959-
// TODO: Enable fatal warnings after 3.8 because old stdlib has different nullability.
960-
(Compile / scalacOptions) -= "-Werror",
961-
962962
(Test / testOptions) += Tests.Argument(
963963
TestFrameworks.JUnit,
964964
"--exclude-categories=dotty.BootstrappedOnlyTests",
@@ -2293,8 +2293,6 @@ object Build {
22932293
// Make sure that the produced artifacts have the minimum JVM version in the bytecode
22942294
Compile / javacOptions ++= Seq("--release", Versions.minimumJVMVersion),
22952295
Compile / scalacOptions ++= Seq("--java-output-version", Versions.minimumJVMVersion),
2296-
// TODO: Enable fatal warnings after 3.8 because old stdlib has different nullability.
2297-
Compile / scalacOptions -= "-Werror",
22982296
// Specify the default entry point of the compiler
22992297
Compile / mainClass := Some("dotty.tools.dotc.Main"),
23002298
// Add entry's to the MANIFEST

scaladoc/src/dotty/tools/scaladoc/SourceLinks.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ class SourceLinkParser(revision: Option[String]) extends ArgParser[SourceLink]:
7474
else Right(TemplateSourceLink(supported.foldLeft(string)((template, pattern) =>
7575
template.replace(pattern, SupportedScalaDocPatternReplacements(pattern)))))
7676
case KnownProvider(name: String, organization: String, repo: String, rawRevision, rawSubPath) =>
77-
val subPath = Option.fromNullable(rawSubPath).fold("")("/" + _.drop(1))
78-
val pathRev = Option.fromNullable(rawRevision).map(_.drop(1)).orElse(revision)
77+
val subPath = Option(rawSubPath).fold("")("/" + _.drop(1))
78+
val pathRev = Option(rawRevision).map(_.drop(1)).orElse(revision)
7979

8080
def withRevision(template: String => SourceLink) =
8181
pathRev.fold(Left(s"No revision provided"))(r => Right(template(r)))

scaladoc/src/dotty/tools/scaladoc/site/StaticSiteLoader.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ class StaticSiteLoader(val root: File, val args: Scaladoc.Args)(using StaticSite
116116

117117
def loadBlog(): Option[LoadedTemplate] = {
118118
val blogConfig = BlogParser.readYml(root)
119-
val rootPath = Option.fromNullable(blogConfig.input).map(input => ctx.resolveNewBlogPath(input)).getOrElse(ctx.blogPath)
120-
val defaultDirectory = Option.fromNullable(blogConfig.output).getOrElse("blog")
119+
val rootPath = Option(blogConfig.input).map(input => ctx.resolveNewBlogPath(input)).getOrElse(ctx.blogPath)
120+
val defaultDirectory = Option(blogConfig.output).getOrElse("blog")
121121

122122
type Date = (String, String, String)
123123
if (!Files.exists(rootPath) || blogConfig.hidden) None

scaladoc/src/dotty/tools/scaladoc/tasty/SymOps.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ class SymOpsWithLinkCache:
277277
then externalLinkCache(csym.associatedFile)
278278
else {
279279
def calculatePath(file: AbstractFile): String = file.underlyingSource.filter(_ != file).fold("")(f => calculatePath(f) + "/") + file.path
280-
val calculatedLink = Option.fromNullable(csym.associatedFile).map(f => calculatePath(f)).flatMap { path =>
280+
val calculatedLink = Option(csym.associatedFile).map(f => calculatePath(f)).flatMap { path =>
281281
dctx.externalDocumentationLinks.find(_.originRegexes.exists(r => r.matches(path)))
282282
}
283283
externalLinkCache += (csym.associatedFile -> calculatedLink)

0 commit comments

Comments
 (0)