Skip to content

Commit 4385a5f

Browse files
Revert "Make overload pruning based on result types less aggressive (#21744)" in 3.7.1-RC2 (#23239)
Reverts #21744 in 3.7.1-RC2, follows same revert done to 3.7.0 #22940
2 parents 2aee56d + 1091e8a commit 4385a5f

File tree

4 files changed

+2
-47
lines changed

4 files changed

+2
-47
lines changed

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

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2140,27 +2140,16 @@ trait Applications extends Compatibility {
21402140
def resolveOverloaded(alts: List[TermRef], pt: Type)(using Context): List[TermRef] =
21412141
record("resolveOverloaded")
21422142

2143-
/** Is `alt` a method or polytype whose approximated result type after the first value parameter
2143+
/** Is `alt` a method or polytype whose result type after the first value parameter
21442144
* section conforms to the expected type `resultType`? If `resultType`
21452145
* is a `IgnoredProto`, pick the underlying type instead.
2146-
*
2147-
* Using an approximated result type is necessary to avoid false negatives
2148-
* due to incomplete type inference such as in tests/pos/i21410.scala and tests/pos/i21410b.scala.
21492146
*/
21502147
def resultConforms(altSym: Symbol, altType: Type, resultType: Type)(using Context): Boolean =
21512148
resultType.revealIgnored match {
21522149
case resultType: ValueType =>
21532150
altType.widen match {
21542151
case tp: PolyType => resultConforms(altSym, instantiateWithTypeVars(tp), resultType)
2155-
case tp: MethodType =>
2156-
val wildRes = wildApprox(tp.resultType)
2157-
2158-
class ResultApprox extends AvoidWildcardsMap:
2159-
// Avoid false negatives by approximating to a lower bound
2160-
variance = -1
2161-
2162-
val approx = ResultApprox()(wildRes)
2163-
constrainResult(altSym, approx, resultType)
2152+
case tp: MethodType => constrainResult(altSym, tp.resultType, resultType)
21642153
case _ => true
21652154
}
21662155
case _ => true
@@ -2532,7 +2521,6 @@ trait Applications extends Compatibility {
25322521
if t.exists && alt.symbol.exists then
25332522
val (trimmed, skipped) = trimParamss(t.stripPoly, alt.symbol.rawParamss)
25342523
val mappedSym = alt.symbol.asTerm.copy(info = t)
2535-
mappedSym.annotations = alt.symbol.annotations
25362524
mappedSym.rawParamss = trimmed
25372525
val (pre, totalSkipped) = mappedAltInfo(alt.symbol) match
25382526
case Some((pre, prevSkipped)) =>

tests/pos/i21410.scala

Lines changed: 0 additions & 12 deletions
This file was deleted.

tests/pos/i21410b.scala

Lines changed: 0 additions & 10 deletions
This file was deleted.

tests/pos/i21410c.scala

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)