@@ -4288,23 +4288,22 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
42884288 val allDenots = ref.denot.alternatives
42894289 if pt.isExtensionApplyProto then allDenots.filter(_.symbol.is(ExtensionMethod ))
42904290 else allDenots
4291+ def altRef (alt : SingleDenotation ) = TermRef (ref.prefix, ref.name, alt)
4292+ val alts = altDenots.map(altRef)
42914293
42924294 typr.println(i " adapt overloaded $ref with alternatives ${altDenots map (_.info)}% \n\n % " )
42934295
42944296 /** Search for an alternative that does not take parameters.
42954297 * If there is one, return it, otherwise return the error tree.
42964298 */
4297- def tryParameterless (alts : List [ TermRef ])( error : => tpd.Tree ): Tree =
4299+ def tryParameterless (error : => tpd.Tree ): Tree =
42984300 alts.filter(_.info.isParameterless) match
42994301 case alt :: Nil => readaptSimplified(tree.withType(alt))
43004302 case _ =>
43014303 altDenots.find(_.info.paramInfoss == ListOfNil ) match
4302- case Some (alt) => readaptSimplified(tree.withType(alt.symbol.denot.termRef ))
4304+ case Some (alt) => readaptSimplified(tree.withType(altRef( alt) ))
43034305 case _ => error
43044306
4305- def altRef (alt : SingleDenotation ) = TermRef (ref.prefix, ref.name, alt)
4306- val alts = altDenots.map(altRef)
4307-
43084307 resolveOverloaded(alts, pt) match
43094308 case alt :: Nil =>
43104309 readaptSimplified(tree.withType(alt))
@@ -4320,7 +4319,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
43204319 // insert apply or convert qualifier, but only for a regular application
43214320 tryInsertApplyOrImplicit(tree, pt, locked)(errorNoMatch)
43224321 case _ =>
4323- tryParameterless(alts)( errorNoMatch)
4322+ tryParameterless(errorNoMatch)
43244323 case ambiAlts =>
43254324 // If there are ambiguous alternatives, and:
43264325 // 1. the types aren't erroneous
@@ -4346,7 +4345,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
43464345 case _ : FunProto =>
43474346 errorAmbiguous
43484347 case _ =>
4349- tryParameterless(alts)( errorAmbiguous)
4348+ tryParameterless(errorAmbiguous)
43504349 end adaptOverloaded
43514350
43524351 def adaptToArgs (wtp : Type , pt : FunProto ): Tree = wtp match {
0 commit comments