Skip to content

Discard poly-functions when trying to resolve overloading #20181

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/typer/Applications.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2267,13 +2267,13 @@ trait Applications extends Compatibility {
case _ => (Nil, 0)

/** Resolve overloading by mapping to a different problem where each alternative's
* type is mapped with `f`, alternatives with non-existing types are dropped, and the
* type is mapped with `f`, alternatives with non-existing types or symbols are dropped, and the
* expected type is `pt`. Map the results back to the original alternatives.
*/
def resolveMapped(alts: List[TermRef], f: TermRef => Type, pt: Type)(using Context): List[TermRef] =
val reverseMapping = alts.flatMap { alt =>
val t = f(alt)
if t.exists then
if t.exists && alt.symbol.exists then
val (trimmed, skipped) = trimParamss(t.stripPoly, alt.symbol.rawParamss)
val mappedSym = alt.symbol.asTerm.copy(info = t)
mappedSym.rawParamss = trimmed
Expand Down
12 changes: 12 additions & 0 deletions tests/pos/i20176.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
type Accumulator[A]

object Accumulator {

val usage =
use[Int]:
"asd"

inline def use[A](using DummyImplicit): [B] => Any => Any = ???

inline def use[A]: [B] => Any => Any = ???
}
Loading