@@ -863,10 +863,7 @@ trait Applications extends Compatibility { self: Typer =>
863
863
* with `tp2`.
864
864
*/
865
865
def isAsSpecific (alt1 : TermRef , tp1 : Type , alt2 : TermRef , tp2 : Type ): Boolean = ctx.traceIndented(i " isAsSpecific $tp1 $tp2" , overload) { tp1 match {
866
- case tp1 : PolyType =>
867
- val tparams = ctx.newTypeParams(alt1.symbol, tp1.paramNames, EmptyFlags , tp1.instantiateBounds)
868
- isAsSpecific(alt1, tp1.instantiate(tparams map (_.typeRef)), alt2, tp2)
869
- case tp1 : MethodType =>
866
+ case tp1 : MethodType => // (1)
870
867
def repeatedToSingle (tp : Type ): Type = tp match {
871
868
case tp @ ExprType (tp1) => tp.derivedExprType(repeatedToSingle(tp1))
872
869
case _ => if (tp.isRepeatedParam) tp.argTypesHi.head else tp
@@ -876,18 +873,21 @@ trait Applications extends Compatibility { self: Typer =>
876
873
else tp1.paramTypes
877
874
isApplicable(alt2, formals1, WildcardType ) ||
878
875
tp1.paramTypes.isEmpty && tp2.isInstanceOf [MethodOrPoly ]
879
- case _ =>
876
+ case tp1 : PolyType => // (2)
877
+ val tparams = ctx.newTypeParams(alt1.symbol, tp1.paramNames, EmptyFlags , tp1.instantiateBounds)
878
+ isAsSpecific(alt1, tp1.instantiate(tparams map (_.typeRef)), alt2, tp2)
879
+ case _ => // (3)
880
880
tp2 match {
881
- case tp2 : MethodType => true
882
- case tp2 : PolyType if tp2.isPolymorphicMethodType => true
883
- case tp2 : PolyType =>
881
+ case tp2 : MethodType => true // (3a)
882
+ case tp2 : PolyType if tp2.isPolymorphicMethodType => true // (3a)
883
+ case tp2 : PolyType => // (3b)
884
884
val nestedCtx = ctx.fresh.setExploreTyperState
885
885
886
886
{
887
887
implicit val ctx : Context = nestedCtx
888
888
isCompatible(tp1, constrained(tp2).resultType)
889
889
}
890
- case _ =>
890
+ case _ => // (3b)
891
891
isCompatible(tp1, tp2)
892
892
}
893
893
}}
0 commit comments