Skip to content

Commit 4cea282

Browse files
committed
Discard poly-functions when trying to resolve overloading
Discard poly-functions when trying to resolve overloading using subsequent parameter lists. Polyfunctions don't have a symbol, so the logic of remapping arguments does not work for them.
1 parent 4c2305d commit 4cea282

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2267,13 +2267,13 @@ trait Applications extends Compatibility {
22672267
case _ => (Nil, 0)
22682268

22692269
/** Resolve overloading by mapping to a different problem where each alternative's
2270-
* type is mapped with `f`, alternatives with non-existing types are dropped, and the
2270+
* type is mapped with `f`, alternatives with non-existing types or symbols are dropped, and the
22712271
* expected type is `pt`. Map the results back to the original alternatives.
22722272
*/
22732273
def resolveMapped(alts: List[TermRef], f: TermRef => Type, pt: Type)(using Context): List[TermRef] =
22742274
val reverseMapping = alts.flatMap { alt =>
22752275
val t = f(alt)
2276-
if t.exists then
2276+
if t.exists && alt.symbol.exists then
22772277
val (trimmed, skipped) = trimParamss(t.stripPoly, alt.symbol.rawParamss)
22782278
val mappedSym = alt.symbol.asTerm.copy(info = t)
22792279
mappedSym.rawParamss = trimmed

tests/pos/i20176.scala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
type Accumulator[A]
2+
3+
object Accumulator {
4+
5+
val usage =
6+
use[Int]:
7+
"asd"
8+
9+
inline def use[A](using DummyImplicit): [B] => Any => Any = ???
10+
11+
inline def use[A]: [B] => Any => Any = ???
12+
}

0 commit comments

Comments
 (0)