@@ -1830,16 +1830,13 @@ trait Applications extends Compatibility {
1830
1830
isAsGood(alt1, tp1.instantiate(tparams.map(_.typeRef)), alt2, tp2)
1831
1831
}
1832
1832
case _ => // (3)
1833
- def compareValues (tp1 : Type , tp2 : Type )(using Context ) =
1834
- extension (alt : TermRef ) def isNotGivenClass : Boolean = alt.symbol == defn.NotGivenClass
1835
- isAsGoodValueType(tp1, tp2, alt1.isNotGivenClass, alt2.isNotGivenClass)
1836
1833
tp2 match
1837
1834
case tp2 : MethodType => true // (3a)
1838
1835
case tp2 : PolyType if tp2.resultType.isInstanceOf [MethodType ] => true // (3a)
1839
1836
case tp2 : PolyType => // (3b)
1840
- explore(compareValues (tp1, instantiateWithTypeVars(tp2)))
1837
+ explore(isAsGoodValueType (tp1, instantiateWithTypeVars(tp2)))
1841
1838
case _ => // 3b)
1842
- compareValues (tp1, tp2)
1839
+ isAsGoodValueType (tp1, tp2)
1843
1840
}
1844
1841
1845
1842
/** Test whether value type `tp1` is as good as value type `tp2`.
@@ -1869,15 +1866,14 @@ trait Applications extends Compatibility {
1869
1866
* for overloading resolution (when `preferGeneral is false), and the opposite relation
1870
1867
* `U <: T` or `U convertible to `T` for implicit disambiguation between givens
1871
1868
* (when `preferGeneral` is true). For old-style implicit values, the 3.4 behavior is kept.
1872
- * If one of the alternatives is a NotGivenClass, and the other is not, then the NotGivenClass loses.
1873
1869
*
1874
1870
* - In Scala 3.5 and Scala 3.6-migration, we issue a warning if the result under
1875
1871
* Scala 3.6 differ wrt to the old behavior up to 3.5.
1876
1872
*
1877
1873
* Also and only for given resolution: If a compared type refers to a given or its module class, use
1878
1874
* the intersection of its parent classes instead.
1879
1875
*/
1880
- def isAsGoodValueType (tp1 : Type , tp2 : Type , alt1IsNotGivenClass : Boolean , alt2IsNotGivenClass : Boolean )(using Context ): Boolean =
1876
+ def isAsGoodValueType (tp1 : Type , tp2 : Type )(using Context ): Boolean =
1881
1877
val oldResolution = ctx.mode.is(Mode .OldImplicitResolution )
1882
1878
if ! preferGeneral || Feature .migrateTo3 && oldResolution then
1883
1879
// Normal specificity test for overloading resolution (where `preferGeneral` is false)
@@ -1907,9 +1903,8 @@ trait Applications extends Compatibility {
1907
1903
case _ => mapOver(t)
1908
1904
(flip(tp1p) relaxed_<:< flip(tp2p)) || viewExists(tp1, tp2)
1909
1905
else
1910
- // New rules: better means generalize, except `NotGivenClass` which is given lower priority
1911
- if alt1IsNotGivenClass != alt2IsNotGivenClass then alt2IsNotGivenClass
1912
- else (tp2p relaxed_<:< tp1p) || viewExists(tp2, tp1)
1906
+ // New rules: better means generalize
1907
+ (tp2p relaxed_<:< tp1p) || viewExists(tp2, tp1)
1913
1908
end isAsGoodValueType
1914
1909
1915
1910
/** Widen the result type of synthetic given methods from the implementation class to the
0 commit comments