aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/ProtoTypes.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-02-12 15:26:08 +0100
committerMartin Odersky <odersky@gmail.com>2015-02-12 15:26:08 +0100
commitb5c3a28f1eabada74827e34743dc264e583f7479 (patch)
treeb70890f516f823ffdd7cce74463a7a3d21a7e1aa /src/dotty/tools/dotc/typer/ProtoTypes.scala
parent023c7bcb8a582a64455d23363e13ab84707ffc8b (diff)
downloaddotty-b5c3a28f1eabada74827e34743dc264e583f7479.tar.gz
dotty-b5c3a28f1eabada74827e34743dc264e583f7479.tar.bz2
dotty-b5c3a28f1eabada74827e34743dc264e583f7479.zip
Fix of the escaping MethodParam problem
The issue was in the dependency tracking for MethodTypes. We treated methods with false dependencies as non-dependent (as they should be), but in that case the ResultType could contain orphan MethodParams.
Diffstat (limited to 'src/dotty/tools/dotc/typer/ProtoTypes.scala')
-rw-r--r--src/dotty/tools/dotc/typer/ProtoTypes.scala18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/typer/ProtoTypes.scala b/src/dotty/tools/dotc/typer/ProtoTypes.scala
index 24b4cb423..c0e30b12e 100644
--- a/src/dotty/tools/dotc/typer/ProtoTypes.scala
+++ b/src/dotty/tools/dotc/typer/ProtoTypes.scala
@@ -162,9 +162,11 @@ object ProtoTypes {
*
* [](args): resultType
*/
- case class FunProto(args: List[untpd.Tree], override val resultType: Type, typer: Typer)(implicit ctx: Context)
+ case class FunProto(args: List[untpd.Tree], resType: Type, typer: Typer)(implicit ctx: Context)
extends UncachedGroundType with ApplyingProto {
private var myTypedArgs: List[Tree] = Nil
+
+ override def resultType(implicit ctx: Context) = resType
/** A map in which typed arguments can be stored to be later integrated in `typedArgs`. */
private var myTypedArg: SimpleMap[untpd.Tree, Tree] = SimpleMap.Empty
@@ -241,8 +243,11 @@ object ProtoTypes {
*
* []: argType => resultType
*/
- abstract case class ViewProto(argType: Type, override val resultType: Type)
+ abstract case class ViewProto(argType: Type, resType: Type)
extends CachedGroundType with ApplyingProto {
+
+ override def resultType(implicit ctx: Context) = resType
+
def isMatchedBy(tp: Type)(implicit ctx: Context): Boolean =
ctx.typer.isApplicable(tp, argType :: Nil, resultType)
@@ -274,7 +279,10 @@ object ProtoTypes {
*
* [] [targs] resultType
*/
- case class PolyProto(targs: List[Type], override val resultType: Type) extends UncachedGroundType with ProtoType {
+ case class PolyProto(targs: List[Type], resType: Type) extends UncachedGroundType with ProtoType {
+
+ override def resultType(implicit ctx: Context) = resType
+
override def isMatchedBy(tp: Type)(implicit ctx: Context) = {
def isInstantiatable(tp: Type) = tp.widen match {
case PolyType(paramNames) => paramNames.length == targs.length
@@ -284,8 +292,8 @@ object ProtoTypes {
}
def derivedPolyProto(targs: List[Type], resultType: Type) =
- if ((targs eq this.targs) && (resultType eq this.resultType)) this
- else PolyProto(targs, resultType)
+ if ((targs eq this.targs) && (resType eq this.resType)) this
+ else PolyProto(targs, resType)
def map(tm: TypeMap)(implicit ctx: Context): PolyProto =
derivedPolyProto(targs mapConserve tm, tm(resultType))