Skip to content

Commit 4c576bf

Browse files
committed
Avoid assertion failure on neg test
This commit can hopefully be reverted once #2121 is in.
1 parent 62b4eb8 commit 4c576bf

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

compiler/src/dotty/tools/dotc/typer/Applications.scala

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,14 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
217217
// apply the result type constraint, unless method type is dependent
218218
val resultApprox = resultTypeApprox(methType)
219219
val savedConstraint = ctx.typerState.constraint
220-
if (!constrainResult(resultApprox, resultType))
220+
if (!resultApprox.isInstanceOf[PolyType] &&
221+
// temporary fix before #2121 is in. The problem here is that errors in the code
222+
// can lead to the result type begin higher-kinded. Then normalize gets confused
223+
// and we end up with an assertion violation "s"inconsistent: no typevars were
224+
// added to committable constraint". Once we distinguish between type lambdas
225+
// and polytypes again this should hopefully become unnecessary. The error
226+
// was triggered by neg/enums.scala.
227+
!constrainResult(resultApprox, resultType))
221228
if (ctx.typerState.isCommittable)
222229
// defer the problem until after the application;
223230
// it might be healed by an implicit conversion

0 commit comments

Comments
 (0)