@@ -4352,23 +4352,22 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
43524352 val allDenots = ref.denot.alternatives
43534353 if pt.isExtensionApplyProto then allDenots.filter(_.symbol.is(ExtensionMethod ))
43544354 else allDenots
4355+ def altRef (alt : SingleDenotation ) = TermRef (ref.prefix, ref.name, alt)
4356+ val alts = altDenots.map(altRef)
43554357
43564358 typr.println(i " adapt overloaded $ref with alternatives ${altDenots map (_.info)}% \n\n % " )
43574359
43584360 /** Search for an alternative that does not take parameters.
43594361 * If there is one, return it, otherwise return the error tree.
43604362 */
4361- def tryParameterless (alts : List [ TermRef ])( error : => tpd.Tree ): Tree =
4363+ def tryParameterless (error : => tpd.Tree ): Tree =
43624364 alts.filter(_.info.isParameterless) match
43634365 case alt :: Nil => readaptSimplified(tree.withType(alt))
43644366 case _ =>
43654367 altDenots.find(_.info.paramInfoss == ListOfNil ) match
4366- case Some (alt) => readaptSimplified(tree.withType(alt.symbol.denot.termRef ))
4368+ case Some (alt) => readaptSimplified(tree.withType(altRef( alt) ))
43674369 case _ => error
43684370
4369- def altRef (alt : SingleDenotation ) = TermRef (ref.prefix, ref.name, alt)
4370- val alts = altDenots.map(altRef)
4371-
43724371 resolveOverloaded(alts, pt) match
43734372 case alt :: Nil =>
43744373 readaptSimplified(tree.withType(alt))
@@ -4384,7 +4383,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
43844383 // insert apply or convert qualifier, but only for a regular application
43854384 tryInsertApplyOrImplicit(tree, pt, locked)(errorNoMatch)
43864385 case _ =>
4387- tryParameterless(alts)( errorNoMatch)
4386+ tryParameterless(errorNoMatch)
43884387 case ambiAlts =>
43894388 // If there are ambiguous alternatives, and:
43904389 // 1. the types aren't erroneous
@@ -4410,7 +4409,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
44104409 case _ : FunProto =>
44114410 errorAmbiguous
44124411 case _ =>
4413- tryParameterless(alts)( errorAmbiguous)
4412+ tryParameterless(errorAmbiguous)
44144413 end adaptOverloaded
44154414
44164415 def adaptToArgs (wtp : Type , pt : FunProto ): Tree = wtp match {
0 commit comments