Skip to content

Commit fa9cfd6

Browse files
committed
report bad typer state error
1 parent fa81fa8 commit fa9cfd6

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

compiler/src/dotty/tools/dotc/core/TyperState.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ class TyperState() {
274274

275275
if oldState != null && oldState.isCommittable then
276276
throw BadTyperStateAssertion(
277-
i"$this attempted to take ownership of $tvar which is already owned by committable $oldState. Location: ${ctx.owner.showLocated}")
277+
i"$this attempted to take ownership of $tvar which is already owned by committable $oldState")
278278
tvar.owningState = new WeakReference(this)
279279
ownedVars += tvar
280280

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4495,7 +4495,8 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
44954495
&& !ctx.mode.is(Mode.TypevarsMissContext)
44964496
&& !containsUninst(false, formal)
44974497
&& !isFullyDefined(formal, ForceDegree.none) then
4498-
constrainResult(tree.symbol, wtp, pt1)
4498+
try NoViewsAllowed.constrainResult(tree.symbol, wtp, pt1)
4499+
catch case ex: TyperState.BadTyperStateAssertion => report.error(s"Bad typer state: ${ex.getMessage}", tree.srcPos.endPos)
44994500
val arg = inferImplicitArg(formal, tree.span.endPos)
45004501

45014502
lazy val defaultArg = findDefaultArgument(argIndex)

0 commit comments

Comments
 (0)