Skip to content

Commit 88cfb7e

Browse files
Fix spacing for TypeComparer comments
1 parent 6755f52 commit 88cfb7e

File tree

2 files changed

+40
-40
lines changed

2 files changed

+40
-40
lines changed

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

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] {
528528
case tp2: HKTypeLambda =>
529529
def compareTypeLambda: Boolean = tp1.stripTypeVar match {
530530
case tp1: HKTypeLambda =>
531-
/* Don't compare bounds of lambdas under language:Scala2, or t2994 will fail.
531+
/* Don't compare bounds of lambdas under language:Scala2, or t2994 will fail.
532532
* The issue is that, logically, bounds should compare contravariantly,
533533
* but that would invalidate a pattern exploited in t2994:
534534
*
@@ -761,14 +761,14 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] {
761761
}
762762

763763
/** Subtype test for the hk application `tp2 = tycon2[args2]`.
764-
*/
764+
*/
765765
def compareAppliedType2(tp2: AppliedType, tycon2: Type, args2: List[Type]): Boolean = {
766766
val tparams = tycon2.typeParams
767767
if (tparams.isEmpty) return false // can happen for ill-typed programs, e.g. neg/tcpoly_overloaded.scala
768768

769769
/** True if `tp1` and `tp2` have compatible type constructors and their
770-
* corresponding arguments are subtypes relative to their variance (see `isSubArgs`).
771-
*/
770+
* corresponding arguments are subtypes relative to their variance (see `isSubArgs`).
771+
*/
772772
def isMatchingApply(tp1: Type): Boolean = tp1 match {
773773
case AppliedType(tycon1, args1) =>
774774
tycon1.dealiasKeepRefiningAnnots match {
@@ -815,25 +815,25 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] {
815815
}
816816

817817
/** `param2` can be instantiated to a type application prefix of the LHS
818-
* or to a type application prefix of one of the LHS base class instances
819-
* and the resulting type application is a supertype of `tp1`,
820-
* or fallback to fourthTry.
821-
*/
818+
* or to a type application prefix of one of the LHS base class instances
819+
* and the resulting type application is a supertype of `tp1`,
820+
* or fallback to fourthTry.
821+
*/
822822
def canInstantiate(tycon2: TypeParamRef): Boolean = {
823823

824824
/** Let
825-
*
826-
* `tparams_1, ..., tparams_k-1` be the type parameters of the rhs
827-
* `tparams1_1, ..., tparams1_n-1` be the type parameters of the constructor of the lhs
828-
* `args1_1, ..., args1_n-1` be the type arguments of the lhs
829-
* `d = n - k`
830-
*
831-
* Returns `true` iff `d >= 0` and `tycon2` can be instantiated to
832-
*
833-
* [tparams1_d, ... tparams1_n-1] -> tycon1[args_1, ..., args_d-1, tparams_d, ... tparams_n-1]
834-
*
835-
* such that the resulting type application is a supertype of `tp1`.
836-
*/
825+
*
826+
* `tparams_1, ..., tparams_k-1` be the type parameters of the rhs
827+
* `tparams1_1, ..., tparams1_n-1` be the type parameters of the constructor of the lhs
828+
* `args1_1, ..., args1_n-1` be the type arguments of the lhs
829+
* `d = n - k`
830+
*
831+
* Returns `true` iff `d >= 0` and `tycon2` can be instantiated to
832+
*
833+
* [tparams1_d, ... tparams1_n-1] -> tycon1[args_1, ..., args_d-1, tparams_d, ... tparams_n-1]
834+
*
835+
* such that the resulting type application is a supertype of `tp1`.
836+
*/
837837
def appOK(tp1base: Type) = tp1base match {
838838
case tp1base: AppliedType =>
839839
var tycon1 = tp1base.tycon
@@ -874,21 +874,21 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] {
874874
}
875875

876876
/** Fall back to comparing either with `fourthTry` or against the lower
877-
* approximation of the rhs.
878-
* @param tyconLo The type constructor's lower approximation.
879-
*/
877+
* approximation of the rhs.
878+
* @param tyconLo The type constructor's lower approximation.
879+
*/
880880
def fallback(tyconLo: Type) =
881881
either(fourthTry, isSubApproxHi(tp1, tyconLo.applyIfParameterized(args2)))
882882

883883
/** Let `tycon2bounds` be the bounds of the RHS type constructor `tycon2`.
884-
* Let `app2 = tp2` where the type constructor of `tp2` is replaced by
885-
* `tycon2bounds.lo`.
886-
* If both bounds are the same, continue with `tp1 <:< app2`.
887-
* otherwise continue with either
888-
*
889-
* tp1 <:< tp2 using fourthTry (this might instantiate params in tp1)
890-
* tp1 <:< app2 using isSubType (this might instantiate params in tp2)
891-
*/
884+
* Let `app2 = tp2` where the type constructor of `tp2` is replaced by
885+
* `tycon2bounds.lo`.
886+
* If both bounds are the same, continue with `tp1 <:< app2`.
887+
* otherwise continue with either
888+
*
889+
* tp1 <:< tp2 using fourthTry (this might instantiate params in tp1)
890+
* tp1 <:< app2 using isSubType (this might instantiate params in tp2)
891+
*/
892892
def compareLower(tycon2bounds: TypeBounds, tyconIsTypeRef: Boolean): Boolean =
893893
if ((tycon2bounds.lo `eq` tycon2bounds.hi) && !tycon2bounds.isInstanceOf[MatchAlias])
894894
if (tyconIsTypeRef) recur(tp1, tp2.superType)
@@ -927,7 +927,7 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] {
927927
}
928928

929929
/** Subtype test for the application `tp1 = tycon1[args1]`.
930-
*/
930+
*/
931931
def compareAppliedType1(tp1: AppliedType, tycon1: Type, args1: List[Type]): Boolean =
932932
tycon1 match {
933933
case param1: TypeParamRef =>
@@ -973,8 +973,8 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] {
973973
}
974974

975975
/** Like tp1 <:< tp2, but returns false immediately if we know that
976-
* the case was covered previously during subtyping.
977-
*/
976+
* the case was covered previously during subtyping.
977+
*/
978978
def isNewSubType(tp1: Type): Boolean =
979979
if (isCovered(tp1) && isCovered(tp2)) {
980980
//println(s"useless subtype: $tp1 <:< $tp2")
@@ -1031,12 +1031,12 @@ class TypeComparer(initctx: Context) extends ConstraintHandling[AbsentContext] {
10311031
}
10321032

10331033
/** Subtype test for corresponding arguments in `args1`, `args2` according to
1034-
* variances in type parameters `tparams2`.
1035-
* @param tp1 The applied type containing `args1`
1036-
* @param tparams2 The type parameters of the type constructor applied to `args2`
1037-
*/
1034+
* variances in type parameters `tparams2`.
1035+
*
1036+
* @param tp1 The applied type containing `args1`
1037+
* @param tparams2 The type parameters of the type constructor applied to `args2`
1038+
*/
10381039
def isSubArgs(args1: List[Type], args2: List[Type], tp1: Type, tparams2: List[ParamInfo]): Boolean = {
1039-
10401040
/** The bounds of parameter `tparam`, where all references to type paramneters
10411041
* are replaced by corresponding arguments (or their approximations in the case of
10421042
* wildcard arguments).

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2415,7 +2415,7 @@ object Types {
24152415
}
24162416
}
24172417

2418-
/** A constant type with single `value`. */
2418+
/** A constant type with single `value`. */
24192419
abstract case class ConstantType(value: Constant) extends CachedProxyType with SingletonType {
24202420
override def underlying(implicit ctx: Context): Type = value.tpe
24212421

0 commit comments

Comments
 (0)