Skip to content
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

Printing of multiple optional argument #4812

Closed
3 tasks done
fonqL opened this issue Jul 23, 2024 · 0 comments · Fixed by #4854
Closed
3 tasks done

Printing of multiple optional argument #4812

fonqL opened this issue Jul 23, 2024 · 0 comments · Fixed by #4854
Labels
bug Something isn't working P-medium We may work on this issue if we find the time

Comments

@fonqL
Copy link

fonqL commented Jul 23, 2024

Prerequisites

Please put an X between the brackets as you perform the following steps:

Description

A small pretty printer bug in multiple optional argument.

def f (a: Nat) (b := 1) (c := 2) (d := 3) := a + b + c + d

#check f 0

shows f 0 1 2 : Nat instead of f 0 : Nat or f 0 1 2 3 : Nat. The last optional argument is missing.

Context

Zulip

Discover this bug when using Array.foldl.

Versions

4.9.0

Additional Information

Impact

Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.

@fonqL fonqL added the bug Something isn't working label Jul 23, 2024
@leanprover-bot leanprover-bot added the P-medium We may work on this issue if we find the time label Jul 26, 2024
kmill added a commit to kmill/lean4 that referenced this issue Jul 27, 2024
…nting

Before, the delaborator was conservative about omitting optional arguments, only omitting the very last one. Now it can omit arbitrarily long sequences of optional arguments from the end.

For simplicity of implementation, every optional argument is delaborated and then potentially discarded. It could save state and lazily delaborate, but we're running under the hypothesis that most optional arguments are for very simple values (like `true`, `false`, or a numeric literal), so it is unlikely that efficiency gains, if any, are worth it. In particular, in the future structure constructors will have optional arguments, but `unexpandStructureInstance` assumes none of the optional fields are omitted.

Closes leanprover#4812
github-merge-queue bot pushed a commit that referenced this issue Jul 29, 2024
…nting (#4854)

Before, the delaborator was conservative about omitting optional
arguments, only omitting the very last one. Now it can omit arbitrarily
long sequences of optional arguments from the end.

For simplicity of implementation, every optional argument is delaborated
and then potentially discarded. It could save state and lazily
delaborate, but we're running under the hypothesis that most optional
arguments are for very simple values (like `true`, `false`, or a numeric
literal), so it is unlikely that efficiency gains, if any, are worth it.
In particular, in the future structure constructors will have optional
arguments, but `unexpandStructureInstance` assumes none of the optional
fields are omitted.

Closes #4812
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P-medium We may work on this issue if we find the time
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants