Skip to content

Commit 4e9f747

Browse files
committed
tweak conditions for warning
Handle match types No transparent inline exclusion
1 parent e57b453 commit 4e9f747

40 files changed

+421
-361
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
@@ -3290,16 +3290,17 @@ extends TypeMsg(ConstructorProxyNotValueID):
32903290
|companion value with the (term-)name `A`. However, these context bound companions
32913291
|are not values themselves, they can only be referred to in selections."""
32923292

3293-
class UnusedSymbol(errorText: String)(using Context)
3293+
class UnusedSymbol(errorText: String, val actions: List[CodeAction] = Nil)(using Context)
32943294
extends Message(UnusedSymbolID) {
32953295
def kind = MessageKind.UnusedSymbol
32963296

32973297
override def msg(using Context) = errorText
32983298
override def explain(using Context) = ""
3299+
override def actions(using Context) = this.actions
32993300
}
33003301

33013302
object UnusedSymbol:
3302-
def imports(using Context): UnusedSymbol = UnusedSymbol(i"unused import")
3303+
def imports(actions: List[CodeAction])(using Context): UnusedSymbol = UnusedSymbol(i"unused import", actions)
33033304
def localDefs(using Context): UnusedSymbol = UnusedSymbol(i"unused local definition")
33043305
def explicitParams(using Context): UnusedSymbol = UnusedSymbol(i"unused explicit parameter")
33053306
def implicitParams(using Context): UnusedSymbol = UnusedSymbol(i"unused implicit parameter")

0 commit comments

Comments
 (0)