From 93e4bb937cf1e14a72b06e5ad706f2ff9c916aa7 Mon Sep 17 00:00:00 2001 From: Hamza Remmal Date: Thu, 4 Dec 2025 04:36:20 +0100 Subject: [PATCH] chore: drop `toOption` (deadcode) --- compiler/src/dotty/tools/package.scala | 2 -- compiler/test/dotty/tools/dotc/sbt/ProgressCallbackTest.scala | 1 - .../main/dotty/tools/pc/completions/MatchCaseCompletions.scala | 3 +-- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/compiler/src/dotty/tools/package.scala b/compiler/src/dotty/tools/package.scala index 977805a8877e..0da6e66fd824 100644 --- a/compiler/src/dotty/tools/package.scala +++ b/compiler/src/dotty/tools/package.scala @@ -16,8 +16,6 @@ package object tools { */ transparent inline def uncheckedNN: T = x.asInstanceOf[T] - inline def toOption: Option[T] = - if x == null then None else Some(x.asInstanceOf[T]) end extension object resultWrapper { diff --git a/compiler/test/dotty/tools/dotc/sbt/ProgressCallbackTest.scala b/compiler/test/dotty/tools/dotc/sbt/ProgressCallbackTest.scala index a00e478c6ddf..c4736c14e8ab 100644 --- a/compiler/test/dotty/tools/dotc/sbt/ProgressCallbackTest.scala +++ b/compiler/test/dotty/tools/dotc/sbt/ProgressCallbackTest.scala @@ -7,7 +7,6 @@ import dotty.tools.dotc.sbt.ProgressCallbackTest.* import org.junit.Assert.* import org.junit.Test -import dotty.tools.toOption import dotty.tools.dotc.core.Contexts.Context import dotty.tools.dotc.core.Contexts.ctx import dotty.tools.dotc.CompilationUnit diff --git a/presentation-compiler/src/main/dotty/tools/pc/completions/MatchCaseCompletions.scala b/presentation-compiler/src/main/dotty/tools/pc/completions/MatchCaseCompletions.scala index 2e89b4e5bb99..c804a1c19dfe 100644 --- a/presentation-compiler/src/main/dotty/tools/pc/completions/MatchCaseCompletions.scala +++ b/presentation-compiler/src/main/dotty/tools/pc/completions/MatchCaseCompletions.scala @@ -11,7 +11,6 @@ import scala.meta.internal.pc.CompletionFuzzy import scala.meta.pc.PresentationCompilerConfig import scala.meta.pc.SymbolSearch -import dotty.tools.toOption import dotty.tools.dotc.ast.tpd.* import dotty.tools.dotc.core.Constants.Constant import dotty.tools.dotc.core.Contexts.Context @@ -135,7 +134,7 @@ object CaseKeywordCompletion: ), Nil, range = Some(completionPos.toEditRange), - command = config.parameterHintsCommand().toOption.flatMap(_.asScala), + command = Option(config.parameterHintsCommand()).flatMap(_.asScala), ) ) else Nil