diff options
author | Martin Odersky <odersky@gmail.com> | 2014-10-07 12:26:54 +0200 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2014-10-12 10:50:42 +0200 |
commit | 6efccf91e7856a4c8fde7daf914e77fef4fb6e52 (patch) | |
tree | 4ed8aeb72939e94fecbd880c83f991f288797957 | |
parent | c72d404dd12309219d312a5730bed82175840db5 (diff) | |
download | dotty-6efccf91e7856a4c8fde7daf914e77fef4fb6e52.tar.gz dotty-6efccf91e7856a4c8fde7daf914e77fef4fb6e52.tar.bz2 dotty-6efccf91e7856a4c8fde7daf914e77fef4fb6e52.zip |
Don't adapt to FunProto in TreeChecker.
Similar to Erasure, we do not check conformance wrt <:< to a FunProto.
Nothing is lost, because we typecheck the arguments and result anyway.
And this led to failing tests after GettersSetters was added.
-rw-r--r-- | src/dotty/tools/dotc/transform/TreeChecker.scala | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/transform/TreeChecker.scala b/src/dotty/tools/dotc/transform/TreeChecker.scala index 67b291bb2..4600ec823 100644 --- a/src/dotty/tools/dotc/transform/TreeChecker.scala +++ b/src/dotty/tools/dotc/transform/TreeChecker.scala @@ -20,6 +20,7 @@ import reporting.ThrowingReporter import ast.Trees._ import ast.{tpd, untpd} import util.SourcePosition +import ProtoTypes._ import java.lang.AssertionError /** Run by -Ycheck option after a given phase, this class retypes all syntax trees @@ -136,7 +137,7 @@ class TreeChecker { override def adapt(tree: Tree, pt: Type, original: untpd.Tree = untpd.EmptyTree)(implicit ctx: Context) = { def isPrimaryConstructorReturn = ctx.owner.isPrimaryConstructor && pt.isRef(ctx.owner.owner) && tree.tpe.isRef(defn.UnitClass) - if (ctx.mode.isExpr && !isPrimaryConstructorReturn) + if (ctx.mode.isExpr && !isPrimaryConstructorReturn && !pt.isInstanceOf[FunProto]) assert(tree.tpe <:< pt, s"error at ${sourcePos(tree.pos)}\n" + err.typeMismatchStr(tree.tpe, pt)) |