Skip to content

Commit 5787e5c

Browse files
committed
Make checking state final
Overriding methods of State is erroneous and should be forbidden.
1 parent 96fe9b5 commit 5787e5c

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

compiler/src/dotty/tools/dotc/transform/init/Checking.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ object Checking {
3030
*
3131
*/
3232

33-
case class State(
33+
final case class State(
3434
var visited: Set[Effect], // effects that have been checked or are being checked
3535
path: Vector[Tree], // the path that leads to the current effect
3636
thisClass: ClassSymbol, // the concrete class of `this`
@@ -47,7 +47,6 @@ object Checking {
4747
this.visited = state.visited
4848
res
4949

50-
5150
def isFieldInitialized(field: Symbol): Boolean =
5251
init || fieldsInited.contains(field)
5352

compiler/src/dotty/tools/dotc/transform/init/CycleChecker.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,7 @@ class CycleChecker(cache: Cache) {
216216
dependencies = mutable.Set.empty,
217217
env = env,
218218
init = true
219-
) {
220-
override def isFieldInitialized(field: Symbol): Boolean = true
221-
}
219+
)
222220

223221
val pot = Hot(dep.cls)(dep.source)
224222
val effs = pot.potentialsOf(dep.symbol)(using env).promote(dep.source)

0 commit comments

Comments
 (0)