diff options
author | Martin Odersky <odersky@gmail.com> | 2013-11-14 17:35:51 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-11-14 17:36:41 +0100 |
commit | fe865cd382bb21026b79070eafa597b865fe461c (patch) | |
tree | 1395dfea81a5e29d7dd99c1809732b428284053a | |
parent | 9c85d93caca274943b2caf028e850261ade257d6 (diff) | |
download | dotty-fe865cd382bb21026b79070eafa597b865fe461c.tar.gz dotty-fe865cd382bb21026b79070eafa597b865fe461c.tar.bz2 dotty-fe865cd382bb21026b79070eafa597b865fe461c.zip |
replace qualifierType by widenIfUnstable.
Also, throw an exception on internal errors rather than issuing an error (this helps debugging, should be reverted for production).
-rw-r--r-- | src/dotty/tools/dotc/typer/Applications.scala | 2 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/Inferencing.scala | 3 | ||||
-rw-r--r-- | src/dotty/tools/dotc/typer/Typer.scala | 6 |
3 files changed, 7 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala index f4936cff0..7dc6eb799 100644 --- a/src/dotty/tools/dotc/typer/Applications.scala +++ b/src/dotty/tools/dotc/typer/Applications.scala @@ -483,7 +483,7 @@ trait Applications extends Compatibility { self: Typer => } } case _ => - fun1.qualifierType match { + fun1.tpe match { case ErrorType => tree.withType(ErrorType) } diff --git a/src/dotty/tools/dotc/typer/Inferencing.scala b/src/dotty/tools/dotc/typer/Inferencing.scala index 42b3564ce..50aa6c8d0 100644 --- a/src/dotty/tools/dotc/typer/Inferencing.scala +++ b/src/dotty/tools/dotc/typer/Inferencing.scala @@ -90,6 +90,8 @@ object Inferencing { } typer.interpolateAndAdapt(targ, formal) } + + override def toString = s"FunProto(${args mkString ","} => $resultType)" } case class ViewProto(argType: Type, override val resultType: Type)(implicit ctx: Context) extends CachedGroundType with ProtoType { @@ -223,6 +225,7 @@ object Inferencing { println(s"interpolate undet vars in ${tp.show}, pos = ${tree.pos}, mode = ${ctx.mode}, undets = ${ctx.typerState.undetVars map (tvar => s"${tvar.show}@${tvar.owningTree.pos}")}") println(s"qualifying undet vars: ${ctx.typerState.undetVars filter qualifies map (_.show)}") println(s"fulltype: $tp") // !!! DEBUG + println(s"constraint: ${ctx.typerState.constraint.show}") def qualifies(tvar: TypeVar) = tree contains tvar.owningTree val vs = tp.variances(tvar => diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index 08bf6badf..c7b79bad3 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -89,7 +89,7 @@ class Typer extends Namer with Applications with Implicits { } def checkedSelectionType(qual1: Tree, tree: untpd.RefTree)(implicit ctx: Context): Type = { - val ownType = selectionType(qual1.qualifierType, tree.name, tree.pos) + val ownType = selectionType(qual1.tpe.widenIfUnstable, tree.name, tree.pos) if (!ownType.isError) checkAccessible(ownType, qual1.isInstanceOf[Super], tree.pos) ownType } @@ -516,7 +516,7 @@ class Typer extends Namer with Applications with Implicits { val ownType = meth1.tpe.widen match { case mt: MethodType => if (!mt.isDependent) mt.toFunctionType - else errorType(i"internal error: cannot turn dependent method type $mt into closure", tree.pos) + else throw new Error(s"internal error: cannot turn dependent method type $mt into closure, position = ${tree.pos}") // !!! DEBUG. Eventually, convert to an error? case tp => errorType(i"internal error: closing over non-method $tp", tree.pos) } @@ -638,7 +638,7 @@ class Typer extends Namer with Applications with Implicits { def typedSingletonTypeTree(tree: untpd.SingletonTypeTree)(implicit ctx: Context): SingletonTypeTree = track("typedSingletonTypeTree") { val ref1 = typedExpr(tree.ref) - checkStable(ref1.qualifierType, tree.pos) + checkStable(ref1.tpe.widenIfUnstable, tree.pos) cpy.SingletonTypeTree(tree, ref1) withType ref1.tpe } |