aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Applications.scala
diff options
context:
space:
mode:
authorGuillaume Martres <smarter@ubuntu.com>2015-11-18 03:30:34 +0100
committerGuillaume Martres <smarter@ubuntu.com>2015-11-18 03:32:01 +0100
commitc2079f2f38d81577dd9710c9d0b044c599b18ec7 (patch)
tree9f4b4d1d65e3f596754a1b2e292581f2626a1d46 /src/dotty/tools/dotc/typer/Applications.scala
parent7d76151109db168d025dfc0f6501fa7694e17053 (diff)
downloaddotty-c2079f2f38d81577dd9710c9d0b044c599b18ec7.tar.gz
dotty-c2079f2f38d81577dd9710c9d0b044c599b18ec7.tar.bz2
dotty-c2079f2f38d81577dd9710c9d0b044c599b18ec7.zip
Annotate `isAsSpecific` with references to its documentation
Also reorder the cases to be in the same order as the documentation.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Applications.scala')
-rw-r--r--src/dotty/tools/dotc/typer/Applications.scala18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala
index c57dd7aab..4ca9c39af 100644
--- a/src/dotty/tools/dotc/typer/Applications.scala
+++ b/src/dotty/tools/dotc/typer/Applications.scala
@@ -863,10 +863,7 @@ trait Applications extends Compatibility { self: Typer =>
* with `tp2`.
*/
def isAsSpecific(alt1: TermRef, tp1: Type, alt2: TermRef, tp2: Type): Boolean = ctx.traceIndented(i"isAsSpecific $tp1 $tp2", overload) { tp1 match {
- case tp1: PolyType =>
- val tparams = ctx.newTypeParams(alt1.symbol, tp1.paramNames, EmptyFlags, tp1.instantiateBounds)
- isAsSpecific(alt1, tp1.instantiate(tparams map (_.typeRef)), alt2, tp2)
- case tp1: MethodType =>
+ case tp1: MethodType => // (1)
def repeatedToSingle(tp: Type): Type = tp match {
case tp @ ExprType(tp1) => tp.derivedExprType(repeatedToSingle(tp1))
case _ => if (tp.isRepeatedParam) tp.argTypesHi.head else tp
@@ -876,18 +873,21 @@ trait Applications extends Compatibility { self: Typer =>
else tp1.paramTypes
isApplicable(alt2, formals1, WildcardType) ||
tp1.paramTypes.isEmpty && tp2.isInstanceOf[MethodOrPoly]
- case _ =>
+ case tp1: PolyType => // (2)
+ val tparams = ctx.newTypeParams(alt1.symbol, tp1.paramNames, EmptyFlags, tp1.instantiateBounds)
+ isAsSpecific(alt1, tp1.instantiate(tparams map (_.typeRef)), alt2, tp2)
+ case _ => // (3)
tp2 match {
- case tp2: MethodType => true
- case tp2: PolyType if tp2.isPolymorphicMethodType => true
- case tp2: PolyType =>
+ case tp2: MethodType => true // (3a)
+ case tp2: PolyType if tp2.isPolymorphicMethodType => true // (3a)
+ case tp2: PolyType => // (3b)
val nestedCtx = ctx.fresh.setExploreTyperState
{
implicit val ctx: Context = nestedCtx
isCompatible(tp1, constrained(tp2).resultType)
}
- case _ =>
+ case _ => // (3b)
isCompatible(tp1, tp2)
}
}}