Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2edd2ef

Browse files
revert #24230
1 parent ea73d0d commit 2edd2ef

File tree

7 files changed

+9
-9
lines changed

7 files changed

+9
-9
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +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] = Option(descriptor.group(g.ordinal)).asInstanceOf[Option[String]]
129+
def group(g: SpecGroup): Option[String] = Option(descriptor.group(g.ordinal))
130130
def stringOf(g: SpecGroup): String = group(g).getOrElse("")
131131
def intOf(g: SpecGroup): Option[Int] = group(g).map(_.toInt)
132132

‎library/src/scala/Option.scala‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ object Option {
2828
* @param x the value
2929
* @return Some(value) if value != null, None if value == null
3030
*/
31-
def apply[A](x: A): Option[A] = if (x == null) None else Some(x)
31+
def apply[A](x: A|Null): Option[A] = if (x == null) None else Some(x)
3232

3333
/** An Option factory which returns `None` in a manner consistent with
3434
* the collections hierarchy.

‎library/src/scala/concurrent/impl/Promise.scala‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ private[concurrent] object Promise {
274274

275275
override final def isCompleted: Boolean = value0 ne null
276276

277-
override final def value: Option[Try[T]] = Option(value0).asInstanceOf[Option[Try[T]]]
277+
override final def value: Option[Try[T]] = Option(value0)
278278

279279
@tailrec // returns null if not completed
280280
private final def value0: Try[T] | Null = {

‎library/src/scala/quoted/FromExpr.scala‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ object FromExpr {
104104
*/
105105
given OptionFromExpr[T](using Type[T], FromExpr[T]): FromExpr[Option[T]] with {
106106
def unapply(x: Expr[Option[T]])(using Quotes) = x match {
107-
case '{ Option[T](${Expr(y)}) } => Some(Option(y))
107+
case '{ Option[T](${Expr(y)}:T) } => Some(Option(y))
108108
case '{ None } => Some(None)
109109
case '{ ${Expr(opt)} : Some[T] } => Some(opt)
110110
case _ => None

‎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)

AltStyle によって変換されたページ (->オリジナル) /