@@ -141,18 +141,21 @@ class TyperState() {
141
141
Stats .record(" typerState.commit" )
142
142
assert(isCommittable, s " $this is not committable " )
143
143
assert(! isCommitted, s " $this is already committed " )
144
- reporter.flush()
145
- setCommittable(false )
146
144
val targetState = ctx.typerState
147
145
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,
154
154
s " Attempt to commit $this into already committed $targetState" )
155
155
156
+ reporter.flush()
157
+ setCommittable(false )
158
+
156
159
if constraint ne targetState.constraint then
157
160
Stats .record(" typerState.commit.new constraint" )
158
161
constr.println(i " committing $this to $targetState, fromConstr = $constraint, toConstr = ${targetState.constraint}" )
0 commit comments