Skip to content

Commit 8ba547f

Browse files
committed
Remove code action impl for now
1 parent 24b9b68 commit 8ba547f

File tree

3 files changed

+6
-75
lines changed

3 files changed

+6
-75
lines changed

compiler/src/dotty/tools/dotc/reporting/messages.scala

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3205,30 +3205,10 @@ extends Message(UnusedSymbolID) {
32053205
}
32063206

32073207
object UnusedSymbol {
3208-
private def removeDefinitionAtPos(treePos: SourcePosition)(using Context): List[CodeAction] = {
3209-
val source = treePos.source
3210-
val sourcePos = treePos.sourcePos
3211-
val endLine = source.offsetToLine(sourcePos.end - 1)
3212-
val nextLineOffset = source.lineToOffset(endLine + 1)
3213-
val startOffset = source.lineToOffset(sourcePos.startLine)
3214-
3215-
val pathes = List(
3216-
ActionPatch(
3217-
srcPos = sourcePos.withSpan(sourcePos.span.withStart(startOffset).withEnd(nextLineOffset)),
3218-
replacement = ""
3219-
),
3220-
)
3221-
List(
3222-
CodeAction(title = s"Remove unused code",
3223-
description = None,
3224-
patches = pathes
3225-
)
3226-
)
3227-
}
3228-
def imports(treePos: SourcePosition)(using Context): UnusedSymbol = new UnusedSymbol(treePos, i"unused import", List.empty)
3229-
def localDefs(treePos: SourcePosition)(using Context): UnusedSymbol = new UnusedSymbol(treePos, i"unused local definition", removeDefinitionAtPos(treePos))
3230-
def explicitParams(treePos: SourcePosition)(using Context): UnusedSymbol = new UnusedSymbol(treePos, i"unused explicit parameter", List.empty)
3231-
def implicitParams(treePos: SourcePosition)(using Context): UnusedSymbol = new UnusedSymbol(treePos, i"unused implicit parameter", List.empty)
3232-
def privateMembers(treePos: SourcePosition)(using Context): UnusedSymbol = new UnusedSymbol(treePos, i"unused private member", removeDefinitionAtPos(treePos))
3233-
def patVars(treePos: SourcePosition)(using Context): UnusedSymbol = new UnusedSymbol(treePos, i"unused pattern variable", List.empty)
3208+
def imports(treePos: SourcePosition)(using Context): UnusedSymbol = new UnusedSymbol(treePos, i"unused import", Nil)
3209+
def localDefs(treePos: SourcePosition)(using Context): UnusedSymbol = new UnusedSymbol(treePos, i"unused local definition", Nil)
3210+
def explicitParams(treePos: SourcePosition)(using Context): UnusedSymbol = new UnusedSymbol(treePos, i"unused explicit parameter", Nil)
3211+
def implicitParams(treePos: SourcePosition)(using Context): UnusedSymbol = new UnusedSymbol(treePos, i"unused implicit parameter", Nil)
3212+
def privateMembers(treePos: SourcePosition)(using Context): UnusedSymbol = new UnusedSymbol(treePos, i"unused private member", Nil)
3213+
def patVars(treePos: SourcePosition)(using Context): UnusedSymbol = new UnusedSymbol(treePos, i"unused pattern variable", Nil)
32343214
}

compiler/test/dotty/tools/DottyTest.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import Types._, Symbols._, Decorators._
1313
import dotc.core.Decorators._
1414
import dotc.ast.tpd
1515
import dotc.Compiler
16-
import dotty.tools.dotc.config.Settings.Setting.ChoiceWithHelp
1716
import dotc.core.Phases.Phase
1817

1918
trait DottyTest extends ContextEscapeDetection {
@@ -41,7 +40,6 @@ trait DottyTest extends ContextEscapeDetection {
4140
fc.setSetting(fc.settings.encoding, "UTF8")
4241
fc.setSetting(fc.settings.classpath, TestConfiguration.basicClasspath)
4342
fc.setSetting(fc.settings.language, List("experimental.erasedDefinitions"))
44-
fc.setSetting(fc.settings.Wunused, List(ChoiceWithHelp("all","")))
4543
fc.setProperty(ContextDoc, new ContextDocstrings)
4644
}
4745

compiler/test/dotty/tools/dotc/reporting/CodeActionTest.scala

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -136,53 +136,6 @@ class CodeActionTest extends DottyTest:
136136
afterPhase = "patternMatcher"
137137
)
138138

139-
@Test def removeUnusedLocalDefinition =
140-
checkCodeAction(
141-
code = """object Test:
142-
| def foo(): Int = {
143-
| val a = 456
144-
| 123
145-
| }
146-
|""".stripMargin,
147-
title = "Remove unused code",
148-
expected = """object Test:
149-
| def foo(): Int = {
150-
| 123
151-
| }
152-
|""".stripMargin ,
153-
afterPhase = "checkUnusedPostInlining"
154-
)
155-
156-
@Test def removeUnusedLocalDefinitionBlock =
157-
checkCodeAction(
158-
code = """object Test:
159-
| def foo(): Int = {
160-
| val a = {
161-
| 456
162-
| }
163-
| 123
164-
| }
165-
|""".stripMargin,
166-
title = "Remove unused code",
167-
expected = """object Test:
168-
| def foo(): Int = {
169-
| 123
170-
| }
171-
|""".stripMargin ,
172-
afterPhase = "checkUnusedPostInlining"
173-
)
174-
175-
@Test def removeUnusedPrivateMember =
176-
checkCodeAction(
177-
code = """object Test:
178-
| private def foo: String = "123"
179-
|""".stripMargin,
180-
title = "Remove unused code",
181-
expected = """object Test:
182-
|""".stripMargin ,
183-
afterPhase = "checkUnusedPostInlining"
184-
)
185-
186139
@Test def removeUnusedPrivateMemberBlock =
187140
checkCodeAction(
188141
code = """object Test:

0 commit comments

Comments
 (0)