Skip to content

Commit 45d022d

Browse files
committed
Moving casting outside the Option
1 parent 4c73265 commit 45d022d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
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[String])
129+
def group(g: SpecGroup): Option[String] = Option(descriptor.group(g.ordinal)).asInstanceOf[Option[String]]
130130
def stringOf(g: SpecGroup): String = group(g).getOrElse("")
131131
def intOf(g: SpecGroup): Option[Int] = group(g).map(_.toInt)
132132

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[Try[T]])
277+
override final def value: Option[Try[T]] = Option(value0).asInstanceOf[Option[Try[T]]]
278278

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

0 commit comments

Comments
 (0)