Skip to content

Commit 52e229c

Browse files
committed
tweak conditions for warning
Handle match types No transparent inline exclusion
1 parent 0e0caac commit 52e229c

39 files changed

+395
-354
lines changed

compiler/src/dotty/tools/backend/jvm/BCodeSkelBuilder.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,7 @@ trait BCodeSkelBuilder extends BCodeHelpers {
818818

819819
methSymbol = dd.symbol
820820
jMethodName = methSymbol.javaSimpleName
821-
returnType = asmMethodType(dd.symbol).returnType
821+
returnType = asmMethodType(methSymbol).returnType
822822
isMethSymStaticCtor = methSymbol.isStaticConstructor
823823

824824
resetMethodBookkeeping(dd)
@@ -915,7 +915,7 @@ trait BCodeSkelBuilder extends BCodeHelpers {
915915
for (p <- params) { emitLocalVarScope(p.symbol, veryFirstProgramPoint, onePastLastProgramPoint, force = true) }
916916
}
917917

918-
if (isMethSymStaticCtor) { appendToStaticCtor(dd) }
918+
if (isMethSymStaticCtor) { appendToStaticCtor() }
919919
} // end of emitNormalMethodBody()
920920

921921
lineNumber(rhs)
@@ -936,7 +936,7 @@ trait BCodeSkelBuilder extends BCodeHelpers {
936936
*
937937
* TODO document, explain interplay with `fabricateStaticInitAndroid()`
938938
*/
939-
private def appendToStaticCtor(dd: DefDef): Unit = {
939+
private def appendToStaticCtor(): Unit = {
940940

941941
def insertBefore(
942942
location: asm.tree.AbstractInsnNode,

compiler/src/dotty/tools/dotc/Compiler.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Compiler {
3333
protected def frontendPhases: List[List[Phase]] =
3434
List(new Parser) :: // Compiler frontend: scanner, parser
3535
List(new TyperPhase) :: // Compiler frontend: namer, typer
36-
List(/*LintPreparation(),*/ CheckUnused.PostTyper()/*, CheckShadowing()*/) :: // Check for unused, shadowed elements
36+
List(CheckUnused.PostTyper(), CheckShadowing()) :: // Check for unused, shadowed elements
3737
List(new YCheckPositions) :: // YCheck positions
3838
List(new sbt.ExtractDependencies) :: // Sends information on classes' dependencies to sbt via callbacks
3939
List(new semanticdb.ExtractSemanticDB.ExtractSemanticInfo) :: // Extract info into .semanticdb files
@@ -51,7 +51,7 @@ class Compiler {
5151
List(new Staging) :: // Check staging levels and heal staged types
5252
List(new Splicing) :: // Replace level 1 splices with holes
5353
List(new PickleQuotes) :: // Turn quoted trees into explicit run-time data structures
54-
List(/*LintPreparation(),*/ CheckUnused.PostInlining()) :: // Check for unused elements
54+
List(CheckUnused.PostInlining()) :: // Check for unused elements
5555
Nil
5656

5757
/** Phases dealing with the transformation from pickled trees to backend trees */

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3287,16 +3287,17 @@ extends TypeMsg(ConstructorProxyNotValueID):
32873287
|companion value with the (term-)name `A`. However, these context bound companions
32883288
|are not values themselves, they can only be referred to in selections."""
32893289

3290-
class UnusedSymbol(errorText: String)(using Context)
3290+
class UnusedSymbol(errorText: String, val actions: List[CodeAction] = Nil)(using Context)
32913291
extends Message(UnusedSymbolID) {
32923292
def kind = MessageKind.UnusedSymbol
32933293

32943294
override def msg(using Context) = errorText
32953295
override def explain(using Context) = ""
3296+
override def actions(using Context) = this.actions
32963297
}
32973298

32983299
object UnusedSymbol:
3299-
def imports(using Context): UnusedSymbol = UnusedSymbol(i"unused import")
3300+
def imports(actions: List[CodeAction])(using Context): UnusedSymbol = UnusedSymbol(i"unused import", actions)
33003301
def localDefs(using Context): UnusedSymbol = UnusedSymbol(i"unused local definition")
33013302
def explicitParams(using Context): UnusedSymbol = UnusedSymbol(i"unused explicit parameter")
33023303
def implicitParams(using Context): UnusedSymbol = UnusedSymbol(i"unused implicit parameter")

0 commit comments

Comments
 (0)