Skip to content

Commit 8563404

Browse files
committed
undo unnecessary changes, add -Wunsued:all, remove unused
1 parent 5ee339d commit 8563404

15 files changed

+13
-30
lines changed

presentation-compiler/src/main/dotty/tools/pc/AutoImports.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package dotty.tools.pc
22

33
import scala.annotation.tailrec
44
import scala.jdk.CollectionConverters.*
5-
import scala.meta.internal.mtags.KeywordWrapper
65
import scala.meta.internal.pc.AutoImportPosition
76
import scala.meta.pc.PresentationCompilerConfig
87

presentation-compiler/src/main/dotty/tools/pc/PcCollector.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,8 @@ abstract class PcCollector[T](
315315
case _ => resultAllOccurences().toList
316316

317317
def resultAllOccurences(): Set[T] =
318-
def noTreeFilter = (tree: Tree) => true
319-
def noSoughtFilter = (f: Symbol => Boolean) => true
318+
def noTreeFilter = (_: Tree) => true
319+
def noSoughtFilter = (_: Symbol => Boolean) => true
320320

321321
traverseSought(noTreeFilter, noSoughtFilter)
322322

presentation-compiler/src/main/dotty/tools/pc/PcDefinitionProvider.scala

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import scala.meta.pc.DefinitionResult
99
import scala.meta.pc.OffsetParams
1010
import scala.meta.pc.SymbolSearch
1111

12-
import dotty.tools.dotc.CompilationUnit
1312
import dotty.tools.dotc.ast.NavigateAST
1413
import dotty.tools.dotc.ast.tpd.*
1514
import dotty.tools.dotc.ast.untpd
@@ -43,8 +42,6 @@ class PcDefinitionProvider(
4342
uri,
4443
SourceFile.virtual(filePath.toString, params.text)
4544
)
46-
val unit = driver.currentCtx.run.units.head
47-
val tree = unit.tpdTree
4845

4946
val pos = driver.sourcePosition(params)
5047
val path =
@@ -56,7 +53,7 @@ class PcDefinitionProvider(
5653
if findTypeDef then findTypeDefinitions(path, pos, indexedContext)
5754
else findDefinitions(path, pos, indexedContext)
5855

59-
if result.locations().isEmpty() then fallbackToUntyped(unit, pos)(using ctx)
56+
if result.locations().isEmpty() then fallbackToUntyped(pos)(using ctx)
6057
else result
6158
end definitions
6259

@@ -72,7 +69,7 @@ class PcDefinitionProvider(
7269
* @param pos cursor position
7370
* @return definition result
7471
*/
75-
private def fallbackToUntyped(unit: CompilationUnit, pos: SourcePosition)(
72+
private def fallbackToUntyped(pos: SourcePosition)(
7673
using ctx: Context
7774
) =
7875
lazy val untpdPath = NavigateAST

presentation-compiler/src/main/dotty/tools/pc/completions/KeywordsCompletions.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ object KeywordsCompletions:
2020
comments: List[Comment]
2121
)(using ctx: Context): List[CompletionValue] =
2222
lazy val notInComment =
23-
checkIfNotInComment(completionPos.cursorPos, path, comments)
23+
checkIfNotInComment(completionPos.cursorPos, comments)
2424

2525
path match
2626
case Nil if completionPos.query.isEmpty =>
@@ -69,9 +69,8 @@ object KeywordsCompletions:
6969

7070
private def checkIfNotInComment(
7171
pos: SourcePosition,
72-
path: List[Tree],
7372
comments: List[Comment]
74-
)(using ctx: Context): Boolean =
73+
): Boolean =
7574
!comments.exists(_.span.contains(pos.span))
7675

7776
private def isPackage(enclosing: List[Tree]): Boolean =

presentation-compiler/src/main/dotty/tools/pc/completions/MatchCaseCompletions.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,6 @@ object CaseKeywordCompletion:
241241
completionPos,
242242
clientSupportsSnippets
243243
)
244-
val result = ListBuffer.empty[CompletionValue]
245244
val tpe = selector.tpe.widen.bounds.hi match
246245
case tr @ TypeRef(_, _) => tr.underlying
247246
case t => t

presentation-compiler/src/main/dotty/tools/pc/printer/ShortenedTypePrinter.scala

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,9 @@ package dotty.tools.pc.printer
22

33
import scala.collection.mutable
44
import scala.meta.internal.jdk.CollectionConverters.*
5-
import scala.meta.internal.metals.Report
65
import scala.meta.internal.metals.ReportContext
76
import scala.meta.pc.SymbolDocumentation
87
import scala.meta.pc.SymbolSearch
9-
import scala.util.Failure
10-
import scala.util.Success
11-
import scala.util.Try
128

139
import dotty.tools.dotc.core.Contexts.Context
1410
import dotty.tools.dotc.core.Flags
@@ -24,13 +20,8 @@ import dotty.tools.dotc.core.Types.Type
2420
import dotty.tools.pc.IndexedContext
2521
import dotty.tools.pc.Params
2622
import dotty.tools.pc.utils.MtagsEnrichments.*
27-
import dotty.tools.dotc.printing.PlainPrinter
2823
import dotty.tools.dotc.printing.Texts.Text
29-
import dotty.tools.dotc.core.Decorators.show
3024
import dotty.tools.dotc.printing.RefinedPrinter
31-
import dotty.tools.dotc.printing.Formatting.ShownDef.ctxShow
32-
import dotty.tools.dotc.typer.ImportInfo
33-
import dotty.tools.dotc.core.Annotations.Annotation
3425
import dotty.tools.pc.IndexedContext.Result
3526
import dotty.tools.pc.AutoImports.AutoImportsGenerator
3627
import org.eclipse.lsp4j.TextEdit

presentation-compiler/test/dotty/tools/pc/base/BasePcDefinitionSuite.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package dotty.tools.pc.base
22

3-
import java.net.URI
43
import java.nio.file.Paths
54

65
import scala.meta.internal.metals.CompilerOffsetParams

presentation-compiler/test/dotty/tools/pc/tests/NoIndentSuite.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package dotty.tools.pc.tests
33
import java.nio.file.Path
44

55
import dotty.tools.pc.base.{BaseCompletionSuite, BaseExtractMethodSuite}
6-
import dotty.tools.pc.utils.MockEntries
76

87
import org.junit.Test
98

presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionOverrideSuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ class CompletionOverrideSuite extends BaseCompletionSuite:
890890
topLines = Some(3)
891891
)
892892

