Skip to content

Commit 0852d03

Browse files
committed
Rename mode bit
1 parent d81746c commit 0852d03

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

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

+8-5
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,19 @@ object Mode {
103103
*/
104104
val CheckBoundsOrSelfType: Mode = newMode(14, "CheckBoundsOrSelfType")
105105

106-
/** Use Scala2 scheme for overloading and implicit resolution */
107-
val OldOverloadingResolution: Mode = newMode(15, "OldOverloadingResolution")
106+
/** Use previous Scheme for implicit resolution. Currently significant
107+
* in 3.0-migration where we use Scala-2's scheme instead and in 3.5-migration
108+
* where we use the previous scheme up to 3.4 instead.
109+
*/
110+
val OldImplicitResolution: Mode = newMode(15, "OldImplicitResolution")
108111

109112
/** Treat CapturingTypes as plain AnnotatedTypes even in phase CheckCaptures.
110-
* Reuses the value of OldOverloadingResolution to save Mode bits.
111-
* This is OK since OldOverloadingResolution only affects implicit search, which
113+
* Reuses the value of OldImplicitResolution to save Mode bits.
114+
* This is OK since OldImplicitResolution only affects implicit search, which
112115
* is done during phases Typer and Inlinig, and IgnoreCaptures only has an
113116
* effect during phase CheckCaptures.
114117
*/
115-
val IgnoreCaptures = OldOverloadingResolution
118+
val IgnoreCaptures = OldImplicitResolution
116119

117120
/** Allow hk applications of type lambdas to wildcard arguments;
118121
* used for checking that such applications do not normally arise

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -1703,7 +1703,7 @@ trait Applications extends Compatibility {
17031703
* and mode.
17041704
*
17051705
* - In Scala 2, `<:p` was the same as `<:`. This behavior is still
1706-
* available in 3.0-migration if mode `Mode.OldOverloadingResolution` is turned on as well.
1706+
* available in 3.0-migration if mode `Mode.OldImplicitResolution` is turned on as well.
17071707
* It is used to highlight differences between Scala 2 and 3 behavior.
17081708
*
17091709
* - In Scala 3.0-3.4, the behavior is as follows: `T <:p U` iff there is an impliit conversion
@@ -1727,14 +1727,14 @@ trait Applications extends Compatibility {
17271727
* (when `preferGeneral` is true). For old-style implicit values, the 3.4 behavior is kept.
17281728
*
17291729
* - In Scala 3.5-migration, use the 3.5 scheme normally, and the 3.4 scheme if
1730-
* `Mode.OldOverloadingResolution` is on. This is used to highlight differences in the
1730+
* `Mode.OldImplicitResolution` is on. This is used to highlight differences in the
17311731
* two resolution schemes.
17321732
*
17331733
* Also and only for given resolution: If a compared type refers to a given or its module class, use
17341734
* the intersection of its parent classes instead.
17351735
*/
17361736
def isAsGoodValueType(tp1: Type, tp2: Type)(using Context) =
1737-
val oldResolution = ctx.mode.is(Mode.OldOverloadingResolution)
1737+
val oldResolution = ctx.mode.is(Mode.OldImplicitResolution)
17381738
if !preferGeneral || Feature.migrateTo3 && oldResolution then
17391739
// Normal specificity test for overloading resolution (where `preferGeneral` is false)
17401740
// and in mode Scala3-migration when we compare with the old Scala 2 rules.

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -1104,8 +1104,8 @@ trait Implicits:
11041104
case result: SearchFailure if result.isAmbiguous =>
11051105
val deepPt = pt.deepenProto
11061106
if (deepPt ne pt) inferImplicit(deepPt, argument, span)
1107-
else if (migrateTo3 && !ctx.mode.is(Mode.OldOverloadingResolution))
1108-
withMode(Mode.OldOverloadingResolution)(inferImplicit(pt, argument, span)) match {
1107+
else if (migrateTo3 && !ctx.mode.is(Mode.OldImplicitResolution))
1108+
withMode(Mode.OldImplicitResolution)(inferImplicit(pt, argument, span)) match {
11091109
case altResult: SearchSuccess =>
11101110
report.migrationWarning(
11111111
result.reason.msg
@@ -1295,7 +1295,7 @@ trait Implicits:
12951295
else
12961296
val cmp = comp(using searchContext())
12971297
if Feature.sourceVersion == SourceVersion.`3.5-migration` then
1298-
val prev = comp(using searchContext().addMode(Mode.OldOverloadingResolution))
1298+
val prev = comp(using searchContext().addMode(Mode.OldImplicitResolution))
12991299
if cmp != prev then
13001300
def choice(c: Int) = c match
13011301
case -1 => "the second alternative"

0 commit comments

Comments
 (0)