lean4-htt/tests/elab/4595_slowdown.lean.out.expected
Joachim Breitner 916004bd3c
fix: add checkSystem calls to hasAssignableMVar (#13219)
This PR moves `hasAssignableMVar`, `hasAssignableLevelMVar`, and
`isLevelMVarAssignable` from `MetavarContext.lean` to a new
`Lean.Meta.HasAssignableMVar` module, changing them from generic `[Monad
m] [MonadMCtx m]` functions to `MetaM` functions. This enables adding
`checkSystem` calls in the recursive traversal, which ensures
cancellation and heartbeat checks happen during what can be a very
expensive computation.

All callers of these functions were already in `MetaM`, so this change
is safe. The motivating case is the `4595_slowdown.lean` test, where
`hasAssignableMVar` (with `PersistentHashMap.find?` lookups on
`mctx.lDepth`) was the dominant CPU cost during elaboration of category
theory definitions. Without `checkSystem` calls, cancellation requests
could be delayed by over 2 seconds.

The test file `4595_slowdown.lean` gets a slightly increased
`maxHeartbeats` limit because `checkSystem` now detects heartbeat
exhaustion mid-traversal rather than after the function returns.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-31 19:27:15 +00:00

12 lines
804 B
Text

4595_slowdown.lean:106:14-106:25: warning: declaration uses `sorry`
4595_slowdown.lean:138:9-138:17: warning: declaration uses `sorry`
4595_slowdown.lean:156:8-156:16: warning: declaration uses `sorry`
4595_slowdown.lean:183:8-183:14: warning: declaration uses `sorry`
4595_slowdown.lean:185:8-185:14: warning: declaration uses `sorry`
4595_slowdown.lean:188:0-188:8: warning: declaration uses `sorry`
4595_slowdown.lean:196:8-196:19: warning: declaration uses `sorry`
4595_slowdown.lean:199:8-199:15: warning: declaration uses `sorry`
4595_slowdown.lean:209:4-209:13: warning: declaration uses `sorry`
4595_slowdown.lean:231:8-231:14: warning: declaration uses `sorry`
4595_slowdown.lean:233:8-233:16: warning: declaration uses `sorry`
4595_slowdown.lean:235:4-235:11: warning: declaration uses `sorry`