-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: add missing initHeartbeats
#1037
base: main
Are you sure you want to change the base?
Conversation
In only one case a `Core.Context` is created from within CoreM, and we inherit from the parent Context the `initHeartbeats`. Otherwise, we get the current heartbeats from IO. Co-authored-by: Laurent Sartran <[email protected]>
Mathlib CI status (docs):
|
LGTM Could you explain, for documentation purposes, why this isn't something Lean core could do? |
Sorry, I missed that message. What are you expecting Lean core to do here? Because we are constructing a Perhaps @kmill should have a look at this and suggest if we can avoid this manual construction in the first place (and confirm whether the PR in its current state is still an improvement over the status quo). |
@@ -108,7 +109,7 @@ def lintCore (decls : Array Name) (linters : Array NamedLinter) : | |||
BaseIO.asTask do | |||
match ← withCurrHeartbeats (linter.test decl) | |||
|>.run' mkMetaContext | |||
|>.run' {options, fileName := "", fileMap := default} {env} | |||
|>.run' {options, fileName := "", fileMap := default, initHeartbeats } {env} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the withCurrHeartbeats
sets initHeartbeats
from IO.getNumHeartbeats
. What effect does initializing initHeartbeats
here have? Can you come up with a test that validates this?
let res ← EIO.asTask <| | ||
init {} |>.run' {} { options, fileName, fileMap } |>.run' { env } | ||
init {} |>.run' {} { options, fileName, fileMap, initHeartbeats } |>.run' { env } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that Lean.Core.wrapAsync
exists, and it does a bit more heartbeats arithmetic. Lean.Core.CoreM.toIO
looks relevant.
In only one case a
Core.Context
is created from within CoreM, and we inherit from the parent Context theinitHeartbeats
. Otherwise, we get the current heartbeats from IO.It's not entirely clear to me what the intended semantics of
lintCore
are; should they inherit the outer heartbeat count (as with this patch), or get a new heartbeat budget for each declaration (prior to it)?