Skip to content

Commit 808efd9

Browse files
committed
Drop FunProtoState#evalState
With the new context merging technique it's no longer needed. We now propagate any updates to the context from a FuncProto.typedArg immediately into the caller context. So no need to check later whether the update is present.
1 parent ee92673 commit 808efd9

File tree

1 file changed

+3
-28
lines changed

1 file changed

+3
-28
lines changed

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

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,6 @@ object ProtoTypes {
232232
/** A map in which typed arguments can be stored to be later integrated in `typedArgs`. */
233233
var typedArg: SimpleIdentityMap[untpd.Tree, Tree] = SimpleIdentityMap.Empty
234234

235-
/** A map recording the typer states and constraints in which arguments stored in myTypedArg were typed */
236-
var evalState: SimpleIdentityMap[untpd.Tree, (TyperState, Constraint)] = SimpleIdentityMap.Empty
237-
238235
/** The tupled version of this prototype, if it has been computed */
239236
var tupled: Type = NoType
240237

@@ -265,25 +262,10 @@ object ProtoTypes {
265262

266263
override def notApplied: Type = WildcardType
267264

268-
/** Forget the types of any arguments that have been typed producing a constraint
269-
* - that is in a typer state that is not yet committed into the one of the current context `ctx`,
270-
* - or that has been retracted from its typestate because oif a failed operation.
271-
* This is necessary to avoid "orphan" TypeParamRefs that are referred to from
272-
* type variables in the typed arguments, but that are not registered in the
273-
* current constraint. Test cases are pos/t1756.scala and pos/i3538.scala.
274-
* @return True if all arguments have types (in particular, no types were forgotten).
265+
/** @return True if all arguments have types.
275266
*/
276-
def allArgTypesAreCurrent()(implicit ctx: Context): Boolean = {
277-
state.evalState foreachBinding { (arg, tstateConstr) =>
278-
if ((tstateConstr._1.uncommittedAncestor.constraint `ne` ctx.typerState.constraint) ||
279-
tstateConstr._2.isRetracted) {
280-
typr.println(i"need to invalidate $arg / ${state.typedArg(arg)}, ${tstateConstr._2}, current = ${ctx.typerState.constraint}")
281-
state.typedArg = state.typedArg.remove(arg)
282-
state.evalState = state.evalState.remove(arg)
283-
}
284-
}
267+
def allArgTypesAreCurrent()(implicit ctx: Context): Boolean =
285268
state.typedArg.size == args.length
286-
}
287269

288270
private def isUndefined(tp: Type): Boolean = tp match {
289271
case _: WildcardType => true
@@ -307,15 +289,8 @@ object ProtoTypes {
307289
targ = arg.withType(WildcardType)
308290
case _ =>
309291
targ = typerFn(arg)
310-
if (!ctx.reporter.hasUnreportedErrors) {
311-
// FIXME: This can swallow warnings by updating the typerstate from a nested
312-
// context that gets discarded later. But we do have to update the
313-
// typerstate if there are no errors. If we also omitted the next two lines
314-
// when warning were emitted, `pos/t1756.scala` would fail when run with -feature.
315-
// It would produce an orphan type parameter for CI when pickling.
292+
if (!ctx.reporter.hasUnreportedErrors)
316293
state.typedArg = state.typedArg.updated(arg, targ)
317-
state.evalState = state.evalState.updated(arg, (ctx.typerState, ctx.typerState.constraint))
318-
}
319294
}
320295
}
321296
targ

0 commit comments

Comments
 (0)