@@ -4292,23 +4292,22 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
42924292 val allDenots = ref.denot.alternatives
42934293 if pt.isExtensionApplyProto then allDenots.filter(_.symbol.is(ExtensionMethod ))
42944294 else allDenots
4295+ def altRef (alt : SingleDenotation ) = TermRef (ref.prefix, ref.name, alt)
4296+ val alts = altDenots.map(altRef)
42954297
42964298 typr.println(i " adapt overloaded $ref with alternatives ${altDenots map (_.info)}% \n\n % " )
42974299
42984300 /** Search for an alternative that does not take parameters.
42994301 * If there is one, return it, otherwise return the error tree.
43004302 */
4301- def tryParameterless (alts : List [ TermRef ])( error : => tpd.Tree ): Tree =
4303+ def tryParameterless (error : => tpd.Tree ): Tree =
43024304 alts.filter(_.info.isParameterless) match
43034305 case alt :: Nil => readaptSimplified(tree.withType(alt))
43044306 case _ =>
43054307 altDenots.find(_.info.paramInfoss == ListOfNil ) match
4306- case Some (alt) => readaptSimplified(tree.withType(alt.symbol.denot.termRef ))
4308+ case Some (alt) => readaptSimplified(tree.withType(altRef( alt) ))
43074309 case _ => error
43084310
4309- def altRef (alt : SingleDenotation ) = TermRef (ref.prefix, ref.name, alt)
4310- val alts = altDenots.map(altRef)
4311-
43124311 resolveOverloaded(alts, pt) match
43134312 case alt :: Nil =>
43144313 readaptSimplified(tree.withType(alt))
@@ -4324,7 +4323,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
43244323 // insert apply or convert qualifier, but only for a regular application
43254324 tryInsertApplyOrImplicit(tree, pt, locked)(errorNoMatch)
43264325 case _ =>
4327- tryParameterless(alts)( errorNoMatch)
4326+ tryParameterless(errorNoMatch)
43284327 case ambiAlts =>
43294328 // If there are ambiguous alternatives, and:
43304329 // 1. the types aren't erroneous
@@ -4350,7 +4349,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
43504349 case _ : FunProto =>
43514350 errorAmbiguous
43524351 case _ =>
4353- tryParameterless(alts)( errorAmbiguous)
4352+ tryParameterless(errorAmbiguous)
43544353 end adaptOverloaded
43554354
43564355 def adaptToArgs (wtp : Type , pt : FunProto ): Tree = wtp match {
0 commit comments