@@ -392,10 +392,9 @@ object Types extends TypeUtils {
392
392
case _ => false
393
393
394
394
/** Does the type carry an annotation that is an instance of `cls`? */
395
- @ tailrec final def hasAnnotation (cls : ClassSymbol )(using Context ): Boolean = stripTypeVar match {
396
- case AnnotatedType (tp, annot) => ( annot matches cls) || (tp hasAnnotation cls)
395
+ @ tailrec final def hasAnnotation (cls : ClassSymbol )(using Context ): Boolean = stripTypeVar match
396
+ case AnnotatedType (tp, annot) => annot. matches( cls) || tp. hasAnnotation( cls)
397
397
case _ => false
398
- }
399
398
400
399
/** Does this type have a supertype with an annotation satisfying given predicate `p`? */
401
400
def derivesAnnotWith (p : Annotation => Boolean )(using Context ): Boolean = this match {
@@ -556,8 +555,8 @@ object Types extends TypeUtils {
556
555
case AndType (l, r) =>
557
556
val lsym = l.classSymbol
558
557
val rsym = r.classSymbol
559
- if ( lsym isSubClass rsym) lsym
560
- else if ( rsym isSubClass lsym) rsym
558
+ if lsym. isSubClass( rsym) then lsym
559
+ else if rsym. isSubClass( lsym) then rsym
561
560
else NoSymbol
562
561
case tp : OrType =>
563
562
if tp.tp1.hasClassSymbol(defn.NothingClass ) then
@@ -696,7 +695,7 @@ object Types extends TypeUtils {
696
695
case tp : TypeProxy =>
697
696
tp.superType.findDecl(name, excluded)
698
697
case err : ErrorType =>
699
- newErrorSymbol(classSymbol orElse defn.RootClass , name, err.msg)
698
+ newErrorSymbol(classSymbol. orElse( defn.RootClass ) , name, err.msg)
700
699
case _ =>
701
700
NoDenotation
702
701
}
@@ -777,7 +776,7 @@ object Types extends TypeUtils {
777
776
case tp : JavaArrayType =>
778
777
defn.ObjectType .findMember(name, pre, required, excluded)
779
778
case err : ErrorType =>
780
- newErrorSymbol(pre.classSymbol orElse defn.RootClass , name, err.msg)
779
+ newErrorSymbol(pre.classSymbol. orElse( defn.RootClass ) , name, err.msg)
781
780
case _ =>
782
781
NoDenotation
783
782
}
@@ -872,7 +871,7 @@ object Types extends TypeUtils {
872
871
// member in Super instead of Sub.
873
872
// As an example of this in the wild, see
874
873
// loadClassWithPrivateInnerAndSubSelf in ShowClassTests
875
- go(tp.cls.typeRef) orElse d
874
+ go(tp.cls.typeRef). orElse(d)
876
875
877
876
def goParam (tp : TypeParamRef ) = {
878
877
val next = tp.underlying
@@ -1110,7 +1109,7 @@ object Types extends TypeUtils {
1110
1109
false
1111
1110
1112
1111
def relaxed_<:< (that : Type )(using Context ): Boolean =
1113
- (this <:< that) || ( this isValueSubType that)
1112
+ (this <:< that) || this . isValueSubType( that)
1114
1113
1115
1114
/** Is this type a legal type for member `sym1` that overrides another
1116
1115
* member `sym2` of type `that`? This is the same as `<:<`, except that
@@ -1164,10 +1163,10 @@ object Types extends TypeUtils {
1164
1163
* vice versa.
1165
1164
*/
1166
1165
def matchesLoosely (that : Type )(using Context ): Boolean =
1167
- ( this matches that) || {
1166
+ this . matches( that) || {
1168
1167
val thisResult = this .widenExpr
1169
1168
val thatResult = that.widenExpr
1170
- (this eq thisResult) != (that eq thatResult) && ( thisResult matchesLoosely thatResult)
1169
+ (this eq thisResult) != (that eq thatResult) && thisResult. matchesLoosely( thatResult)
1171
1170
}
1172
1171
1173
1172
/** The basetype of this type with given class symbol, NoType if `base` is not a class. */
@@ -1798,7 +1797,7 @@ object Types extends TypeUtils {
1798
1797
* no symbol it tries `member` as an alternative.
1799
1798
*/
1800
1799
def typeParamNamed (name : TypeName )(using Context ): Symbol =
1801
- classSymbol.unforcedDecls.lookup(name) orElse member(name).symbol
1800
+ classSymbol.unforcedDecls.lookup(name). orElse( member(name).symbol)
1802
1801
1803
1802
/** If this is a prototype with some ignored component, reveal one more
1804
1803
* layer of it. Otherwise the type itself.
@@ -1931,9 +1930,9 @@ object Types extends TypeUtils {
1931
1930
def annotatedToRepeated (using Context ): Type = this match {
1932
1931
case tp @ ExprType (tp1) =>
1933
1932
tp.derivedExprType(tp1.annotatedToRepeated)
1934
- case self @ AnnotatedType (tp, annot) if annot matches defn.RetainsByNameAnnot =>
1933
+ case self @ AnnotatedType (tp, annot) if annot. matches( defn.RetainsByNameAnnot ) =>
1935
1934
self.derivedAnnotatedType(tp.annotatedToRepeated, annot)
1936
- case AnnotatedType (tp, annot) if annot matches defn.RepeatedAnnot =>
1935
+ case AnnotatedType (tp, annot) if annot. matches( defn.RepeatedAnnot ) =>
1937
1936
val typeSym = tp.typeSymbol.asClass
1938
1937
assert(typeSym == defn.SeqClass || typeSym == defn.ArrayClass )
1939
1938
tp.translateParameterized(typeSym, defn.RepeatedParamClass )
@@ -2633,9 +2632,9 @@ object Types extends TypeUtils {
2633
2632
*/
2634
2633
final def controlled [T ](op : => T )(using Context ): T = try {
2635
2634
ctx.base.underlyingRecursions += 1
2636
- if ( ctx.base.underlyingRecursions < Config .LogPendingUnderlyingThreshold )
2635
+ if ctx.base.underlyingRecursions < Config .LogPendingUnderlyingThreshold then
2637
2636
op
2638
- else if ( ctx.pendingUnderlying contains this )
2637
+ else if ctx.pendingUnderlying. contains( this ) then
2639
2638
throw CyclicReference (symbol)
2640
2639
else
2641
2640
try {
@@ -3375,8 +3374,8 @@ object Types extends TypeUtils {
3375
3374
val bcs1set = BaseClassSet (bcs1)
3376
3375
def recur (bcs2 : List [ClassSymbol ]): List [ClassSymbol ] = bcs2 match {
3377
3376
case bc2 :: bcs2rest =>
3378
- if ( bcs1set contains bc2)
3379
- if ( bc2.is(Trait )) recur(bcs2rest)
3377
+ if bcs1set. contains( bc2) then
3378
+ if bc2.is(Trait ) then recur(bcs2rest)
3380
3379
else bcs1 // common class, therefore rest is the same in both sequences
3381
3380
else bc2 :: recur(bcs2rest)
3382
3381
case nil => bcs1
@@ -3472,9 +3471,8 @@ object Types extends TypeUtils {
3472
3471
val bcs1set = BaseClassSet (bcs1)
3473
3472
def recur (bcs2 : List [ClassSymbol ]): List [ClassSymbol ] = bcs2 match {
3474
3473
case bc2 :: bcs2rest =>
3475
- if (bcs1set contains bc2)
3476
- if (bc2.is(Trait )) bc2 :: recur(bcs2rest)
3477
- else bcs2
3474
+ if bcs1set.contains(bc2) then
3475
+ if bc2.is(Trait ) then bc2 :: recur(bcs2rest) else bcs2
3478
3476
else recur(bcs2rest)
3479
3477
case nil =>
3480
3478
bcs2
@@ -5415,11 +5413,11 @@ object Types extends TypeUtils {
5415
5413
parent.hashIsStable
5416
5414
5417
5415
override def eql (that : Type ): Boolean = that match
5418
- case that : AnnotatedType => (parent eq that.parent) && ( annot eql that.annot)
5416
+ case that : AnnotatedType => (parent eq that.parent) && annot. eql( that.annot)
5419
5417
case _ => false
5420
5418
5421
5419
override def iso (that : Any , bs : BinderPairs ): Boolean = that match
5422
- case that : AnnotatedType => parent.equals(that.parent, bs) && ( annot eql that.annot)
5420
+ case that : AnnotatedType => parent.equals(that.parent, bs) && annot. eql( that.annot)
5423
5421
case _ => false
5424
5422
}
5425
5423
@@ -5986,7 +5984,7 @@ object Types extends TypeUtils {
5986
5984
}
5987
5985
}
5988
5986
5989
- @ sharable object IdentityTypeMap extends TypeMap ()(NoContext ) {
5987
+ @ sharable object IdentityTypeMap extends TypeMap ()(using NoContext ) {
5990
5988
def apply (tp : Type ): Type = tp
5991
5989
}
5992
5990
@@ -6457,7 +6455,7 @@ object Types extends TypeUtils {
6457
6455
def maybeAdd (xs : List [NamedType ], tp : NamedType ): List [NamedType ] = if p(tp) then tp :: xs else xs
6458
6456
val seen = util.HashSet [Type ]()
6459
6457
def apply (xs : List [NamedType ], tp : Type ): List [NamedType ] =
6460
- if seen contains tp then xs
6458
+ if seen. contains(tp) then xs
6461
6459
else
6462
6460
seen += tp
6463
6461
tp match
@@ -6636,7 +6634,7 @@ object Types extends TypeUtils {
6636
6634
6637
6635
object fieldFilter extends NameFilter {
6638
6636
def apply (pre : Type , name : Name )(using Context ): Boolean =
6639
- name.isTermName && ( pre member name).hasAltWith(! _.symbol.is(Method ))
6637
+ name.isTermName && pre. member( name).hasAltWith(! _.symbol.is(Method ))
6640
6638
def isStable = true
6641
6639
}
6642
6640
0 commit comments