aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/typer/Applications.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-04-04 13:59:36 +0200
committerMartin Odersky <odersky@gmail.com>2017-04-04 13:59:36 +0200
commit4c576bf840e69a227250a6c89e218a6c0f2a05d4 (patch)
tree1a1de60c5d638602169cb829aa90e16065553f7e /compiler/src/dotty/tools/dotc/typer/Applications.scala
parent62b4eb87aa72c3b4e40a9c847ec61dabe467dabd (diff)
downloaddotty-4c576bf840e69a227250a6c89e218a6c0f2a05d4.tar.gz
dotty-4c576bf840e69a227250a6c89e218a6c0f2a05d4.tar.bz2
dotty-4c576bf840e69a227250a6c89e218a6c0f2a05d4.zip
Avoid assertion failure on neg test
This commit can hopefully be reverted once #2121 is in.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/typer/Applications.scala')
-rw-r--r--compiler/src/dotty/tools/dotc/typer/Applications.scala9
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/src/dotty/tools/dotc/typer/Applications.scala b/compiler/src/dotty/tools/dotc/typer/Applications.scala
index 5dcf16b62..310121f31 100644
--- a/compiler/src/dotty/tools/dotc/typer/Applications.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Applications.scala
@@ -217,7 +217,14 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
// apply the result type constraint, unless method type is dependent
val resultApprox = resultTypeApprox(methType)
val savedConstraint = ctx.typerState.constraint
- if (!constrainResult(resultApprox, resultType))
+ if (!resultApprox.isInstanceOf[PolyType] &&
+ // temporary fix before #2121 is in. The problem here is that errors in the code
+ // can lead to the result type begin higher-kinded. Then normalize gets confused
+ // and we end up with an assertion violation "s"inconsistent: no typevars were
+ // added to committable constraint". Once we distinguish between type lambdas
+ // and polytypes again this should hopefully become unnecessary. The error
+ // was triggered by neg/enums.scala.
+ !constrainResult(resultApprox, resultType))
if (ctx.typerState.isCommittable)
// defer the problem until after the application;
// it might be healed by an implicit conversion