Skip to content

Commit c53297c

Browse files
committed
Clean code
1 parent 70a7252 commit c53297c

File tree

5 files changed

+7
-8
lines changed

5 files changed

+7
-8
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,6 @@ object Contexts {
269269
/** Either the current scope, or, if the current context owner is a class,
270270
* the declarations of the current class.
271271
*/
272-
// TODO: Should we change its type to nullable?
273-
// We can see its value can be null in nestingLevel below.
274272
def effectiveScope(using Context): Scope =
275273
val co: Symbol | Null = owner
276274
if co != null && co.isClass then co.asClass.unforcedDecls

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ final class ProperGadtConstraint private(
105105
params.indexOf(tp.symbol) match {
106106
case -1 =>
107107
mapping(tp.symbol) match {
108-
// TODO: Improve flow typing so that ascription becomes redundant, see #11967
109108
case tv: TypeVar => tv.origin
110109
case null => tp
111110
}
@@ -183,6 +182,7 @@ final class ProperGadtConstraint private(
183182
override def fullBounds(sym: Symbol)(using Context): TypeBounds | Null =
184183
mapping(sym) match {
185184
case null => null
185+
// TODO: Improve flow typing so that ascription becomes redundant
186186
case tv: TypeVar =>
187187
fullBounds(tv.origin)
188188
// .ensuring(containsNoInternalTypes(_))
@@ -191,6 +191,7 @@ final class ProperGadtConstraint private(
191191
override def bounds(sym: Symbol)(using Context): TypeBounds | Null =
192192
mapping(sym) match {
193193
case null => null
194+
// TODO: Improve flow typing so that ascription becomes redundant
194195
case tv: TypeVar =>
195196
def retrieveBounds: TypeBounds =
196197
bounds(tv.origin) match {

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
780780
}
781781
catch {
782782
case ex: FromDigitsException =>
783-
report.error(ex.getMessage.uncheckedNN, tree.srcPos)
783+
report.error(ex.getMessage.nn, tree.srcPos)
784784
tree.kind match {
785785
case Whole(_) => lit(0)
786786
case _ => lit(0.0)
@@ -1649,7 +1649,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
16491649
if ctx.scope.lookup(b.name) == NoSymbol then ctx.enter(sym)
16501650
else report.error(new DuplicateBind(b, cdef), b.srcPos)
16511651
if (!ctx.isAfterTyper) {
1652-
val bounds: TypeBounds | Null = ctx.gadt.fullBounds(sym)
1652+
val bounds = ctx.gadt.fullBounds(sym)
16531653
if (bounds != null) sym.info = bounds
16541654
}
16551655
b

compiler/src/dotty/tools/dotc/util/GenericHashMap.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ abstract class GenericHashMap[Key, Value]
151151
else
152152
var idx = 0
153153
while idx < oldTable.length do
154-
val key: Key | Null = oldTable(idx).asInstanceOf[Key | Null]
155-
if key != null then addOld(key.uncheckedNN, oldTable(idx + 1).asInstanceOf[Value])
154+
val key = oldTable(idx)
155+
if key != null then addOld(key.asInstanceOf[Key], oldTable(idx + 1).asInstanceOf[Value])
156156
idx += 2
157157

158158
protected def growTable(): Unit =

compiler/src/dotty/tools/dotc/util/WeakHashSet.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ abstract class WeakHashSet[A <: AnyRef](initialCapacity: Int = 8, loadFactor: Do
259259
else {
260260
val result = lookaheadelement.nn
261261
lookaheadelement = null
262-
entry = entry.nn.tail // TODO
262+
entry = entry.nn.tail
263263
result
264264
}
265265
}

0 commit comments

Comments
 (0)