Skip to content

Commit 227dfa9

Browse files
committed
Address review comments
1 parent e46bcd1 commit 227dfa9

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1076,7 +1076,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] {
10761076
def canCompare(atoms: Set[Type]): Boolean =
10771077
ctx.phase.isTyper || {
10781078
val hasSkolems = new ExistsAccumulator(_.isInstanceOf[SkolemType]) {
1079-
override val stopAtStatic = true
1079+
override def stopAtStatic = true
10801080
}
10811081
!atoms.exists(hasSkolems(false, _))
10821082
}

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,8 @@ trait TypeOps { this: Context => // TODO: Make standalone object.
219219
// 2.1. If only one widening succeeds, pick that one.
220220
// 2.2. If the two widened types are in a subtype relationship, pick the smaller one.
221221
// 2.3. If exactly one of the two types is a singleton type, pick that one.
222-
// 2.4. If the widened tp1 is a supertype of tp2, pick widened tp1.
223-
// 2.5. If the widened tp2 is a supertype of tp1, pick widened tp2.
222+
// 2.4. If the widened tp2 is a supertype of tp1, pick widened tp2.
223+
// 2.5. If the widened tp1 is a supertype of tp2, pick widened tp1.
224224
// 2.6. Otherwise, pick tp1
225225
//
226226
// At steps 4-6 we lose possible solutions, since we have to make an
@@ -251,14 +251,14 @@ trait TypeOps { this: Context => // TODO: Make standalone object.
251251
val isSingle1 = tp1.isInstanceOf[SingletonType]
252252
val isSingle2 = tp2.isInstanceOf[SingletonType]
253253
return {
254-
if (tp2w eq tp2) orDominator(tp1w | tp2)
255-
else if (tp1w eq tp1) orDominator(tp1 | tp2w)
256-
else if (tp1w frozen_<:< tp2w) orDominator(tp1w | tp2)
257-
else if (tp2w frozen_<:< tp1w) orDominator(tp1 | tp2w)
258-
else if (isSingle1 && !isSingle2) orDominator(tp1w | tp2)
259-
else if (isSingle2 && !isSingle1) orDominator(tp1 | tp2w)
260-
else if (tp1 frozen_<:< tp2w) tp2w
261-
else orDominator(tp1w | tp2)
254+
if (tp2w eq tp2) orDominator(tp1w | tp2) // 2.1
255+
else if (tp1w eq tp1) orDominator(tp1 | tp2w) // 2.1
256+
else if (tp1w frozen_<:< tp2w) orDominator(tp1w | tp2) // 2.2
257+
else if (tp2w frozen_<:< tp1w) orDominator(tp1 | tp2w) // 2.2
258+
else if (isSingle1 && !isSingle2) orDominator(tp1w | tp2) // 2.3
259+
else if (isSingle2 && !isSingle1) orDominator(tp1 | tp2w) // 2.3
260+
else if (tp1 frozen_<:< tp2w) tp2w // 2.4
261+
else orDominator(tp1w | tp2) // 2.5 and 2.6
262262
}
263263
}
264264

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1063,7 +1063,7 @@ object Types {
10631063
tp
10641064
}
10651065

1066-
/** Widen all top-level singletons reachable by dealising
1066+
/** Widen all top-level singletons reachable by dealiasing
10671067
* and going to the operands of & and |.
10681068
* Overridden and cached in OrType.
10691069
*/

tests/pos/i6288.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ object O {
99
val x = 3
1010
opaque type T = x.type
1111
object T {
12-
def wrap(a: x.type): T = a // Error
12+
def wrap(a: x.type): T = a // was an error, now OK
1313
def unwrap(a: T): x.type = a // OK
1414
}
1515
}

0 commit comments

Comments
 (0)