Skip to content

Commit 6997686

Browse files
committed
Fix instantation of CheckUnused phase
1 parent f6040ad commit 6997686

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class Compiler {
3535
protected def frontendPhases: List[List[Phase]] =
3636
List(new Parser) :: // Compiler frontend: scanner, parser
3737
List(new TyperPhase) :: // Compiler frontend: namer, typer
38-
List(CheckUnused.PostTyper) :: // Check for unused elements
38+
List(new CheckUnused.PostTyper) :: // Check for unused elements
3939
List(new YCheckPositions) :: // YCheck positions
4040
List(new sbt.ExtractDependencies) :: // Sends information on classes' dependencies to sbt via callbacks
4141
List(new semanticdb.ExtractSemanticDB) :: // Extract info into .semanticdb files
@@ -50,7 +50,7 @@ class Compiler {
5050
List(new Pickler) :: // Generate TASTY info
5151
List(new Inlining) :: // Inline and execute macros
5252
List(new PostInlining) :: // Add mirror support for inlined code
53-
List(CheckUnused.PostInlining) :: // Check for unused elements
53+
List(new CheckUnused.PostInlining) :: // Check for unused elements
5454
List(new Staging) :: // Check staging levels and heal staged types
5555
List(new Splicing) :: // Replace level 1 splices with holes
5656
List(new PickleQuotes) :: // Turn quoted trees into explicit run-time data structures

compiler/src/dotty/tools/dotc/transform/CheckUnused.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class CheckUnused private (phaseMode: CheckUnused.PhaseMode, suffix: String, _ke
5252
// ========== SETUP ============
5353

5454
override def prepareForUnit(tree: tpd.Tree)(using Context): Context =
55+
println(this)
5556
val data = UnusedData()
5657
tree.getAttachment(_key).foreach(oldData =>
5758
data.unusedAggregate = oldData.unusedAggregate
@@ -306,8 +307,9 @@ object CheckUnused:
306307
*/
307308
private val _key = Property.StickyKey[UnusedData]
308309

309-
val PostTyper = new CheckUnused(PhaseMode.Aggregate, "PostTyper", _key)
310-
val PostInlining = new CheckUnused(PhaseMode.Report, "PostInlining", _key)
310+
class PostTyper extends CheckUnused(PhaseMode.Aggregate, "PostTyper", _key)
311+
312+
class PostInlining extends CheckUnused(PhaseMode.Report, "PostInlining", _key)
311313

312314
/**
313315
* A stateful class gathering the infos on :

tests/neg-custom-args/fatal-warnings/i15503a.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@ object FooTypeName:
6363

6464
object InlineChecks:
6565
object InlineFoo:
66-
import collection.mutable.Set // OK
66+
import collection.mutable.Set // ok
6767
import collection.mutable.Map // error
6868
inline def getSet = Set(1)
6969

7070
object InlinedBar:
71-
import collection.mutable.Set // error
71+
import collection.mutable.Set // ok
7272
import collection.mutable.Map // error
7373
val a = InlineFoo.getSet
7474

0 commit comments

Comments
 (0)