Skip to content

Commit af88a76

Browse files
committed
Fix instantation of CheckUnused phase
1 parent e3cb2e3 commit af88a76

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
@@ -53,6 +53,7 @@ class CheckUnused private (phaseMode: CheckUnused.PhaseMode, suffix: String, _ke
5353
// ========== SETUP ============
5454

5555
override def prepareForUnit(tree: tpd.Tree)(using Context): Context =
56+
println(this)
5657
val data = UnusedData()
5758
tree.getAttachment(_key).foreach(oldData =>
5859
data.unusedAggregate = oldData.unusedAggregate
@@ -304,8 +305,9 @@ object CheckUnused:
304305
*/
305306
private val _key = Property.StickyKey[UnusedData]
306307

307-
val PostTyper = new CheckUnused(PhaseMode.Aggregate, "PostTyper", _key)
308-
val PostInlining = new CheckUnused(PhaseMode.Report, "PostInlining", _key)
308+
class PostTyper extends CheckUnused(PhaseMode.Aggregate, "PostTyper", _key)
309+
310+
class PostInlining extends CheckUnused(PhaseMode.Report, "PostInlining", _key)
309311

310312
/**
311313
* 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)