Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 04b2c3e

Browse files
committedOct 10, 2019
Address review
1 parent 7d3ba8f commit 04b2c3e

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed
 

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2140,14 +2140,14 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
21402140
private def typeparamCorrespondsToField(tycon: Type, tparam: TypeParamInfo): Boolean =
21412141
productSelectorTypes(tycon, null).exists {
21422142
case tp: TypeRef =>
2143-
(tp.designator: Any) == tparam // Bingo!
2143+
tp.designator.eq(tparam) // Bingo!
21442144
case _ =>
21452145
false
21462146
}
21472147

21482148
/** Is `tp` an empty type?
21492149
*
2150-
* `true` implies that we found a proof; uncertainty default to `false`.
2150+
* `true` implies that we found a proof; uncertainty defaults to `false`.
21512151
*/
21522152
def provablyEmpty(tp: Type): Boolean =
21532153
tp.dealias match {
@@ -2156,9 +2156,9 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
21562156
case OrType(tp1, tp2) => provablyEmpty(tp1) && provablyEmpty(tp2)
21572157
case at @ AppliedType(tycon, args) =>
21582158
args.lazyZip(tycon.typeParams).exists { (arg, tparam) =>
2159-
tparam.paramVariance >= 0 &&
2160-
provablyEmpty(arg) &&
2161-
typeparamCorrespondsToField(tycon, tparam)
2159+
tparam.paramVariance >= 0
2160+
&& provablyEmpty(arg)
2161+
&& typeparamCorrespondsToField(tycon, tparam)
21622162
}
21632163
case tp: TypeProxy =>
21642164
provablyEmpty(tp.underlying)
@@ -2168,7 +2168,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
21682168

21692169
/** Are `tp1` and `tp2` provablyDisjoint types?
21702170
*
2171-
* `true` implies that we found a proof; uncertainty default to `false`.
2171+
* `true` implies that we found a proof; uncertainty defaults to `false`.
21722172
*
21732173
* Proofs rely on the following properties of Scala types:
21742174
*
@@ -2178,7 +2178,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
21782178
* 4. There is no value of type Nothing
21792179
*
21802180
* Note on soundness: the correctness of match types relies on on the
2181-
* property that in all possible contexts, a same match type expression
2181+
* property that in all possible contexts, the same match type expression
21822182
* is either stuck or reduces to the same case.
21832183
*/
21842184
def provablyDisjoint(tp1: Type, tp2: Type)(implicit ctx: Context): Boolean = {
@@ -2221,8 +2221,8 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] w
22212221
else
22222222
false
22232223
case (AppliedType(tycon1, args1), AppliedType(tycon2, args2)) if tycon1 == tycon2 =>
2224-
// It is possible to conclude that two types applies are disjoints by
2225-
// looking at covariant type parameters if The said type parameters
2224+
// It is possible to conclude that two types applies are disjoint by
2225+
// looking at covariant type parameters if the said type parameters
22262226
// are disjoin and correspond to fields.
22272227
// (Type parameter disjointness is not enough by itself as it could
22282228
// lead to incorrect conclusions for phantom type parameters).

0 commit comments

Comments
 (0)
Please sign in to comment.