@@ -141,18 +141,21 @@ class TyperState() {
141141 Stats .record(" typerState.commit" )
142142 assert(isCommittable, s " $this is not committable " )
143143 assert(! isCommitted, s " $this is already committed " )
144- reporter.flush()
145- setCommittable(false )
146144 val targetState = ctx.typerState
147145
148- // Committing into an already committed TyperState usually doesn't make
149- // sense since it means the constraints we're committing won't be propagated
150- // further, but it can happen if the targetState gets captured in a reported
151- // Message, because forcing that Message might involve creating and
152- // committing new TyperStates into the captured one after its been committed.
153- assert(! targetState.isCommitted || targetState.reporter.hasErrors || targetState.reporter.hasWarnings,
146+ val nothingToCommit = (constraint eq targetState.constraint) && ! reporter.hasUnreportedMessages
147+ assert(! targetState.isCommitted || nothingToCommit ||
148+ // Committing into an already committed TyperState usually doesn't make
149+ // sense since it means the constraints and messages we're committing won't be propagated
150+ // further, but it can happen if the targetState gets captured in a reported
151+ // Message, because forcing that Message might involve creating and
152+ // committing new TyperStates into the captured one after it's been committed.
153+ targetState.reporter.hasErrors || targetState.reporter.hasWarnings,
154154 s " Attempt to commit $this into already committed $targetState" )
155155
156+ reporter.flush()
157+ setCommittable(false )
158+
156159 if constraint ne targetState.constraint then
157160 Stats .record(" typerState.commit.new constraint" )
158161 constr.println(i " committing $this to $targetState, fromConstr = $constraint, toConstr = ${targetState.constraint}" )
0 commit comments