File tree 4 files changed +6
-7
lines changed
compiler/src/dotty/tools/dotc
4 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -274,9 +274,7 @@ object Contexts {
274
274
def effectiveScope (using Context ): Scope =
275
275
val co : Symbol | Null = owner
276
276
if co != null && co.isClass then co.asClass.unforcedDecls
277
- else
278
- val s : Scope | Null = scope
279
- if s == null then EmptyScope else s
277
+ else scope
280
278
281
279
def nestingLevel : Int = effectiveScope.nestingLevel
282
280
@@ -828,6 +826,7 @@ object Contexts {
828
826
owner = NoSymbol
829
827
tree = untpd.EmptyTree
830
828
moreProperties = Map (MessageLimiter -> DefaultMessageLimiter ())
829
+ scope = EmptyScope
831
830
source = NoSource
832
831
store = initialStore
833
832
.updated(settingsStateLoc, settingsGroup.defaultState)
Original file line number Diff line number Diff line change @@ -1237,7 +1237,7 @@ object SymDenotations {
1237
1237
.map(tpd.definedSym)
1238
1238
.find(_.name == name)
1239
1239
.getOrElse(NoSymbol )
1240
- else if (( ctx.scope: Scope | Null ) == null ) // TODO
1240
+ else if (ctx.scope eq EmptyScope )
1241
1241
NoSymbol
1242
1242
else if (ctx.scope.lookup(this .name) == symbol)
1243
1243
ctx.scope.lookup(name)
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import dotty.tools.dotc.core.Flags._
11
11
import dotty .tools .dotc .core .Names .{Name , TermName }
12
12
import dotty .tools .dotc .core .NameKinds .SimpleNameKind
13
13
import dotty .tools .dotc .core .NameOps ._
14
+ import dotty .tools .dotc .core .Scopes ._
14
15
import dotty .tools .dotc .core .Symbols .{Symbol , defn }
15
16
import dotty .tools .dotc .core .StdNames .nme
16
17
import dotty .tools .dotc .core .SymDenotations .SymDenotation
@@ -185,7 +186,7 @@ object Completion {
185
186
.groupByName.foreach { (name, denots) =>
186
187
addMapping(name, ScopedDenotations (denots, ctx))
187
188
}
188
- else if ctx.scope != null then
189
+ else if ctx.scope ne EmptyScope then
189
190
ctx.scope.toList.filter(symbol => include(symbol, symbol.name))
190
191
.flatMap(_.alternatives)
191
192
.groupByName.foreach { (name, denots) =>
Original file line number Diff line number Diff line change @@ -324,8 +324,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
324
324
(prevPrec.ordinal < prec.ordinal || prevPrec == prec && (prevCtx.scope eq ctx.scope))
325
325
326
326
@ tailrec def loop (lastCtx : Context )(using Context ): Type =
327
- // Can ctx.scope actually be null?
328
- if ((ctx.scope: Scope | Null ) == null ) previous
327
+ if (ctx.scope eq EmptyScope ) previous
329
328
else {
330
329
var result : Type = NoType
331
330
You can’t perform that action at this time.
0 commit comments