Skip to content

Commit 87463bd

Browse files
committed
Remove double lookup
1 parent 29ecd88 commit 87463bd

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

compiler/src/dotty/tools/dotc/typer/Applications.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,11 +1387,11 @@ trait Applications extends Compatibility {
13871387
// TODO: Maybe the 'reorder' method above can be reused, or be template
13881388
if (bunchedArgs != Nil && argTypes != Nil) {
13891389

1390-
val typeInfoOfGetMethod =
1391-
if unapplyFn.tpe.widen.asInstanceOf[MethodType].resType.member(nme.get).exists then
1392-
unapplyFn.tpe.widen.asInstanceOf[MethodType].resType.member(nme.get).info
1393-
else
1394-
unapplyFn.tpe.widen.asInstanceOf[MethodType].resType
1390+
val resTypeOfUnapplyFn = unapplyFn.tpe.widen.asInstanceOf[MethodType].resType
1391+
1392+
val typeInfoOfGetMethod: Type =
1393+
resTypeOfUnapplyFn.member(nme.get).info
1394+
.orElse(resTypeOfUnapplyFn)
13951395

13961396
val names = typeInfoOfGetMethod
13971397
.memberDenots(typeNameFilter, (name, buf) => if (name.toString == "Names") buf += typeInfoOfGetMethod.member(name).asSingleDenotation)
@@ -2261,7 +2261,7 @@ trait Applications extends Compatibility {
22612261
* This reset is needed because otherwise the original results might
22622262
* have added constraints to type parameters which are no longer
22632263
* implied after harmonization. No essential constraints are lost by this because
2264-
* the result of harmomization will be compared again with the expected type.
2264+
* the result of harmonization will be compared again with the expected type.
22652265
* Test cases where this matters are in pos/harmomize.scala.
22662266
*/
22672267
def harmonic[T](harmonize: List[T] => List[T], pt: Type)(op: => List[T])(using Context): List[T] =
@@ -2320,7 +2320,7 @@ trait Applications extends Compatibility {
23202320
* with the type parameters of the extension (T1, T2) inferred.
23212321
* None is returned if the implicit search fails for any of the leading implicit parameters
23222322
* or if the receiver has a wrong type (note that in general the type of the receiver
2323-
* might depend on the exact types of the found instances of the proceding implicits).
2323+
* might depend on the exact types of the found instances of the proceeding implicits).
23242324
* No implicit search is tried for implicits following the receiver or for parameters of the def (D, E).
23252325
*/
23262326
def tryApplyingExtensionMethod(methodRef: TermRef, receiver: Tree)(using Context): Option[Tree] =

0 commit comments

Comments
 (0)