Skip to content

Commit

Permalink
tweak conditions for warning
Browse files Browse the repository at this point in the history
Handle match types
No transparent inline exclusion
  • Loading branch information
som-snytt committed Jan 7, 2025
1 parent e57b453 commit 4e9f747
Show file tree
Hide file tree
Showing 40 changed files with 421 additions and 361 deletions.
6 changes: 3 additions & 3 deletions compiler/src/dotty/tools/backend/jvm/BCodeSkelBuilder.scala
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ trait BCodeSkelBuilder extends BCodeHelpers {

methSymbol = dd.symbol
jMethodName = methSymbol.javaSimpleName
returnType = asmMethodType(dd.symbol).returnType
returnType = asmMethodType(methSymbol).returnType
isMethSymStaticCtor = methSymbol.isStaticConstructor

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

if (isMethSymStaticCtor) { appendToStaticCtor(dd) }
if (isMethSymStaticCtor) { appendToStaticCtor() }
} // end of emitNormalMethodBody()

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

def insertBefore(
location: asm.tree.AbstractInsnNode,
Expand Down
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/Compiler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Compiler {
protected def frontendPhases: List[List[Phase]] =
List(new Parser) :: // Compiler frontend: scanner, parser
List(new TyperPhase) :: // Compiler frontend: namer, typer
List(/*LintPreparation(),*/ CheckUnused.PostTyper()/*, CheckShadowing()*/) :: // Check for unused, shadowed elements
List(CheckUnused.PostTyper(), CheckShadowing()) :: // Check for unused, shadowed elements
List(new YCheckPositions) :: // YCheck positions
List(new sbt.ExtractDependencies) :: // Sends information on classes' dependencies to sbt via callbacks
List(new semanticdb.ExtractSemanticDB.ExtractSemanticInfo) :: // Extract info into .semanticdb files
Expand All @@ -51,7 +51,7 @@ class Compiler {
List(new Staging) :: // Check staging levels and heal staged types
List(new Splicing) :: // Replace level 1 splices with holes
List(new PickleQuotes) :: // Turn quoted trees into explicit run-time data structures
List(/*LintPreparation(),*/ CheckUnused.PostInlining()) :: // Check for unused elements
List(CheckUnused.PostInlining()) :: // Check for unused elements
Nil

/** Phases dealing with the transformation from pickled trees to backend trees */
Expand Down
5 changes: 3 additions & 2 deletions compiler/src/dotty/tools/dotc/reporting/messages.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3290,16 +3290,17 @@ extends TypeMsg(ConstructorProxyNotValueID):
|companion value with the (term-)name `A`. However, these context bound companions
|are not values themselves, they can only be referred to in selections."""

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

override def msg(using Context) = errorText
override def explain(using Context) = ""
override def actions(using Context) = this.actions
}

object UnusedSymbol:
def imports(using Context): UnusedSymbol = UnusedSymbol(i"unused import")
def imports(actions: List[CodeAction])(using Context): UnusedSymbol = UnusedSymbol(i"unused import", actions)
def localDefs(using Context): UnusedSymbol = UnusedSymbol(i"unused local definition")
def explicitParams(using Context): UnusedSymbol = UnusedSymbol(i"unused explicit parameter")
def implicitParams(using Context): UnusedSymbol = UnusedSymbol(i"unused implicit parameter")
Expand Down
Loading

0 comments on commit 4e9f747

Please sign in to comment.