893-
@Test def `pathdependent` =
893+
@Test def `path-dependent` =
894894
checkEdit(
895895
"""|trait Over {
896896
| object Outer {

presentation-compiler/test/dotty/tools/pc/tests/edit/AutoImplementAbstractMembersSuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,7 @@ class AutoImplementAbstractMembersSuite extends BaseCodeActionSuite:
11341134
|""".stripMargin
11351135
)
11361136

1137-
@Test def `testtest` =
1137+
@Test def `path-dependent-type-arg` =
11381138
checkEdit(
11391139
"""|package a
11401140
|import scala.deriving.Mirror

presentation-compiler/test/dotty/tools/pc/tests/hover/HoverNamedArgSuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import scala.meta.pc.SymbolDocumentation
55
import dotty.tools.pc.base.BaseHoverSuite
66
import dotty.tools.pc.utils.MockEntries
77

8-
import org.junit.{Ignore, Test}
8+
import org.junit.Test
99

1010
class HoverNamedArgSuite extends BaseHoverSuite:
1111

presentation-compiler/test/dotty/tools/pc/tests/hover/HoverRangeSuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ class HoverRangeSuite extends BaseHoverSuite:
235235
|inline transparent def foo(i: Int): Foo""".stripMargin.hoverRange
236236
)
237237

238-
@Test def `deptypes` =
238+
@Test def `dep-types` =
239239
check(
240240
"""|trait A
241241
|object A1 extends A

presentation-compiler/test/dotty/tools/pc/tests/hover/HoverTermSuite.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,10 +400,10 @@ class HoverTermSuite extends BaseHoverSuite:
400400

401401
@Test def `annot` =
402402
check(
403-
"""|
403+
"""|import scala.annotation.tailrec
404404
|
405405
|object O {
406-
| @<<scala.annotation.tail@@rec>>
406+
| @<<tail@@rec>>
407407
| def hello(n: Int): Int = {
408408
| if (i == 0) 0
409409
| else hello( n - 1)

presentation-compiler/test/dotty/tools/pc/utils/TestingWorkspaceSearch.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import dotty.tools.dotc.core.Symbols.*
1616
import dotty.tools.dotc.interactive.InteractiveDriver
1717
import dotty.tools.dotc.semanticdb.SemanticSymbolBuilder
1818
import dotty.tools.pc.CompilerSearchVisitor
19-
import java.nio.file.Files
2019

2120
object TestingWorkspaceSearch:
2221
def empty: TestingWorkspaceSearch = new TestingWorkspaceSearch(Nil)

project/Build.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,6 +1156,7 @@ object Build {
11561156
val mtagsVersion = "0.11.12+45-45df705d-SNAPSHOT" // Will be set to stable release after 0.11.13 is published
11571157

11581158
Seq(
1159+
scalacOptions += "-Wunused:all",
11591160
libraryDependencies ++= Seq(
11601161
"org.lz4" % "lz4-java" % "1.8.0",
11611162
"io.get-coursier" % "interface" % "1.0.13",

0 commit comments

Comments
 (0)