-
Notifications
You must be signed in to change notification settings - Fork 534
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
feat: have IR checker suggest noncomputable
#4729
Conversation
@leodemoura Keven Buzzard was telling me today that he has to frequently help people with this IR compiler check issue. I'm not sure if this is the correct fix, but putting this error message is this particular place seemed potentially appropriate after studying If anything, this PR contains a simpler version of the test case at #1785. Note that removing the typeclass argument makes |
Mathlib CI status (docs):
|
Currently, `ll_infer_type` is responsible for telling the user about `noncomputable` when a definition depends on one without executable code. However, this is imperfect because type inference does not check every subexpression. This leads to errors later on that users find to be hard to interpret. Now, `Lean.IR.checkDecls` has a friendlier error message when it encounters constants without compiled definitions, suggesting to consider using `noncomputable`. While this function is an internal IR consistency check, it is also reasonable to have it give an informative error message in this particular case. The suggestion to use `noncomputable` is limited to just unknown constants. Some alternatives would be to either (1) create another checker just for missing constants, (2) change `ll_infer_type` to always visit every subexpression no matter if they are necessary for inferring the type, or (3) investigate whether `tests/lean/run/1785.lean` is due to a deeper issue. Closes leanprover#1785
fb07ecf
to
0820de5
Compare
Currently, `ll_infer_type` is responsible for telling the user about `noncomputable` when a definition depends on one without executable code. However, this is imperfect because type inference does not check every subexpression. This leads to errors later on that users find to be hard to interpret. Now, `Lean.IR.checkDecls` has a friendlier error message when it encounters constants without compiled definitions, suggesting to consider using `noncomputable`. While this function is an internal IR consistency check, it is also reasonable to have it give an informative error message in this particular case. The suggestion to use `noncomputable` is limited to just unknown constants. Some alternatives would be to either (1) create another checker just for missing constants, (2) change `ll_infer_type` to always visit every subexpression no matter if they are necessary for inferring the type, or (3) investigate whether `tests/lean/run/1785.lean` is due to a deeper issue. Closes leanprover#1785
Currently,
ll_infer_type
is responsible for telling the user aboutnoncomputable
when a definition depends on one without executable code. However, this is imperfect because type inference does not check every subexpression. This leads to errors later on that users find to be hard to interpret.Now,
Lean.IR.checkDecls
has a friendlier error message when it encounters constants without compiled definitions, suggesting to consider usingnoncomputable
. While this function is an internal IR consistency check, it is also reasonable to have it give an informative error message in this particular case. The suggestion to usenoncomputable
is limited to just unknown constants.Some alternatives would be to either (1) create another checker just for missing constants, (2) change
ll_infer_type
to always visit every subexpression no matter if they are necessary for inferring the type, or (3) investigate whethertests/lean/run/1785.lean
is due to a deeper issue.Closes #1785