Skip to content

Commit 52b2ec6

Browse files
committed
Fix some warnings in compiler codebase
1 parent 27da113 commit 52b2ec6

Some content is hidden

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

56 files changed

+165
-180
lines changed

compiler/src/dotty/tools/dotc/ast/Desugar.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2344,9 +2344,9 @@ object desugar {
23442344
val nspace = if (ctx.mode.is(Mode.Type)) tpnme else nme
23452345
Select(t, nspace.UNARY_PREFIX ++ op.name)
23462346
case ForDo(enums, body) =>
2347-
makeFor(nme.foreach, nme.foreach, enums, body) orElse tree
2347+
makeFor(nme.foreach, nme.foreach, enums, body) `orElse` tree
23482348
case ForYield(enums, body) =>
2349-
makeFor(nme.map, nme.flatMap, enums, body) orElse tree
2349+
makeFor(nme.map, nme.flatMap, enums, body) `orElse` tree
23502350
case PatDef(mods, pats, tpt, rhs) =>
23512351
val pats1 = if (tpt.isEmpty) pats else pats map (Typed(_, tpt))
23522352
flatTree(pats1 map (makePatDef(tree, mods, _, rhs)))

compiler/src/dotty/tools/dotc/ast/tpd.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
601601
*/
602602
def ModuleDef(sym: TermSymbol, body: List[Tree])(using Context): tpd.Thicket = {
603603
val modcls = sym.moduleClass.asClass
604-
val constrSym = modcls.primaryConstructor orElse newDefaultConstructor(modcls).entered
604+
val constrSym = modcls.primaryConstructor `orElse` newDefaultConstructor(modcls).entered
605605
val constr = DefDef(constrSym.asTerm, EmptyTree)
606606
val clsdef = ClassDef(modcls, constr, body)
607607
val valdef = ValDef(sym, New(modcls.typeRef).select(constrSym).appliedToNone)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ object Comments {
429429

430430
searchList collectFirst { case x if defs(x) contains vble => defs(x)(vble) } match {
431431
case Some(str) if str startsWith "$" => lookupVariable(str.tail, site)
432-
case res => res orElse lookupVariable(vble, site.owner)
432+
case res => res `orElse` lookupVariable(vble, site.owner)
433433
}
434434
}
435435

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ object ContextOps:
9292
}.find(_.exists).getOrElse(NoDenotation)
9393

9494
if preSym.isClass then
95-
directSearch orElse searchCompanionClass orElse searchSuperCompanionObjects
95+
directSearch `orElse` searchCompanionClass `orElse` searchSuperCompanionObjects
9696
else
9797
directSearch
9898
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ object Contexts {
377377
def isImportContext: Boolean =
378378
(this ne NoContext)
379379
&& (outer ne NoContext)
380-
&& (this.importInfo nen outer.importInfo)
380+
&& (this.importInfo ne outer.importInfo)
381381

382382
/** Is this a context that introduces a non-empty scope? */
383383
def isNonEmptyScopeContext: Boolean =

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ object Denotations {
288288
*/
289289
inline def disambiguate(inline p: Symbol => Boolean)(using Context): SingleDenotation = this match {
290290
case sdenot: SingleDenotation => sdenot
291-
case mdenot => suchThat(p) orElse NoQualifyingRef(alternatives)
291+
case mdenot => suchThat(p) `orElse` NoQualifyingRef(alternatives)
292292
}
293293

294294
/** Return symbol in this denotation that satisfies the given predicate.
@@ -1237,7 +1237,7 @@ object Denotations {
12371237
g(denot1.aggregate(f, g), denot2.aggregate(f, g))
12381238
protected def derivedUnion(denot1: PreDenotation, denot2: PreDenotation) =
12391239
if ((denot1 eq this.denot1) && (denot2 eq this.denot2)) this
1240-
else denot1 union denot2
1240+
else denot1 `union` denot2
12411241
}
12421242

12431243
final case class DenotUnion(denot1: PreDenotation, denot2: PreDenotation) extends MultiPreDenotation {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ case class Mode(val bits: Int) extends AnyVal {
1414
def | (that: Mode): Mode = Mode(bits | that.bits)
1515
def & (that: Mode): Mode = Mode(bits & that.bits)
1616
def &~ (that: Mode): Mode = Mode(bits & ~that.bits)
17-
def is (that: Mode): Boolean = (bits & that.bits) == that.bits
17+
infix def is (that: Mode): Boolean = (bits & that.bits) == that.bits
1818

1919
def isExpr: Boolean = (this & PatternOrTypeBits) == None
2020

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ object Scopes {
152152
var syms: PreDenotation = NoDenotation
153153
var e = lookupEntry(name)
154154
while (e != null) {
155-
syms = syms union e.sym.denot
155+
syms = syms `union` e.sym.denot
156156
e = lookupNextEntry(e)
157157
}
158158
syms

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,15 +1161,15 @@ object SymDenotations {
11611161
val d = owner.info.decl(fieldName)
11621162
val field = d.suchThat(!_.is(Method)).symbol
11631163
def getter = d.suchThat(_.info.isParameterless).symbol
1164-
field orElse getter
1164+
field `orElse` getter
11651165
}
11661166

11671167
/** The field accessed by a getter or setter, or
11681168
* if it does not exists, the getter of a setter, or
11691169
* if that does not exist the symbol itself.
11701170
*/
11711171
def underlyingSymbol(using Context): Symbol =
1172-
if (is(Accessor)) accessedFieldOrGetter orElse symbol else symbol
1172+
if (is(Accessor)) accessedFieldOrGetter `orElse` symbol else symbol
11731173

11741174
/** The chain of owners of this denotation, starting with the denoting symbol itself */
11751175
final def ownersIterator(using Context): Iterator[Symbol] = new Iterator[Symbol] {
@@ -2588,7 +2588,7 @@ object SymDenotations {
25882588
else
25892589
val assocFiles = multi
25902590
.filterWithPredicate(_.symbol.maybeOwner.isPackageObject)
2591-
.aggregate(d => Set(d.symbol.associatedFile.nn), _ union _)
2591+
.aggregate(d => Set(d.symbol.associatedFile.nn), _ `union` _)
25922592
if assocFiles.size == 1 then
25932593
multi // they are all overloaded variants from the same file
25942594
else

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ class TyperState() {
291291
val toCollect = new mutable.ListBuffer[TypeLambda]
292292
for tvar <- ownedVars do
293293
val tvarState = tvar.owningState.nn.get
294-
assert(tvarState eqn this, s"Inconsistent state in $this: it owns $tvar whose owningState is ${tvarState}")
294+
assert(tvarState eq this, s"Inconsistent state in $this: it owns $tvar whose owningState is ${tvarState}")
295295
assert(!tvar.isPermanentlyInstantiated, s"Inconsistent state in $this: it owns $tvar which is already instantiated")
296296
val inst = constraint.instType(tvar)
297297
if inst.exists then

0 commit comments

Comments
 (0)