@@ -412,10 +412,9 @@ object Types extends TypeUtils {
412
412
catch case ex : Throwable => handleRecursive(" unusableForInference" , show, ex)
413
413
414
414
/** Does the type carry an annotation that is an instance of `cls`? */
415
- @ tailrec final def hasAnnotation (cls : ClassSymbol )(using Context ): Boolean = stripTypeVar match {
416
- case AnnotatedType (tp, annot) => ( annot matches cls) || (tp hasAnnotation cls)
415
+ @ tailrec final def hasAnnotation (cls : ClassSymbol )(using Context ): Boolean = stripTypeVar match
416
+ case AnnotatedType (tp, annot) => annot. matches( cls) || tp. hasAnnotation( cls)
417
417
case _ => false
418
- }
419
418
420
419
/** Returns the annotation that is an instance of `cls` carried by the type. */
421
420
@ tailrec final def getAnnotation (cls : ClassSymbol )(using Context ): Option [Annotation ] = stripTypeVar match {
@@ -584,8 +583,8 @@ object Types extends TypeUtils {
584
583
case AndType (l, r) =>
585
584
val lsym = l.classSymbol
586
585
val rsym = r.classSymbol
587
- if ( lsym isSubClass rsym) lsym
588
- else if ( rsym isSubClass lsym) rsym
586
+ if lsym. isSubClass( rsym) then lsym
587
+ else if rsym. isSubClass( lsym) then rsym
589
588
else NoSymbol
590
589
case tp : OrType =>
591
590
if tp.tp1.hasClassSymbol(defn.NothingClass ) then
@@ -724,7 +723,7 @@ object Types extends TypeUtils {
724
723
case tp : TypeProxy =>
725
724
tp.superType.findDecl(name, excluded)
726
725
case err : ErrorType =>
727
- newErrorSymbol(classSymbol orElse defn.RootClass , name, err.msg)
726
+ newErrorSymbol(classSymbol. orElse( defn.RootClass ) , name, err.msg)
728
727
case _ =>
729
728
NoDenotation
730
729
}
@@ -815,7 +814,7 @@ object Types extends TypeUtils {
815
814
case tp : JavaArrayType =>
816
815
defn.ObjectType .findMember(name, pre, required, excluded)
817
816
case err : ErrorType =>
818
- newErrorSymbol(pre.classSymbol orElse defn.RootClass , name, err.msg)
817
+ newErrorSymbol(pre.classSymbol. orElse( defn.RootClass ) , name, err.msg)
819
818
case _ =>
820
819
NoDenotation
821
820
}
@@ -919,7 +918,7 @@ object Types extends TypeUtils {
919
918
// member in Super instead of Sub.
920
919
// As an example of this in the wild, see
921
920
// loadClassWithPrivateInnerAndSubSelf in ShowClassTests
922
- go(tp.cls.typeRef) orElse d
921
+ go(tp.cls.typeRef). orElse(d)
923
922
924
923
def goParam (tp : TypeParamRef ) = {
925
924
val next = tp.underlying
@@ -1157,7 +1156,7 @@ object Types extends TypeUtils {
1157
1156
false
1158
1157
1159
1158
def relaxed_<:< (that : Type )(using Context ): Boolean =
1160
- (this <:< that) || ( this isValueSubType that)
1159
+ (this <:< that) || this . isValueSubType( that)
1161
1160
1162
1161
/** Is this type a legal type for member `sym1` that overrides another
1163
1162
* member `sym2` of type `that`? This is the same as `<:<`, except that
@@ -1208,10 +1207,10 @@ object Types extends TypeUtils {
1208
1207
* vice versa.
1209
1208
*/
1210
1209
def matchesLoosely (that : Type )(using Context ): Boolean =
1211
- ( this matches that) || {
1210
+ this . matches( that) || {
1212
1211
val thisResult = this .widenExpr
1213
1212
val thatResult = that.widenExpr
1214
- (this eq thisResult) != (that eq thatResult) && ( thisResult matchesLoosely thatResult)
1213
+ (this eq thisResult) != (that eq thatResult) && thisResult. matchesLoosely( thatResult)
1215
1214
}
1216
1215
1217
1216
/** The basetype of this type with given class symbol, NoType if `base` is not a class. */
@@ -1869,7 +1868,7 @@ object Types extends TypeUtils {
1869
1868
* no symbol it tries `member` as an alternative.
1870
1869
*/
1871
1870
def typeParamNamed (name : TypeName )(using Context ): Symbol =
1872
- classSymbol.unforcedDecls.lookup(name) orElse member(name).symbol
1871
+ classSymbol.unforcedDecls.lookup(name). orElse( member(name).symbol)
1873
1872
1874
1873
/** If this is a prototype with some ignored component, reveal one more
1875
1874
* layer of it. Otherwise the type itself.
@@ -2008,9 +2007,9 @@ object Types extends TypeUtils {
2008
2007
def annotatedToRepeated (using Context ): Type = this match {
2009
2008
case tp @ ExprType (tp1) =>
2010
2009
tp.derivedExprType(tp1.annotatedToRepeated)
2011
- case self @ AnnotatedType (tp, annot) if annot matches defn.RetainsByNameAnnot =>
2010
+ case self @ AnnotatedType (tp, annot) if annot. matches( defn.RetainsByNameAnnot ) =>
2012
2011
self.derivedAnnotatedType(tp.annotatedToRepeated, annot)
2013
- case AnnotatedType (tp, annot) if annot matches defn.RepeatedAnnot =>
2012
+ case AnnotatedType (tp, annot) if annot. matches( defn.RepeatedAnnot ) =>
2014
2013
val typeSym = tp.typeSymbol.asClass
2015
2014
assert(typeSym == defn.SeqClass || typeSym == defn.ArrayClass )
2016
2015
tp.translateParameterized(typeSym, defn.RepeatedParamClass )
@@ -2706,9 +2705,9 @@ object Types extends TypeUtils {
2706
2705
*/
2707
2706
final def controlled [T ](op : => T )(using Context ): T = try {
2708
2707
ctx.base.underlyingRecursions += 1
2709
- if ( ctx.base.underlyingRecursions < Config .LogPendingUnderlyingThreshold )
2708
+ if ctx.base.underlyingRecursions < Config .LogPendingUnderlyingThreshold then
2710
2709
op
2711
- else if ( ctx.pendingUnderlying contains this )
2710
+ else if ctx.pendingUnderlying. contains( this ) then
2712
2711
throw CyclicReference (symbol)
2713
2712
else
2714
2713
try {
@@ -3465,8 +3464,8 @@ object Types extends TypeUtils {
3465
3464
val bcs1set = BaseClassSet (bcs1)
3466
3465
def recur (bcs2 : List [ClassSymbol ]): List [ClassSymbol ] = bcs2 match {
3467
3466
case bc2 :: bcs2rest =>
3468
- if ( bcs1set contains bc2)
3469
- if ( bc2.is(Trait )) recur(bcs2rest)
3467
+ if bcs1set. contains( bc2) then
3468
+ if bc2.is(Trait ) then recur(bcs2rest)
3470
3469
else bcs1 // common class, therefore rest is the same in both sequences
3471
3470
else bc2 :: recur(bcs2rest)
3472
3471
case nil => bcs1
@@ -3562,9 +3561,8 @@ object Types extends TypeUtils {
3562
3561
val bcs1set = BaseClassSet (bcs1)
3563
3562
def recur (bcs2 : List [ClassSymbol ]): List [ClassSymbol ] = bcs2 match {
3564
3563
case bc2 :: bcs2rest =>
3565
- if (bcs1set contains bc2)
3566
- if (bc2.is(Trait )) bc2 :: recur(bcs2rest)
3567
- else bcs2
3564
+ if bcs1set.contains(bc2) then
3565
+ if bc2.is(Trait ) then bc2 :: recur(bcs2rest) else bcs2
3568
3566
else recur(bcs2rest)
3569
3567
case nil =>
3570
3568
bcs2
@@ -5757,11 +5755,11 @@ object Types extends TypeUtils {
5757
5755
parent.hashIsStable
5758
5756
5759
5757
override def eql (that : Type ): Boolean = that match
5760
- case that : AnnotatedType => (parent eq that.parent) && ( annot eql that.annot)
5758
+ case that : AnnotatedType => (parent eq that.parent) && annot. eql( that.annot)
5761
5759
case _ => false
5762
5760
5763
5761
override def iso (that : Any , bs : BinderPairs ): Boolean = that match
5764
- case that : AnnotatedType => parent.equals(that.parent, bs) && ( annot eql that.annot)
5762
+ case that : AnnotatedType => parent.equals(that.parent, bs) && annot. eql( that.annot)
5765
5763
case _ => false
5766
5764
}
5767
5765
@@ -6354,7 +6352,7 @@ object Types extends TypeUtils {
6354
6352
tp.derivedClassInfo(prefix1, parents1, tp.decls, selfInfo1)
6355
6353
end DeepTypeMap
6356
6354
6357
- @ sharable object IdentityTypeMap extends TypeMap ()(NoContext ) {
6355
+ @ sharable object IdentityTypeMap extends TypeMap ()(using NoContext ) {
6358
6356
def apply (tp : Type ): Type = tp
6359
6357
}
6360
6358
@@ -6827,7 +6825,7 @@ object Types extends TypeUtils {
6827
6825
def maybeAdd (xs : List [NamedType ], tp : NamedType ): List [NamedType ] = if p(tp) then tp :: xs else xs
6828
6826
val seen = util.HashSet [Type ]()
6829
6827
def apply (xs : List [NamedType ], tp : Type ): List [NamedType ] =
6830
- if seen contains tp then xs
6828
+ if seen. contains(tp) then xs
6831
6829
else
6832
6830
seen += tp
6833
6831
tp match
@@ -7006,7 +7004,7 @@ object Types extends TypeUtils {
7006
7004
7007
7005
object fieldFilter extends NameFilter {
7008
7006
def apply (pre : Type , name : Name )(using Context ): Boolean =
7009
- name.isTermName && ( pre member name).hasAltWith(! _.symbol.is(Method ))
7007
+ name.isTermName && pre. member( name).hasAltWith(! _.symbol.is(Method ))
7010
7008
def isStable = true
7011
7009
}
7012
7010
0 commit comments