Skip to content

Commit e57d85c

Browse files
committed
Migrate transform
1 parent 955aaf0 commit e57d85c

File tree

104 files changed

+268
-63
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+268
-63
lines changed

compiler/src/dotty/tools/dotc/core/ContextOps.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ object ContextOps:
3232
if (ctx.owner.isClass)
3333
if (ctx.outer.owner == ctx.owner) { // inner class scope; check whether we are referring to self
3434
if (ctx.scope.size == 1) {
35-
val elem = ctx.scope.lastEntry
35+
val elem = ctx.scope.lastEntry.nn
3636
if (elem.name == name) return elem.sym.denot // return self
3737
}
3838
val pre = ctx.owner.thisType

compiler/src/dotty/tools/dotc/core/Scopes.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ object Scopes {
6868
abstract class Scope extends printing.Showable {
6969

7070
/** The last scope-entry from which all others are reachable via `prev` */
71-
private[dotc] def lastEntry: ScopeEntry
71+
private[dotc] def lastEntry: ScopeEntry | Null
7272

7373
/** The number of symbols in this scope (including inherited ones
7474
* from outer scopes).
@@ -203,7 +203,7 @@ object Scopes {
203203

204204
def this(nestingLevel: Int) = this(null, 0, nestingLevel)
205205

206-
private[dotc] var lastEntry: ScopeEntry = initElems
206+
private[dotc] var lastEntry: ScopeEntry | Null = initElems
207207

208208
/** The size of the scope */
209209
private var _size = initSize

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package dotty.tools
22
package dotc
33
package transform
44

5+
import scala.language.{unsafeNulls => _}
6+
57
import core._
68
import Contexts._
79
import Symbols._

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package dotty.tools.dotc
22
package transform
33

4+
import scala.language.{unsafeNulls => _}
5+
46
import core._
57
import MegaPhase._
68
import Contexts._

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package dotty.tools.dotc
22
package transform
33

4+
import scala.language.{unsafeNulls => _}
5+
46
import core._
57
import MegaPhase._
68
import Contexts._

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package dotty.tools.dotc
22
package transform
33

4+
import scala.language.{unsafeNulls => _}
5+
46
import core._
57
import ast.tpd._
68
import Annotations._

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package dotty.tools
22
package dotc
33
package transform
44

5+
import scala.language.{unsafeNulls => _}
6+
57
import core._
68
import Flags._
79
import MegaPhase._

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package dotty.tools
22
package dotc
33
package transform
44

5+
import scala.language.{unsafeNulls => _}
6+
57
import core._
68
import Symbols._, Types._, Contexts._, Decorators._, Flags._, Scopes._, Phases._
79
import DenotTransformers._

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package dotty.tools.dotc
22
package transform
33

4+
import scala.language.{unsafeNulls => _}
5+
46
import core._
57
import Contexts._
68
import Symbols._

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package dotty.tools.dotc
22
package transform
33

4+
import scala.language.{unsafeNulls => _}
5+
46
import MegaPhase._
57
import core.DenotTransformers._
68
import core.Symbols._
@@ -47,10 +49,10 @@ class CapturedVars extends MiniPhase with IdentityDenotTransformer { thisPhase =
4749
refClassKeys.flatMap(k => Set(refClass(k), volatileRefClass(k)))
4850
}
4951

50-
private var myRefInfo: RefInfo = null
51-
private def refInfo(using Context) = {
52+
private var myRefInfo: RefInfo | Null = null
53+
private def refInfo(using Context): RefInfo = {
5254
if (myRefInfo == null) myRefInfo = new RefInfo()
53-
myRefInfo
55+
myRefInfo.asInstanceOf[RefInfo]
5456
}
5557

5658
private class CollectCaptured extends TreeTraverser {

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package dotty.tools.dotc
22
package transform
33

4+
import scala.language.{unsafeNulls => _}
5+
46
import core.*
57
import MegaPhase.MiniPhase
68
import Contexts.*, Types.*, Symbols.*, SymDenotations.*, Flags.*
@@ -20,7 +22,7 @@ class CheckLoopingImplicits extends MiniPhase:
2022

2123
override def phaseName: String = CheckLoopingImplicits.name
2224

23-
override def transformValDef(mdef: ValDef)(using Context): Tree =
25+
override def transformValDef(mdef: ValDef)(using Context): Tree =
2426
transform(mdef)
2527

2628
override def transformDefDef(mdef: DefDef)(using Context): Tree =
@@ -79,7 +81,7 @@ class CheckLoopingImplicits extends MiniPhase:
7981
checkNotLooping(finalizer)
8082
case SeqLiteral(elems, _) =>
8183
elems.foreach(checkNotLooping)
82-
case t: ValDef =>
84+
case t: ValDef =>
8385
checkNotLooping(t.rhs)
8486
case _ =>
8587

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package dotty.tools.dotc
22
package transform
33

4+
import scala.language.{unsafeNulls => _}
5+
46
import core.*
57
import MegaPhase.MiniPhase
68
import Contexts.*, Types.*, Symbols.*, SymDenotations.*, Flags.*

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package dotty.tools.dotc
22
package transform
33

4+
import scala.language.{unsafeNulls => _}
5+
46
import core._
57
import dotty.tools.dotc.transform.MegaPhase._
68
import Flags._

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package dotty.tools.dotc
22
package transform
33

4+
import scala.language.{unsafeNulls => _}
5+
46
import core._
57
import dotty.tools.dotc.transform.MegaPhase._
68
import Flags._

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
package dotty.tools.dotc.transform
1+
package dotty.tools.dotc
2+
package transform
3+
4+
import scala.language.{unsafeNulls => _}
25

3-
import dotty.tools.dotc.ast.tpd
4-
import dotty.tools.dotc.core.Contexts.Context
5-
import dotty.tools.dotc.core.Types
6-
import dotty.tools.dotc.transform.MegaPhase._
76
import java.io.{File => _}
87

9-
import dotty.tools.dotc.core._
8+
import ast.tpd
9+
import core._
10+
import transform.MegaPhase._
1011
import SymDenotations._
1112
import Contexts._
1213
import Types._
1314
import Symbols._
1415
import Phases._
15-
import dotty.tools.dotc.util.SourcePosition
16+
import util.SourcePosition
1617
import Decorators._
1718
import StdNames.nme
1819
import dotty.tools.io.JarArchive
@@ -41,7 +42,7 @@ class CollectEntryPoints extends MiniPhase:
4142

4243
private def getEntryPoint(tree: tpd.TypeDef)(using Context): Option[String] =
4344
val sym = tree.symbol
44-
import dotty.tools.dotc.core.NameOps.stripModuleClassSuffix
45+
import core.NameOps.stripModuleClassSuffix
4546
val name = sym.fullName.stripModuleClassSuffix.toString
4647
Option.when(sym.isStatic && !sym.is(Flags.Trait) && ctx.platform.hasMainMethod(sym))(name)
4748

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package dotty.tools.dotc.transform
22

3+
import scala.language.{unsafeNulls => _}
4+
35
import dotty.tools.dotc.ast.tpd
46
import dotty.tools.dotc.core.Contexts._
57
import dotty.tools.dotc.core.Flags._
@@ -97,7 +99,7 @@ class CollectNullableFields extends MiniPhase {
9799

98100
nullability.foreach {
99101
case (sym, Nullable(from)) =>
100-
val bldr = result.computeIfAbsent(from, _ => new mutable.ListBuffer)
102+
val bldr = result.computeIfAbsent(from, _ => new mutable.ListBuffer).nn
101103
bldr += sym
102104
case _ =>
103105
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package dotty.tools
22
package dotc
33
package transform
44

5+
import scala.language.{unsafeNulls => _}
6+
57
import core._
68
import Names._
79
import StdNames.{nme, tpnme}

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
package dotty.tools.dotc
22
package transform
33

4+
import scala.language.{unsafeNulls => _}
5+
46
import core._
57
import MegaPhase._
6-
import dotty.tools.dotc.ast.tpd._
7-
import dotty.tools.dotc.core.Contexts._
8-
import dotty.tools.dotc.core.StdNames._
8+
import ast.tpd._
9+
import core.Contexts._
10+
import core.StdNames._
911
import ast._
1012
import Trees._
1113
import Flags._

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package dotty.tools
22
package dotc
33
package transform
44

5+
import scala.language.{unsafeNulls => _}
6+
57
import core._
68
import Contexts._, Symbols._, Types._, Annotations._, Constants._, Phases._
79
import StdNames.nme

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package dotty.tools.dotc.transform
22

3+
import scala.language.{unsafeNulls => _}
4+
35
import dotty.tools.dotc.ast.tpd
46
import dotty.tools.dotc.core.Contexts._
57
import dotty.tools.dotc.core.ContextOps._

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package dotty.tools.dotc
22
package transform
33

4+
import scala.language.{unsafeNulls => _}
5+
46
import core._
57
import MegaPhase.MiniPhase
68
import dotty.tools.dotc.core.Contexts._

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package dotty.tools.dotc
22
package transform
33

4+
import scala.language.{unsafeNulls => _}
5+
46
import core.Contexts._
57

68
/** Utility class for lazy values whose evaluation depends on a context.

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package dotty.tools.dotc
22
package transform
33

4+
import scala.language.{unsafeNulls => _}
5+
46
import core.*
57
import Symbols.*, Contexts.*, Types.*, Flags.*, Decorators.*
68
import ast.Trees.*

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package dotty.tools.dotc
22
package transform
33

4+
import scala.language.{unsafeNulls => _}
5+
46
import core._
57
import MegaPhase.MiniPhase
68
import dotty.tools.dotc.core.Contexts._

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package dotty.tools.dotc
22
package transform
33

4+
import scala.language.{unsafeNulls => _}
5+
46
import core._
57
import DenotTransformers.InfoTransformer
68
import Symbols._

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package dotty.tools
22
package dotc
33
package transform
44

5+
import scala.language.{unsafeNulls => _}
6+
57
import ast.{Trees, tpd}
68
import core._, core.Decorators._
79
import MegaPhase._

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package dotty.tools
22
package dotc
33
package transform
44

5+
import scala.language.{unsafeNulls => _}
6+
57
import core._
68
import dotty.tools.dotc.transform.MegaPhase._
79
import Flags._

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package dotty.tools.dotc
22
package transform
33

4+
import scala.language.{unsafeNulls => _}
5+
46
import core._
57
import MegaPhase.MiniPhase
68
import Contexts._

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package dotty.tools.dotc
22
package transform
33

4+
import scala.language.{unsafeNulls => _}
5+
46
import core._
57
import Decorators._, Flags._, Types._, Contexts._, Symbols._
68
import ast.tpd._

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package dotty.tools.dotc
22
package transform
33

4+
import scala.language.{unsafeNulls => _}
5+
46
import ast.{Trees, tpd}
57
import core._, core.Decorators._
68
import MegaPhase._, Phases.Phase

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package dotty.tools
22
package dotc
33
package transform
44

5+
import scala.language.{unsafeNulls => _}
6+
57
import core._
68
import StdNames.nme
79
import Types._

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package dotty.tools.dotc
22
package transform
33

4+
import scala.language.{unsafeNulls => _}
5+
46
import core._
57
import Contexts._
68
import Flags._

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package dotty.tools
22
package dotc
33
package transform
44

5+
import scala.language.{unsafeNulls => _}
6+
57
import core.Phases._
68
import core.DenotTransformers._
79
import core.Denotations._
@@ -682,7 +684,7 @@ object Erasure {
682684
val owner = sym.maybeOwner
683685
if defn.specialErasure.contains(owner) then
684686
assert(sym.isConstructor, s"${sym.showLocated}")
685-
defn.specialErasure(owner)
687+
defn.specialErasure(owner).nn
686688
else if defn.isSyntheticFunctionClass(owner) then
687689
defn.functionTypeErasure(owner).typeSymbol
688690
else

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package dotty.tools.dotc
22
package transform
33

4+
import scala.language.{unsafeNulls => _}
5+
46
import core._
57
import dotty.tools.dotc.core.DenotTransformers.IdentityDenotTransformer
68
import Contexts._

0 commit comments

Comments
 (0)